compare_alpha_diversity.py

98 views
Skip to first unread message

Oonagh Bodin

unread,
May 9, 2016, 3:53:39 AM5/9/16
to Qiime 1 Forum
Hey all, 

Im reasonably new to Qiime and having some difficulties using the compare_alpha_diversity.py command to run a T-test to compare treatments. I understand that the input comes from a file generated by collate_alpha.py which I get concatenates multiply files (as a result of using multiple rarefractions) from alpha_diversity.py. 

My problem is I am not using rarefraction as a form of normalisation therefore I am running my alpha_diversity.py on a single file (as opposed to batch) and only generate a single alpha output and nothing to collate. 

Is there a way of running compare_alpha_diversity.py without using a collated alpha diversity file? 

I tried running:

alpha_diversity.py -i CSS_normalized_bacteria.biom -m ace -o ace.txt

compare_alpha_diversity.py -i ace.txt -m mapping_file_b_corrected.txt -c Treatment -o treatment


But it returned this: 


Traceback (most recent call last):

  File "/usr/local/qiime/1.9.0-gcc/bin/compare_alpha_diversity.py", line 5, in <module>

    pkg_resources.run_script('qiime==1.9.0', 'compare_alpha_diversity.py')

  File "/usr/local/python/2.7.6-gcc/lib/python2.7/site-packages/pkg_resources.py", line 528, in run_script

    self.require(requires)[0].run_script(script_name, ns)

  File "/usr/local/python/2.7.6-gcc/lib/python2.7/site-packages/pkg_resources.py", line 1394, in run_script

    execfile(script_filename, namespace, namespace)

  File "/usr/local/qiime/1.9.0-gcc/lib/python2.7/site-packages/qiime-1.9.0-py2.7.egg/EGG-INFO/scripts/compare_alpha_diversity.py", line 234, in <module>

    main()

  File "/usr/local/qiime/1.9.0-gcc/lib/python2.7/site-packages/qiime-1.9.0-py2.7.egg/EGG-INFO/scripts/compare_alpha_diversity.py", line 198, in main

    num_permutations)

  File "/usr/local/qiime/1.9.0-gcc/lib/python2.7/site-packages/qiime-1.9.0-py2.7.egg/qiime/compare_alpha_diversity.py", line 227, in compare_alpha_diversities

    rarefaction_data, category)

  File "/usr/local/qiime/1.9.0-gcc/lib/python2.7/site-packages/qiime-1.9.0-py2.7.egg/qiime/compare_alpha_diversity.py", line 63, in sampleId_pairs

    category)

ValueError: No samples had a value for category: 'Treatment'.


My mapping file does have the category 'Treatment' so im not sure what to do ... Any help would be greatly appreciated :)


Cheers

Oonagh

ace.txt
mapping_file_b_corrected.txt

Kyle Bittinger

unread,
May 9, 2016, 8:04:48 PM5/9/16
to Qiime 1 Forum
QIIME does not have a built-in script to do this.  I suggest using some basic stats software for work like this -- you will likely need a tool to handle this stuff for experiments outside of QIIME.

I loaded up your data just to make sure the files weren't messed up.  Your data are consistent with a null hypothesis of no difference in ACE abundance according to treatment.

> library(qiimer)
> forum_samples <- read_qiime_mapping_file("~/Downloads/mapping_file_b_corrected.txt")
> forum_ace <- read.delim("~/Downloads/ace.txt", col.names = c("SampleID", "ace"))
> forum_data <- merge(forum_samples, forum_ace, by="SampleID")
> boxplot(ace ~ Treatment, data=forum_data)
> t.test(ace ~ Treatment, data=forum_data)

Welch Two Sample t-test

data:  ace by Treatment
t = -1.1849, df = 23.144, p-value = 0.2481
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 -27.070124   7.348932
sample estimates:
mean in group NL3_mutant  mean in group Wild-type 
                168.7106                 178.5712 

> wilcox.test(ace ~ Treatment, data=forum_data)

Wilcoxon rank sum test

data:  ace by Treatment
W = 68, p-value = 0.2995
alternative hypothesis: true location shift is not equal to 0

Oonagh Bodin

unread,
May 9, 2016, 9:34:31 PM5/9/16
to Qiime 1 Forum
Thanks for that Kyle much appreciated

The script description gave the impression is was a "T-test" and could be used but my stats knowledge is somewhat lacking unfortunately. 
Thanks heaps for running that script though, really helpful (definitely clear from the ACE values that the null hyp would be supported - just wanted to put an example of one of my diversities!) 

I'll continue analysis from here using R packages ^_^

Cheers
Oonagh

Reply all
Reply to author
Forward
0 new messages