Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: get_back_counts_for_line_plotf & get_back_res_meeting_min_occ #1

Open
dvc28 opened this issue Mar 10, 2021 · 1 comment
Open

Comments

@dvc28
Copy link

dvc28 commented Mar 10, 2021

Good day,
I read your recent paper Zamkovaya et al 2021 in ISME and I am excited to implement a similar network analysis (mdmnets package) with my data, but I am running into issues at the start of the code you provide.
I have 16S amplicon data analysed with dada2 pipeline (ASV table) for 23 samples and 70689 taxa in total.

I can create my phyloseq object without problems

seqtab.nochim<-readRDS("~/seqtab.nochim_ice8.rds")
rep.seqs <- colnames(seqtab.nochim)
rep.seqs <- Biostrings::DNAStringSet(rep.seqs)
otu.names <- RDPutils::make_otu_names(1:length(rep.seqs))
colnames(seqtab.nochim) <- otu.names
names(rep.seqs) <- otu.names
asv.table <- otu_table(seqtab.nochim, taxa_are_rows=FALSE)
phylo <- phyloseq(asv.table, rep.seqs) 

then I can estimate the prevalence, no problem

prevdf = apply(X = otu_table(phylo),MARGIN = ifelse(taxa_are_rows(phylo), yes=1, no=2), FUN=function(x){sum(x>0)}) 
  prevdf = data.frame(Prevalence = prevdf, TotalAbundance = taxa_sums(phylo))
  prevdf <- prevdf[prevdf$Prevalence > 0,]

but when I run this line
prev_lineplot <- get_back_counts_for_line_plotf (prevdf, "Environment")
Error in $<-.data.frame(tmp, "Rank6", value = character(0)) : replacement has 0 rows, data has 70689
I cannot make sense of this error. I also added metadata (sample_table) and taxonomy (taxa_table) to the phyloseq object but I still get this error.

and when I try

phylo_for_net <- get_back_res_meeting_min_occ(phylo, filter_val_percent=0.4)

Error in validObject(.Object) : invalid class “otu_table” object: OTU abundance data must have non-zero dimensions.
I have been checking my otu_table and I cannot find any obvious errors in my phyloseq object, all taxa and samples have values>1. I have tried pre-filtering my otu_table to eliminate low abundance and singletons with

filterlist  <- filterfun(kOverA(k=1, A=1, na.rm=FALSE))   
phylo  <- filter_taxa(phylo, filterlist, TRUE)

but I still get the same error with "get_back_res_meeting_min_occ". I have used this same data set to run Deseq2 and that worked smoothly so I am not sure what is the problem here.

I am very grateful for any feedback you may have regarding these issues.
Thank you for your time.

@nicolereynolds1
Copy link

I am having a similar issue as well. I would really like to use these analyses on my data, but I haven't been able to get past these errors.

I can make my phyloseq object and do the prevalence calculations, but at the next step, I get this error, same as dvc28:
prev_lineplot <- get_back_counts_for_line_plotf(prevdf, "bac+fungi") Error in $<-.data.frame(tmp, "Rank6", value = "MDM") : replacement has 1 row, data has 0

Also in the next step I get another error:
phylo_for_net <- get_back_res_meeting_min_occ(phylo, filter_val_percent=0.4) Error in access(object, "sam_data", errorIfNULL) : sam_data slot is empty

Any help would be greatly appreciated as I am excited to get results with this method for my data.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants