Some spot checkes of run time of different implementations of unweighted unifrac. Note that because this is comparing different software packages, the whole notebook can't be run in a single environment.
Comparing UniFrac in optimized mode and in pairwise mode. This is working from @wasade's fast_unifrac
branch (https://github.com/wasade/scikit-bio/tree/fast_unifrac) commit dd1a405
on 9 Nov 2015.
In [61]:
from biom import load_table
from skbio import TreeNode
from skbio.diversity.beta import beta_diversity
from skbio.diversity.beta import unweighted_unifrac
import numpy as np
t = load_table('/Users/caporaso/code/q2d2/example-data/keyboard/q191/otu-table.tsv')
d = t.matrix_data.toarray().T
#tree = TreeNode.read('/Users/caporaso/temp/forensic-test/or-otus/rep_set.tre')
tree = TreeNode.read('/Users/caporaso/code/q2d2/example-data/keyboard/q191/rep-set.tre')
In [66]:
%%timeit
beta_diversity('unweighted_unifrac', d, ids=t.ids('sample'), otu_ids=t.ids('observation'), tree=tree)
In [69]:
beta_diversity('unweighted_unifrac', d, ids=t.ids('sample'), otu_ids=t.ids('observation'), tree=tree)
Out[69]:
In [70]:
%%timeit
beta_diversity(unweighted_unifrac, d, ids=t.ids('sample'), otu_ids=t.ids('observation'), tree=tree)
In [71]:
42.5/.154
Out[71]:
Using master (i.e., Python implementation of UniFrac) for comparison. This is working from master
, commit ab72f3c
on 9 Nov 2015.
In [1]:
from biom import load_table
from skbio import TreeNode
from skbio.diversity.beta import pw_distances
from skbio.diversity.beta import unweighted_unifrac
import numpy as np
t = load_table('/Users/caporaso/code/q2d2/example-data/keyboard/q191/otu-table.tsv')
d = t.matrix_data.toarray().T
#tree = TreeNode.read('/Users/caporaso/temp/forensic-test/or-otus/rep_set.tre')
tree = TreeNode.read('/Users/caporaso/code/q2d2/example-data/keyboard/q191/rep-set.tre')
In [3]:
%%timeit
pw_distances('unweighted_unifrac', d, ids=t.ids('sample'), otu_ids=t.ids('observation'), tree=tree)
Now with QIIME 1.9.1
In [3]:
%%timeit
!beta_diversity.py -i /Users/caporaso/code/q2d2/example-data/keyboard/q191/otu-table.tsv -t /Users/caporaso/code/q2d2/example-data/keyboard/q191/rep-set.tre -o /Users/caporaso/temp -m unweighted_unifrac
In [5]:
%%timeit
!parallel_beta_diversity.py -O 7 -i /Users/caporaso/code/q2d2/example-data/keyboard/q191/otu-table.tsv -t /Users/caporaso/code/q2d2/example-data/keyboard/q191/rep-set.tre -o /Users/caporaso/temp -m unweighted_unifrac
In [6]:
!print_qiime_config.py
In [ ]: