Skip to content

Commit

Permalink
Merge pull request #108 from replikation/integration_Virsorter-2
Browse files Browse the repository at this point in the history
Integration virsorter 2
  • Loading branch information
mult1fractal authored Oct 15, 2020
2 parents 843c502 + 1b0e006 commit a9b5ee4
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ Toolname/Gitlink | Reference |
[VIBRANT](https://github.com/AnantharamanLab/VIBRANT)|[Automated recovery, annotation and curation of microbial viruses, and evaluation of virome function from genomic sequences](https://www.biorxiv.org/content/biorxiv/early/2019/11/26/855387.full.pdf)
[VirNet](https://github.com/alyosama/virnet)|[Deep attention model for viral reads identification](https://ieeexplore.ieee.org/document/8639400)
[Phigaro](https://github.com/bobeobibo/phigaro)| [Phigaro: high throughput prophage sequence annotation](https://www.biorxiv.org/content/10.1101/598243v1)
[Virsorter2 beta](https://github.com/jiarong/VirSorter2)|



Expand Down
2 changes: 2 additions & 0 deletions configs/container.config
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ process {
withLabel: virnet { container = 'multifractal/virnet-hack:0.1' }
withLabel: virsorter { container = 'multifractal/virsorter:0.1.2' }
withLabel: phigaro { container = 'multifractal/phigaro:0.5.2' }
withLabel: virsorter2 { container = 'multifractal/virsorter-2:0.1' }

}
14 changes: 14 additions & 0 deletions modules/parser/filter_virsorter2.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
process filter_virsorter2 {
label 'ubuntu'
input:
tuple val(name), path(results)
output:
tuple val(name), path("virsorter2_*.txt")
shell:
"""
tail -n+2 *.tsv | awk '\$2>=${params.vs2_filter}' | awk '{ print \$1 }' > virsorter2_\${PWD##*/}.txt
"""
}



14 changes: 14 additions & 0 deletions modules/raw_data_collection/virsorter2_collect_data.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
process virsorter2_collect_data {
publishDir "${params.output}/${name}/raw_data", mode: 'copy', pattern: "virsorter2_results_${name}.tar.gz"
label 'ubuntu'
input:
tuple val(name), path(rawdir)
output:
tuple val(name), path("virsorter2_results_${name}.tar.gz")
script:
"""
mkdir virsorter2
cp -r ${rawdir}/* virsorter2
tar -czf virsorter2_results_${name}.tar.gz virsorter2
"""
}
18 changes: 18 additions & 0 deletions modules/tools/virsorter2.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
process virsorter2 {
label 'virsorter2'
errorStrategy 'ignore'
input:
tuple val(name), path(fasta)
output:
tuple val(name), path("virsorter2_*.out/final-viral-score.tsv")
tuple val(name), path("virsorter2_*.out")
script:
"""
virsorter run -w virsorter2_\${PWD##*/}.out -i ${fasta} -j ${task.cpus}
"""
}


// tar cf virsorter2_results_\${PWD##*/}.out.tar virsorter2_\${PWD##*/}.out

//
2 changes: 1 addition & 1 deletion modules/upsetr.nf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ process upsetr_plot {
#nsets = 20, nintersects = 40
upset(fromList(sets), sets = names(sets),
mainbar.y.label = "No. of shared viral contigs", sets.x.label = "Amount of identified \\nviral contigs",
mainbar.y.label = "No. of shared viral contigs", sets.x.label = "Number of identified \\nviral contigs",
order.by = "freq", sets.bar.color = "#56B4E9", keep.order = F,
text.scale = 1.4, point.size = 2.6, line.size = 0.8, set_size.show = FALSE)
Expand Down
3 changes: 2 additions & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ params {
mp = false
vf = false
vs = false
vs2 = false
pp = false
sm = false
vb = false
Expand All @@ -49,7 +50,7 @@ params {
vf_filter = '0.9'
sm_filter = '0.5'
vn_filter = '0.5'
// vs_filter = ''
vs2_filter = '0.9'
// pp_filter = ''
// vb_filter = ''

Expand Down
23 changes: 22 additions & 1 deletion phage.nf
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ if (!params.setup && !workflow.profile.contains('test') && !workflow.profile.con
include { virsorter_collect_data; virsorter_virome_collect_data } from './modules/raw_data_collection/virsorter_collect_data'
include { phigaro } from './modules/tools/phigaro'
include { phigaro_collect_data } from './modules/raw_data_collection/phigaro_collect_data'
include { virsorter2 } from './modules/tools/virsorter2'
include { filter_virsorter2 } from './modules/parser/filter_virsorter2'
include { virsorter2_collect_data} from './modules/raw_data_collection/virsorter2_collect_data'

/*************
* DATABASES for Phage Identification
Expand Down Expand Up @@ -483,6 +486,22 @@ workflow virsorter_virome_wf {
else { virsorter_virome_results = Channel.from( [ 'deactivated', 'deactivated'] ) }
emit: virsorter_virome_results
}
//---------------------------------------------------------------------
workflow virsorter2_wf {
take: fasta
main: if (!params.vs2) {
virsorter2(fasta)
// filtering
filter_virsorter2(virsorter2.out[0].groupTuple(remainder: true))
// raw data collector
virsorter2_collect_data(virsorter2.out[1].groupTuple(remainder: true))
// result channel
virsorter2_results = filter_virsorter2.out
}
else { virsorter2_results = Channel.from( [ 'deactivated', 'deactivated'] ) }
emit: virsorter2_results
}
//------------------------------------------------------------------------

workflow pprmeta_wf {
take: fasta
Expand Down Expand Up @@ -640,6 +659,7 @@ workflow identify_fasta_MSF {

// gather results
results = virsorter_wf(fasta_validation_wf.out, virsorter_DB)
.concat(virsorter2_wf(fasta_validation_wf.out))
.concat(virsorter_virome_wf(fasta_validation_wf.out, virsorter_DB))
.concat(marvel_wf(fasta_validation_wf.out))
.concat(sourmash_wf(fasta_validation_wf.out, sourmash_DB))
Expand Down Expand Up @@ -828,7 +848,8 @@ def helpMSG() {
--virome deactivates virome-mode (vibrand and virsorter)
--dv_filter p-value cut-off [default: $params.dv_filter]
--mp_filter average nucleotide identity [default: $params.mp_filter]
--vf_filter p-value cut-off [default: $params.vf_filter]
--vf_filter score cut-off [default: $params.vf_filter]
--vs2_filter dsDNAphage score cut-off [default: $params.vs2_filter]
--sm_filter Similarity score [default: $params.sm_filter]
--vn_filter Score [default: $params.vn_filter]
Expand Down

0 comments on commit a9b5ee4

Please sign in to comment.