-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add SIDLE workflow from d4straub/pipesidle
- Loading branch information
Showing
19 changed files
with
940 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
process SIDLE_ALIGN { | ||
tag "$meta.region" | ||
label 'process_medium' | ||
|
||
container 'docker.io/d4straub/pipesidle:0.1.0-beta' | ||
|
||
input: | ||
tuple val(meta), path(kmers), path(seq) | ||
|
||
output: | ||
tuple val(meta), path("*rep-seqs_align-map.qza"), emit: aligned_map | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.region}" | ||
def primerfw = "${meta.fw_primer}" | ||
def primerrv = "${meta.rv_primer}" | ||
""" | ||
# https://q2-sidle.readthedocs.io/en/latest/reconstruction.html#regional-alignment | ||
export XDG_CONFIG_HOME="./xdgconfig" | ||
export MPLCONFIGDIR="./mplconfigdir" | ||
export NUMBA_CACHE_DIR="./numbacache" | ||
qiime sidle align-regional-kmers \\ | ||
--p-n-workers $task.cpus \\ | ||
--i-kmers ${kmers} \\ | ||
--i-rep-seq ${seq} \\ | ||
--p-region ${meta.region} \\ | ||
$args \\ | ||
--o-regional-alignment ${prefix}_rep-seqs_align-map.qza | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
qiime2: \$( qiime --version | sed '1!d;s/.* //' ) | ||
qiime2 plugin sidle: \$( qiime sidle --version | sed 's/ (.*//' | sed 's/.*version //' ) | ||
q2-sidle: \$( qiime sidle --version | sed 's/.*version //' | sed 's/)//' ) | ||
END_VERSIONS | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
process SIDLE_DBEXTRACT { | ||
tag "$meta.region,$meta.region_length" | ||
label 'process_medium' | ||
|
||
container 'docker.io/d4straub/pipesidle:0.1.0-beta' | ||
|
||
input: | ||
tuple val(meta), path(table), path(seq), path(db_seq), path(db_tax) | ||
|
||
output: | ||
tuple val(meta), path("db_*_kmers.qza"), emit: kmers | ||
tuple val(meta), path("db_*_map.qza") , emit: map | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.region}" | ||
def primerfw = "${meta.fw_primer}" | ||
def primerrv = "${meta.rv_primer}" | ||
def length = "${meta.region_length}" | ||
""" | ||
# https://q2-sidle.readthedocs.io/en/latest/database_preparation.html#prepare-a-regional-database-for-each-primer-set | ||
export XDG_CONFIG_HOME="./xdgconfig" | ||
export MPLCONFIGDIR="./mplconfigdir" | ||
export NUMBA_CACHE_DIR="./numbacache" | ||
#extract sequences | ||
qiime feature-classifier extract-reads \\ | ||
--p-n-jobs $task.cpus \\ | ||
--i-sequences $db_seq \\ | ||
$args \\ | ||
--p-f-primer $primerfw \\ | ||
--p-r-primer $primerrv \\ | ||
--o-reads db_${prefix}.qza | ||
#prepare to be used in alignment | ||
qiime sidle prepare-extracted-region \\ | ||
--p-n-workers $task.cpus \\ | ||
--i-sequences db_${prefix}.qza \\ | ||
--p-region "${prefix}" \\ | ||
--p-fwd-primer $primerfw \\ | ||
--p-rev-primer $primerrv \\ | ||
--p-trim-length $length \\ | ||
--o-collapsed-kmers db_${prefix}_${length}_kmers.qza \\ | ||
--o-kmer-map db_${prefix}_${length}_map.qza | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
qiime2: \$( qiime --version | sed '1!d;s/.* //' ) | ||
qiime2 plugin sidle: \$( qiime sidle --version | sed 's/ (.*//' | sed 's/.*version //' ) | ||
q2-sidle: \$( qiime sidle --version | sed 's/.*version //' | sed 's/)//' ) | ||
END_VERSIONS | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
process SIDLE_DBFILT { | ||
label 'process_low' | ||
|
||
container 'docker.io/d4straub/pipesidle:0.1.0-beta' | ||
|
||
input: | ||
path(seq) | ||
path(tax) | ||
|
||
output: | ||
path("db_filtered_sequences.qza") , emit: seq | ||
path("db_filtered_sequences_tax.qza") , emit: tax | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
def args = task.ext.args ?: '' | ||
def args2 = task.ext.args2 ?: '' | ||
""" | ||
# https://q2-sidle.readthedocs.io/en/latest/database_preparation.html#filtering-the-database | ||
#pre-filtering should be very permissive! | ||
export XDG_CONFIG_HOME="./xdgconfig" | ||
export MPLCONFIGDIR="./mplconfigdir" | ||
export NUMBA_CACHE_DIR="./numbacache" | ||
# authors of SMURF recommend "--p-num-degenerates 3" for greengenes 13_8 database at 99% | ||
# the RESCRIPt formatted Silva 128 database is filtered to exclude sequences with more than 5 degenerates [3], [4] | ||
qiime rescript cull-seqs \\ | ||
--p-n-jobs $task.cpus \\ | ||
--i-sequences $seq \\ | ||
$args \\ | ||
--o-clean-sequences db_filtered_sequences.qza | ||
#filtering a greengenes database for features missing a phylum (p__;) or kingdom(k__;) designation. | ||
#CPU=1 | ||
qiime taxa filter-seqs \\ | ||
--i-sequences db_filtered_sequences.qza \\ | ||
--i-taxonomy $tax \\ | ||
$args2 \\ | ||
--o-filtered-sequences db_filtered_sequences_tax.qza | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
qiime2: \$( qiime --version | sed '1!d;s/.* //' ) | ||
qiime2 rescript: \$( qiime rescript --version | sed 's/ (.*//' | sed 's/.*version //' ) | ||
END_VERSIONS | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
process SIDLE_DBRECON { | ||
label 'process_medium' | ||
|
||
container 'docker.io/d4straub/pipesidle:0.1.0-beta' | ||
|
||
input: | ||
val(metaid) | ||
path(map) | ||
path(aligned_map) | ||
|
||
output: | ||
path("reconstruction_map.qza") , emit: reconstruction_map | ||
path("reconstruction_summary.qza"), emit: reconstruction_summary | ||
path("reconstruction_summary/*") , emit: visualisation | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
def args = task.ext.args ?: '' | ||
def db_input = "" | ||
// sort the input so that the regions are sorted by sequence | ||
def df = [metaid, map, aligned_map].transpose().sort{ it[0] } | ||
for (i in df) { | ||
db_input += " --p-region "+i[0]+" --i-kmer-map "+i[1]+" --i-regional-alignment "+i[2] | ||
} | ||
""" | ||
#https://q2-sidle.readthedocs.io/en/latest/reconstruction.html#database-reconstruction | ||
export XDG_CONFIG_HOME="./xdgconfig" | ||
export MPLCONFIGDIR="./mplconfigdir" | ||
export NUMBA_CACHE_DIR="./numbacache" | ||
qiime sidle reconstruct-database \\ | ||
--p-n-workers $task.cpus \\ | ||
$db_input \\ | ||
$args \\ | ||
--o-database-map reconstruction_map.qza \\ | ||
--o-database-summary reconstruction_summary.qza | ||
#database summary can be used to evaluate the quality of the reconstruction; see Fuks, C; Elgart, M; Amir, A; et al (2018) “Combining 16S rRNA gene variable regions enables high-resolution microbial community profiling.” Microbiome. 6:17. doi: 10.1186/s40168-017-0396-x | ||
qiime metadata tabulate \\ | ||
--m-input-file reconstruction_summary.qza \\ | ||
--o-visualization reconstruction_summary.qzv | ||
qiime tools export \\ | ||
--input-path reconstruction_summary.qzv \\ | ||
--output-path "reconstruction_summary" | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
qiime2: \$( qiime --version | sed '1!d;s/.* //' ) | ||
qiime2 plugin sidle: \$( qiime sidle --version | sed 's/ (.*//' | sed 's/.*version //' ) | ||
q2-sidle: \$( qiime sidle --version | sed 's/.*version //' | sed 's/)//' ) | ||
END_VERSIONS | ||
""" | ||
} |
Oops, something went wrong.