awst
awst 1.15.0
awst
R
is an open-source statistical environment which can be easily modified to
enhance its functionality via packages. awst is a R
package
available via the Bioconductor repository for
packages. R
can be installed on any operating system from
CRAN after which you can install
awst by using the following commands in your R
session:
if (!requireNamespace("BiocManager", quietly = TRUE)) {
install.packages("BiocManager")
}
BiocManager::install("awst")
## Check that you have a valid Bioconductor installation
BiocManager::valid()
awst is based on many other packages and in particular in those that have implemented the infrastructure needed for dealing with RNA-seq data. That is, packages like SummarizedExperiment.
If you are asking yourself the question “Where do I start using Bioconductor?” you might be interested in this blog post.
As package developers, we try to explain clearly how to use our packages and in
which order to use the functions. But R
and Bioconductor
have a steep
learning curve so it is critical to learn where to ask for help. The blog post
quoted above mentions some but we would like to highlight the
Bioconductor support site as the main
resource for getting help: remember to use the awst
tag and check
the older posts.
Other alternatives are available such as creating GitHub issues and tweeting.
However, please note that if you want to receive help you should adhere to the
posting guidelines.
It is particularly critical that you provide a small reproducible example and
your session information so package developers can track down the source of the
error.
awst
We hope that awst will be useful for your research. Please use the following information to cite the package and the overall approach. Thank you!
## Citation info
citation("awst")
#> Warning in person1(given = given[[i]], family = family[[i]], middle =
#> middle[[i]], : It is recommended to use 'given' instead of 'middle'.
#> To cite package 'awst' in publications use:
#>
#> Risso D, Pagnotta SM (2021). "Per-sample standardization and
#> asymmetric winsorization lead to accurate clustering of RNA-seq
#> expression profiles." _Bioinformatics_.
#> doi:10.1093/bioinformatics/btab091
#> <https://doi.org/10.1093/bioinformatics/btab091>.
#>
#> A BibTeX entry for LaTeX users is
#>
#> @Article{,
#> title = {Per-sample standardization and asymmetric winsorization lead to accurate clustering of RNA-seq expression profiles},
#> author = {Davide Risso and Stefano Maria Pagnotta},
#> year = {2021},
#> journal = {Bioinformatics},
#> doi = {10.1093/bioinformatics/btab091},
#> }
awst
does?AWST aims to regularize the original read counts to reduce the effect of noise on the clustering of samples. In fact, gene expression data are characterized by high levels of noise in both lowly expressed features, which suffer from background effects and low signal-to-noise ratio, and highly expressed features, which may be the result of amplification bias and other experimental artifacts. These effects are of utmost importance in highly degraded or low input material samples, such as tumor samples and single cells.
AWST comprises two main steps. In the first one, namely the standardization
step, we standardize the counts by centering and scaling them, exploiting the
log-normal probability distribution. We refer to the standardized counts as
z-counts. The second step, namely the smoothing step, leverages a highly skewed
transformation that decreases the noise while preserving the influence of genes
to separate molecular subtypes. These two steps are implemented in the awst
function.
A further filtering method, implemented in the gene_filter
function, is
suggested to remove those features that only contribute noise to the clustering.
library(awst)
library(airway)
library(SummarizedExperiment)
library(EDASeq)
library(ggplot2)
Here, we will use the data in the airway package to illustrate
the awst
approach.
Please, see our paper (Risso and Pagnotta, 2021) and this repository for more extensive and biologically relevant examples.
data(airway)
airway
#> class: RangedSummarizedExperiment
#> dim: 63677 8
#> metadata(1): ''
#> assays(1): counts
#> rownames(63677): ENSG00000000003 ENSG00000000005 ... ENSG00000273492
#> ENSG00000273493
#> rowData names(10): gene_id gene_name ... seq_coord_system symbol
#> colnames(8): SRR1039508 SRR1039509 ... SRR1039520 SRR1039521
#> colData names(9): SampleName cell ... Sample BioSample
The data are stored in a RangedSummarizedExperiment
, a special case of the
SummarizedExperiment
class, one of the central classes in Bioconductor. If you
are not familiar with it, I recomment to look at its vignette available at
SummarizedExperiment.
First, we filter out non-expressed genes. For simplicity, we remove those genes with fewer than 10 reads on average across samples.
filter <- rowMeans(assay(airway)) >= 10
table(filter)
#> filter
#> FALSE TRUE
#> 47587 16090
se <- airway[filter,]
We are left with 16090 genes. We are now ready to apply awst
to the
data.
se <- awst(se)
se
#> class: RangedSummarizedExperiment
#> dim: 16090 8
#> metadata(1): ''
#> assays(2): counts awst
#> rownames(16090): ENSG00000000003 ENSG00000000419 ... ENSG00000273472
#> ENSG00000273486
#> rowData names(10): gene_id gene_name ... seq_coord_system symbol
#> colnames(8): SRR1039508 SRR1039509 ... SRR1039520 SRR1039521
#> colData names(9): SampleName cell ... Sample BioSample
plot(density(assay(se, "awst")[,1]), main = "Sample 1")
We can see that the majority of the values have been shrunk around −2, while the others values gradually increase up to around 4. The effect of reducing the contribution of lowly expressed genes, and of the winsorization for the highly expressed ones, results in a better separation of the samples, reflecting biological differences (Risso and Pagnotta, 2021).
The other main function of the awst package is gene_filter
.
It can be used to remove those genes that contribute little to nothing to the
distance between samples. The function uses an entropy measure to remove the
uninformative genes.
filtered <- gene_filter(se)
dim(filtered)
#> [1] 10842 8
Our final dataset is made of 8 genes.
We can see how the awst
transformation leads to separation between treatment
(along PC1) and cell line (along PC2).
res_pca <- prcomp(t(assay(filtered, "awst")))
df <- as.data.frame(cbind(res_pca$x, colData(airway)))
ggplot(df, aes(x = PC1, y = PC2, color = dex, shape = cell)) +
geom_point() + theme_classic()