Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
testfiles/*
q2_picrust2.egg-info/
q2_picrust2/__pycache__/
37 changes: 22 additions & 15 deletions q2_picrust2/_custom_tree_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import skbio
import biom
from os import path
import sys
import pandas as pd
from tempfile import TemporaryDirectory
from q2_types.feature_table import FeatureTable, Frequency
Expand Down Expand Up @@ -31,59 +32,65 @@ def custom_tree_pipeline(table: biom.Table,

picrust2_out = path.join(temp_dir, "picrust2_out")

print("Running the below commands:", file=sys.stderr)

# Run hidden-state prediction step (on 16S, EC, and KO tables
# separately.
hsp_out_16S = path.join(picrust2_out, "16S_predicted.tsv")
hsp_out_16S = path.join(picrust2_out, "16S_predicted.tsv.gz")
system_call_check("hsp.py -i 16S " +
" -t " + newick_infile +
" -p 1 " +
" -n " +
"-o " + hsp_out_16S +
" -m " + hsp_method)
" -m " + hsp_method,
print_out=True)

hsp_out_EC = path.join(picrust2_out, "EC_predicted.tsv")
hsp_out_EC = path.join(picrust2_out, "EC_predicted.tsv.gz")
system_call_check("hsp.py -i EC " +
" -t " + newick_infile +
" -p " + str(threads) +
" -o " + hsp_out_EC +
" -m " + hsp_method)
" -m " + hsp_method,
print_out=True)

hsp_out_KO = path.join(picrust2_out, "KO_predicted.tsv")
hsp_out_KO = path.join(picrust2_out, "KO_predicted.tsv.gz")
system_call_check("hsp.py -i KO " +
" -t " + newick_infile +
" -p " + str(threads) +
" -o " + hsp_out_KO +
" -m " + hsp_method)
" -m " + hsp_method,
print_out=True)

# Run metagenome pipeline step.
EC_metagenome_out = path.join(picrust2_out, "EC_metagenome_out")
system_call_check("metagenome_pipeline.py -i " + biom_infile +
" -m " + hsp_out_16S +
" -f " + hsp_out_EC +
" -o " + EC_metagenome_out +
" --max_nsti " + str(max_nsti))
" --max_nsti " + str(max_nsti),
print_out=True)

KO_metagenome_out = path.join(picrust2_out, "KO_metagenome_out")
system_call_check("metagenome_pipeline.py -i " + biom_infile +
" -m " + hsp_out_16S +
" -f " + hsp_out_KO +
" -o " + KO_metagenome_out +
" --max_nsti " + str(max_nsti))
" --max_nsti " + str(max_nsti),
print_out=True)

EC_out = path.join(EC_metagenome_out, "pred_metagenome_unstrat.tsv.gz")
KO_out = path.join(KO_metagenome_out, "pred_metagenome_unstrat.tsv.gz")

# Run pathway inference step.
pathways_out = path.join(picrust2_out, "pathways_out")

EC_out = path.join(EC_metagenome_out, "pred_metagenome_unstrat.tsv")

pathabun_out = path.join(pathways_out, "path_abun_unstrat.tsv.gz")
system_call_check("pathway_pipeline.py -i " + EC_out +
" -o " + pathways_out +
" -p " + str(threads))
" -p " + str(threads),
print_out=True)

# Read in output unstratified metagenome tables and return as BIOM
# objects.
KO_out = path.join(KO_metagenome_out, "pred_metagenome_unstrat.tsv")
pathabun_out = path.join(pathways_out, "path_abun_unstrat.tsv")

ko_biom = biom.load_table(KO_out)
ec_biom = biom.load_table(EC_out)
pathabun_biom = biom.load_table(pathabun_out)
Expand Down
5 changes: 4 additions & 1 deletion q2_picrust2/_full_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@ def full_pipeline(table: biom.Table,
func_outputs, pathway_outputs = picrust2.pipeline.full_pipeline(study_fasta=seq_outfile,
input_table=biom_infile,
output_folder=picrust2_out,
threads=threads,
processes=threads,
ref_dir=default_ref_dir,
in_traits="EC,KO",
custom_trait_tables=None,
marker_gene_table=default_tables["16S"],
pathway_map=default_pathway_map,
rxn_func="EC",
no_pathways=False,
regroup_map=default_regroup_map,
no_regroup=False,
metagenome_contrib=True,
stratified=False,
max_nsti=max_nsti,
min_reads=1,
Expand All @@ -59,6 +61,7 @@ def full_pipeline(table: biom.Table,
skip_minpath=False,
coverage=False,
per_sequence_contrib=False,
remove_intermediate=False,
verbose=True)

# Convert the returned unstratified tables to BIOM tables.
Expand Down
2 changes: 1 addition & 1 deletion q2_picrust2/plugin_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

plugin = Plugin(
name='picrust2',
version="0.0.3",
version="2019.4",
website='https://github.com/gavinmdouglas/q2-picrust2',
package='q2_picrust2',
description=('This QIIME 2 plugin wraps the default 16S PICRUSt2 pipeline to run '
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="q2-picrust2",
version="0.0.3",
version="2019.4",
packages=find_packages(),
package_data={'q2_picrust2': ['citations.bib']},
author="Gavin Douglas",
Expand Down