Skip to content

Commit

Permalink
Adjust runtime analysis for better plots
Browse files Browse the repository at this point in the history
  • Loading branch information
BenKaehler committed Jul 5, 2017
1 parent ba087d9 commit 6a43bc2
Showing 1 changed file with 28 additions and 56 deletions.
84 changes: 28 additions & 56 deletions ipynb/runtime/compute-runtimes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
"\n",
"from tax_credit.framework_functions import (runtime_make_test_data,\n",
" runtime_make_commands,\n",
" clock_runtime,\n",
" )"
" clock_runtime)"
]
},
{
Expand All @@ -37,19 +36,19 @@
"source": [
"## project_dir should be the directory where you've downloaded (or cloned) the \n",
"## tax-credit repository. \n",
"project_dir = expandvars(\"$HOME/Desktop/projects/tax-credit\")\n",
"project_dir = '../..'\n",
"data_dir = join(project_dir, \"data\")\n",
"\n",
"results_dir = expandvars(\"$HOME/Desktop/projects/tax-credit-runtime\")\n",
"results_dir = join(project_dir, 'temp_dir_runtime')\n",
"runtime_results = join(results_dir, 'runtime_results.txt')\n",
"tmpdir = join(results_dir, 'tmp')\n",
"\n",
"ref_db_dir = expandvars(\"$HOME/Desktop/ref_dbs/\")\n",
"ref_seqs = join(ref_db_dir, 'gg_13_8_otus/rep_set/99_otus/dna-sequences.fasta')\n",
"ref_taxa = join(ref_db_dir, 'gg_13_8_otus/taxonomy/99_otu_taxonomy.txt')\n",
"ref_db_dir = join(project_dir, 'data/ref_dbs/gg_13_8_otus')\n",
"ref_seqs = join(ref_db_dir, '99_otus.fasta')\n",
"ref_taxa = join(ref_db_dir, '99_otu_taxonomy.txt')\n",
"\n",
"num_iters = 1\n",
"sampling_depths = [1, 10, 100, 1000, 10000]"
"sampling_depths = [1] + list(range(2000,10001,2000))"
]
},
{
Expand All @@ -62,7 +61,7 @@
},
{
"cell_type": "code",
"execution_count": 44,
"execution_count": 3,
"metadata": {
"collapsed": true
},
Expand All @@ -80,24 +79,24 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[33mQIIME is caching your current deployment for improved performance. This may take a few moments and should only happen once per deployment.\u001b[0m\n",
"\u001b[32mSaved TaxonomicClassifier to: /Users/nbokulich/Desktop/projects/tax-credit-runtime/tmp/1.fna.nb.qza\u001b[0m\n",
"\u001b[32mSaved TaxonomicClassifier to: /Users/nbokulich/Desktop/projects/tax-credit-runtime/tmp/10.fna.nb.qza\u001b[0m\n",
"\u001b[32mSaved TaxonomicClassifier to: /Users/nbokulich/Desktop/projects/tax-credit-runtime/tmp/100.fna.nb.qza\u001b[0m\n",
"\u001b[32mSaved TaxonomicClassifier to: /Users/nbokulich/Desktop/projects/tax-credit-runtime/tmp/1000.fna.nb.qza\u001b[0m\n",
"\u001b[32mSaved TaxonomicClassifier to: /Users/nbokulich/Desktop/projects/tax-credit-runtime/tmp/10000.fna.nb.qza\u001b[0m\n"
"\u001b[32mSaved TaxonomicClassifier to: ../../temp_dir_runtime/tmp/1.fna.nb.qza\u001b[0m\n",
"\u001b[32mSaved TaxonomicClassifier to: ../../temp_dir_runtime/tmp/2000.fna.nb.qza\u001b[0m\n",
"\u001b[32mSaved TaxonomicClassifier to: ../../temp_dir_runtime/tmp/4000.fna.nb.qza\u001b[0m\n",
"\u001b[32mSaved TaxonomicClassifier to: ../../temp_dir_runtime/tmp/6000.fna.nb.qza\u001b[0m\n",
"\u001b[32mSaved TaxonomicClassifier to: ../../temp_dir_runtime/tmp/8000.fna.nb.qza\u001b[0m\n",
"\u001b[32mSaved TaxonomicClassifier to: ../../temp_dir_runtime/tmp/10000.fna.nb.qza\u001b[0m\n"
]
}
],
"source": [
"! qiime tools import --input-path {ref_taxa} --output-path {ref_taxa}.qza --type \"FeatureData[Taxonomy]\"\n",
"! qiime tools import --input-path {ref_taxa} --output-path {ref_taxa}.qza --type \"FeatureData[Taxonomy]\" --source-format HeaderlessTSVTaxonomyFormat\n",
"\n",
"for depth in sampling_depths:\n",
" tmpfile = join(tmpdir, str(depth)) + '.fna'\n",
Expand Down Expand Up @@ -125,13 +124,14 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"qiime1_template = ('source activate qiime1; source ~/.bashrc; '\n",
"qiime1_setup = join(results_dir, '.bashrc')\n",
"qiime1_template = ('source activate qiime1; source ' + qiime1_setup + '; '\n",
" 'assign_taxonomy.py -i {1} -o {0} -r {2} -t {3} -m {4} {5}')\n",
"blast_template = ('qiime feature-classifier classify-consensus-blast --i-query {1}.qza --o-classification '\n",
" '{0}/assign.tmp --i-reference-reads {2}.qza --i-reference-taxonomy {3}.qza {5}')\n",
Expand Down Expand Up @@ -169,7 +169,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 5,
"metadata": {
"collapsed": true
},
Expand All @@ -188,7 +188,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 6,
"metadata": {
"collapsed": true
},
Expand All @@ -207,16 +207,16 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20\n",
"('qiime feature-classifier classify-consensus-vsearch --i-query /Users/nbokulich/Desktop/projects/tax-credit-runtime/tmp/1.fna.qza --o-classification /Users/nbokulich/Desktop/projects/tax-credit-runtime/tmp/assign.tmp --i-reference-reads /Users/nbokulich/Desktop/projects/tax-credit-runtime/tmp/10.fna.qza --i-reference-taxonomy /Users/nbokulich/Desktop/projects/tax-credit/data/ref_dbs/gg_13_8_otus/99_otu_taxonomy_clean.tsv.qza --p-perc-identity 0.90', 'vsearch', '1', '10', 0)\n",
"('qiime feature-classifier classify-consensus-blast --i-query /Users/nbokulich/Desktop/projects/tax-credit-runtime/tmp/10000.fna.qza --o-classification /Users/nbokulich/Desktop/projects/tax-credit-runtime/tmp/assign.tmp --i-reference-reads /Users/nbokulich/Desktop/projects/tax-credit-runtime/tmp/10000.fna.qza --i-reference-taxonomy /Users/nbokulich/Desktop/projects/tax-credit/data/ref_dbs/gg_13_8_otus/99_otu_taxonomy_clean.tsv.qza --p-evalue 0.001', 'blast+', '10000', '10000', 0)\n"
"84\n",
"('qiime feature-classifier classify-sklearn --o-classification ../../temp_dir_runtime/tmp/assign.tmp --i-classifier ../../temp_dir_runtime/tmp/2000.fna.nb.qza --i-reads ../../temp_dir_runtime/tmp/1.fna.qza --p-confidence 0.7', 'naive-bayes', '1', '2000', 0)\n",
"('source activate qiime1; source ../../temp_dir_runtime/.bashrc; assign_taxonomy.py -i ../../temp_dir_runtime/tmp/10000.fna -o ../../temp_dir_runtime/tmp -r ../../temp_dir_runtime/tmp/10000.fna -t ../../data/ref_dbs/gg_13_8_otus/99_otu_taxonomy.txt -m rdp --confidence 0.5 --rdp_max_memory 16000', 'rdp', '10000', '10000', 0)\n"
]
}
],
Expand All @@ -228,41 +228,13 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [
{
"data": {
"text/plain": [
"[None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None]"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"Parallel(n_jobs=4)(delayed(clock_runtime)(command, runtime_results, force=False) for command in (list(set(commands_a + commands_b))))"
"Parallel(n_jobs=1)(delayed(clock_runtime)(command, runtime_results, force=False) for command in (list(set(commands_a + commands_b))))"
]
},
{
Expand Down

0 comments on commit 6a43bc2

Please sign in to comment.