metabaRfactory / metabaR

metabaR is an R package to curate and visualise DNA metabarcoding data after basic bioinformatics analyses.
http://metabaRfactory.github.io/metabaR
13 stars 3 forks source link

Extra 'simplify' parameter needed in subset_metabarlist #16

Open grossebusedu38 opened 4 years ago

grossebusedu38 commented 4 years ago

subset_metabarlist <- function(metabarlist, table, indices)

would become

subset_metabarlist <- function(metabarlist, table, indices, simplify=TRUE)

=================

when simplify=FALSE, do not remove any columns in the reads table:

reads <- reads[, colSums(reads) > 0, drop = F]

would become

reads <- reads[, (colSums(reads) > 0) & simplify, drop = F]

=================

usefull when you want to compare the reads table of two subseted metabarlist that were originally the same:

Example:

soil_euk2 <- soil_euk soil_euk2$reads <- corrected

metabaR::ggpcrtag(soil_euk2) metabaR::ggpcrtag(soil_euk)

s1<- subset_metabarlist(soil_euk, 'pcrs', {v <- soil_euk$pcrs$control_type=="sequencing";v[is.na(v)]<-F;v}) s2 <- subset_metabarlist(soil_euk2, 'pcrs', {v <- soil_euk$pcrs$control_type=="sequencing";v[is.na(v)]<-F;v})

s(1|2)$reads and s(1|2)$motus tables are not easily comparable