mmt
objects based on variable/sample metadata.mt_subset.Rd
Subset mt objects based on sample metadata
mt_subset(data, ...)
mmt | (required) Data list as loaded with |
---|---|
sub_genes | (optional) A string specifying a logical row subset operation on the mtgene dataframe in the mt object parsed to subset. |
sub_samples | (optional) A string specifying a logical row subset operation on the mtmeta dataframe in the mt object parsed to subset. |
minreads | Minimum average number of reads pr. gene. Genes below this value will be removed. (default: |
frac0 | Fraction of zeros allowed per gene. Genes with a higher fraction of zeros will be removed. (default: |
normalise | Normalise the read counts AFTER reads have been removed by the minreads argument but BEFORE any sample/gene subsetting. (default:
|
A modifed mt object
The function mt_subset
operates in three steps:
Filter - genes according to minreads
and frac0
.
Normalise - as specified in normalise
.
Subset - according to sub_genes
and sub_samples
.
Subsetting are performed on the mtmeta/mtgene data by subset and the whole object is then adjusted accordingly.
# NOT RUN { # Get some data. data("example_mmt") # Let's subset to contig 1, 7675, and 69676. mt1 <- mt_subset(example_mmt,sub_genes = "contig %in% c(1,7675,69676)") mt1 # Let's subset to specific organism. mt2 <- mt_subset(example_mmt,sub_samples = "Organism == 'Brocadia'") mt2 # Let's do both and remove genes with less than 10000 reads in total. mt3 <- mt_subset(example_mmt, sub_samples = "Organism == 'Brocadia'", sub_genes = "contig %in% c(1,7675,69676)", minreads = 10000) mt3 # You can also normalise the data and subset. mt4 <- mt_subset(example_mmt, sub_samples = "Organism == 'Brocadia'", sub_genes = "contig %in% c(1,7675,69676)", minreads = 10000, normalise = "libsize") mt4 # Note "Normalised:" is now included. # }