asteinberger9 / seq_scripts

GNU General Public License v3.0
7 stars 4 forks source link

Error in abund[sample, otus] : subscript out of bounds #1

Closed melissawhitaker closed 4 years ago

melissawhitaker commented 7 years ago

I'm playing around with the simper.pretty and kruskal.pretty functions, and I receive an error when trying to run kruskall.pretty (code below). Any ideas? Thanks!

simper.pretty(otu_table, sample_data, c('Species'), perc_cutoff=1, low_cutoff = 'y', low_val=0.01, 'Species') simper.results = data.frame(read.csv("Species_clean_simper.csv")) kruskal.pretty(otu_table, sample_data, simper.results, c('Species'), 'Species', tax_table) Error in abund[sample, otus] : subscript out of bounds

moyegunle commented 7 years ago

I also have this problem and would love your help

asteinberger9 commented 6 years ago

@melissawhitaker @moyegunle Sorry for my extreme delay addressing this issue, I see I need to check my GitHub more frequently. I believe this error is most commonly caused by the presence of underscores ('_') in your metadata file. This will cause the script to crash, producing the error you describe. I haven't figured out a quick fix for this yet, but once I do I will update the scripts. In the meantime, if you want to use these scripts just make sure there are no underscores in your metadata table. Note: Sample names with underscores are fine and will not break the script. If you still have issues shoot me an email and we will figure it out.

milanvarsadiya commented 6 years ago

Even after removing the underscore from my metadata, I am still getting above mentioned error. Have you figured it out what causing this error?

asteinberger9 commented 6 years ago

This error typically results from metadata names that the script cannot handle. Feel free email me a sample of your OTU and metadata tables and I will help troubleshoot.

atgustin commented 5 years ago

Hey there - I appreciate you keeping these scripts available! Pretty.simper worked great, but when i try to run kruskal.pretty I'm encountering the following error:

Error in eval(predvars, data, env) : object 'listbact' not found

in the traceback, eval(predvars,data,env) is the last item.

Any time you make to respond is much appreciated!

asteinberger9 commented 5 years ago

Hey @atgustin , I am glad these scripts are useful for your research. Apologies for the error with kruskal.pretty, it is pretty sensitive to OTU and metadata formats that are different from the ones I initially designed them for. Can you send me a sample of your metadata and otu tables? I will test them out and see what is causing the error.

poojam121992 commented 3 years ago

Hello, First of all thank you for the scripts. I am facing a similar issue. simper.pretty(otu1, meta1,c("Group"), perc_cutoff = 1, low_cutoff = "y", low_val = 0.01, "Group") simper.results = data.frame(read.csv("Group_clean_simper.csv")) kruskal.pretty(otu1, meta1, simper.results,c("Group"), "Group", taxa1)

simper.pretty works fine but when I run kruskal.pretty I get the following error "Error in abund[sample, otus] : subscript out of bounds"... solution might be very simple but I am kind of stuck here.

Any help would be appreciated.

Thank you.

asteinberger9 commented 3 years ago

Hi @poojam121992, You're welcome, apologies for the scripts giving you errors. First, make sure you are using the newest release of the scripts, v1.1. Second, check that your OTU, meta, and tax tables are in a format similar to those in the README.md for this repo.

If those check out and the script still doesn't work you can email me a subset of your OTU, meta, and taxonomy tables and I will take a look at them when I have time.

NitoCR commented 3 years ago

Hi, first of all thanks for the scripts. I need the script to see the actual dissimiliarity %contribution value of each species in my research. I have problem with simper.pretty as shown below

source("D:/Afry/R/seq_scripts-1.1/seq_scripts-1.1/simper_pretty.R") Error in comm[group == comp[i, 1], , drop = FALSE] : (subscript) logical subscript too long

where can i get your email so i can give you my data set i use?

Malokidz commented 2 years ago

Thank you very much for these scripts. For those who ask about this error ""Error in abund[sample, otus] : subscript out of bounds". You just check your OTU table, in the most cases you should transpose the OTU table as asteinberger9 suggested in the README file.

While the script does have some flexibility with data input format, it was designed and optimized to work with formats detailed below. For best results make sure there are no spaces or _ in the otu table column headers, nor the Metadata column headers and values. Also be sure that sample names match across OTU and metadata tables and OTU names match between OTU and taxonomy tables. OTU names can be taxonomic rankings (Phylum/Family/Genus), however if simper.pretty returns sample names rather than OTU names in the OTU column, try to transpose your OTU table prior to running simper.pretty. Ex. transp.otu_table <- as.data.frame(t(otu_table)).