Skip to content

Commit

Permalink
Added versions snippet to multiple modules
Browse files Browse the repository at this point in the history
  • Loading branch information
GallVp committed Feb 26, 2024
1 parent 1b2632f commit 1dd2e26
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 18 deletions.
7 changes: 7 additions & 0 deletions modules/local/agp2assembly.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@ process AGP2ASSEMBLY {

output:
tuple val(sample_id_on_tag), path("*.agp.assembly"), emit: assembly
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def VERSION = '0.1.0'
"""
assembly_tag=\$(echo $sample_id_on_tag | sed 's/.*\\.on\\.//g')
agp2assembly.py $agp_file "\${assembly_tag}.agp.assembly"
cat <<-END_VERSIONS > versions.yml
"${task.process}":
juicebox_scripts: $VERSION
END_VERSIONS
"""
}
15 changes: 14 additions & 1 deletion modules/local/assembly2bedpe.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ process ASSEMBLY2BEDPE {
tuple val(sample_id_on_tag), path(agp_assembly_file)

output:
tuple val(sample_id_on_tag), path("*.assembly.bedpe"), emit: bedpe
tuple val(sample_id_on_tag), path("*.assembly.bedpe") , emit: bedpe
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -17,11 +18,23 @@ process ASSEMBLY2BEDPE {
"""
assembly_tag=\$(echo $sample_id_on_tag | sed 's/.*\\.on\\.//g')
assembly2bedpe.py $agp_assembly_file > "\${assembly_tag}.assembly.bedpe"
cat <<-END_VERSIONS > versions.yml
"${task.process}":
python: \$(python --version | tr -d 'Python[:space:]')
pandas: \$(python -c "import pandas; print(pandas.__version__)")
END_VERSIONS
"""

stub:
"""
assembly_tag=\$(echo $sample_id_on_tag | sed 's/.*\\.on\\.//g')
touch "\${assembly_tag}.assembly.bedpe"
cat <<-END_VERSIONS > versions.yml
"${task.process}":
python: \$(python --version | tr -d 'Python[:space:]')
pandas: \$(python -c "import pandas; print(pandas.__version__)")
END_VERSIONS
"""
}
8 changes: 7 additions & 1 deletion modules/local/hic2html.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ process HIC2HTML {
tuple val(sample_id_on_tag), path(hic_file)

output:
path "*.html", emit: html
path "*.html" , emit: html
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -17,5 +18,10 @@ process HIC2HTML {
"""
file_name="$hic_file"
hic2html.py "$hic_file" > "\${file_name%.*}.html"
cat <<-END_VERSIONS > versions.yml
"${task.process}":
python: \$(python --version | tr -d 'Python[:space:]')
END_VERSIONS
"""
}
8 changes: 7 additions & 1 deletion modules/local/juicer_sort.nf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ process JUICER_SORT {
tuple val(sample_id_on_tag), path(out_links_txt)

output:
tuple val(sample_id_on_tag), path("*sorted.links.txt"), emit: links
tuple val(sample_id_on_tag), path("*sorted.links.txt") , emit: links
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -21,5 +22,10 @@ process JUICER_SORT {
-k2,2 -k6,6 \\
$out_links_txt \\
> out.sorted.links.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
sort: \$(sort --version | sed -n '/sort (GNU coreutils) / s/sort (GNU coreutils) //p')
END_VERSIONS
"""
}
9 changes: 8 additions & 1 deletion modules/local/makeagpfromfasta.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,21 @@ process MAKEAGPFROMFASTA {
tuple val(sample_id_on_tag), path(assembly_fasta)

output:
tuple val(sample_id_on_tag), path("*.agp"), emit: agp
tuple val(sample_id_on_tag), path("*.agp") , emit: agp
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def VERSION = '0.1.0'
"""
file_name="$assembly_fasta"
makeAgpFromFasta.py $assembly_fasta "\${file_name%%.*}.agp"
cat <<-END_VERSIONS > versions.yml
"${task.process}":
juicebox_scripts: $VERSION
END_VERSIONS
"""
}
17 changes: 12 additions & 5 deletions modules/local/matlock_bam2_juicer.nf
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,23 @@ process MATLOCK_BAM2_JUICER {
'biocontainers/matlock:20181227--h4b03ef3_3' }"

input:
tuple val(sample_id_on_tag), path(hic_bam_scaffolds)
tuple val(sample_id_on_tag), path(hic_bam_scaffolds)

output:
tuple val(sample_id_on_tag), path("out.links.txt")
tuple val(sample_id_on_tag), path("out.links.txt") , emit: links
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
"""
matlock bam2 juicer $hic_bam_scaffolds out.links.txt
"""
def VERSION = '20181227'
"""
matlock bam2 juicer $hic_bam_scaffolds out.links.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
matlock: $VERSION
END_VERSIONS
"""
}
8 changes: 7 additions & 1 deletion modules/local/ncbi_fcs_gx_setup_sample.nf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ process NCBI_FCS_GX_SETUP_SAMPLE {
tuple val(asm_tag), path(fasta_file)

output:
path 'fasta.file.for.*.fasta', emit: fsata
path 'fasta.file.for.*.fasta' , emit: fsata
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -22,5 +23,10 @@ process NCBI_FCS_GX_SETUP_SAMPLE {
}
"""
ln -s $fasta_file "fasta.file.for.${asm_tag}.fasta"
cat <<-END_VERSIONS > versions.yml
"${task.process}":
ubuntu: \$(cat /etc/issue | tr -d 'Ubuntu LTS[:space:]\\\\')
END_VERSIONS
"""
}
13 changes: 12 additions & 1 deletion modules/local/runassemblyvisualizer.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ process RUNASSEMBLYVISUALIZER {
tuple val(sample_id_on_tag), path(agp_assembly_file), path(sorted_links_txt_file)

output:
tuple val(sample_id_on_tag), path("*.hic"), emit: hic
tuple val(sample_id_on_tag), path("*.hic") , emit: hic
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -23,11 +24,21 @@ process RUNASSEMBLYVISUALIZER {
$agp_assembly_file $sorted_links_txt_file
mv "\${file_name%.*}.hic" "\${assembly_tag}.hic"
cat <<-END_VERSIONS > versions.yml
"${task.process}":
run-assembly-visualizer.sh: \$(/usr/src/3d-dna/visualize/run-assembly-visualizer.sh -h | sed -n '/Visualizing draft genomes in juicebox:/ s/Visualizing draft genomes in juicebox: //p')
END_VERSIONS
"""

stub:
"""
assembly_tag=\$(echo $sample_id_on_tag | sed 's/.*\\.on\\.//g')
touch "\${assembly_tag}.hic"
cat <<-END_VERSIONS > versions.yml
"${task.process}":
run-assembly-visualizer.sh: \$(/usr/src/3d-dna/visualize/run-assembly-visualizer.sh -h | sed -n '/Visualizing draft genomes in juicebox:/ s/Visualizing draft genomes in juicebox: //p')
END_VERSIONS
"""
}
17 changes: 14 additions & 3 deletions subworkflows/local/fq2hic.nf
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,32 @@ workflow FQ2HIC {

// MODULE: MAKEAGPFROMFASTA | AGP2ASSEMBLY | ASSEMBLY2BEDPE
MAKEAGPFROMFASTA ( ch_bam_and_ref.map { meta3, bam, fa -> [ meta3.id, fa ] } )
| AGP2ASSEMBLY
| ASSEMBLY2BEDPE
AGP2ASSEMBLY ( MAKEAGPFROMFASTA.out.agp )
ASSEMBLY2BEDPE ( AGP2ASSEMBLY.out.assembly )

ch_versions = ch_versions.mix(MAKEAGPFROMFASTA.out.versions.first())
| mix(AGP2ASSEMBLY.out.versions.first())
| mix(ASSEMBLY2BEDPE.out.versions.first())

// MODULE: MATLOCK_BAM2_JUICER | JUICER_SORT
MATLOCK_BAM2_JUICER ( ch_bam_and_ref.map { meta3, bam, fa -> [ meta3.id, bam ] } )
| JUICER_SORT

JUICER_SORT ( MATLOCK_BAM2_JUICER.out.links )

ch_versions = ch_versions.mix(MATLOCK_BAM2_JUICER.out.versions.first())
| mix(JUICER_SORT.out.versions.first())

// MODULE: RUNASSEMBLYVISUALIZER
RUNASSEMBLYVISUALIZER ( AGP2ASSEMBLY.out.assembly.join(JUICER_SORT.out.links) )

ch_hic = RUNASSEMBLYVISUALIZER.out.hic
ch_versions = ch_versions.mix(RUNASSEMBLYVISUALIZER.out.versions.first())

// MODULE: HIC2HTML
HIC2HTML ( ch_hic )

ch_versions = ch_versions.mix(HIC2HTML.out.versions.first())

emit:
hic = ch_hic
html = HIC2HTML.out.html
Expand Down
11 changes: 7 additions & 4 deletions subworkflows/local/ncbi_fcs_gx.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ workflow NCBI_FCS_GX {
tax_id // val: Integer

main:
ch_versions = Channel.empty()

// MODULE: NCBI_FCS_GX_SETUP_SAMPLE
NCBI_FCS_GX_SETUP_SAMPLE ( tuple_of_tag_file )

ch_all_samples = NCBI_FCS_GX_SETUP_SAMPLE.out.fsata
| collect

ch_versions = ch_versions.mix(NCBI_FCS_GX_SETUP_SAMPLE.out.versions.first())

// MODULE: NCBI_FCS_GX_SCREEN_SAMPLES
NCBI_FCS_GX_SCREEN_SAMPLES(
ch_all_samples,
Expand All @@ -38,14 +42,13 @@ workflow NCBI_FCS_GX {
[tag, it]
}

ch_versions = ch_versions.mix(NCBI_FCS_GX_SCREEN_SAMPLES.out.versions)

// MODULE: NCBI_FCS_GX_KRONA_PLOT
NCBI_FCS_GX_KRONA_PLOT ( ch_gx_taxonomy )

ch_gx_taxonomy_plot = NCBI_FCS_GX_KRONA_PLOT.out.plot

ch_versions = Channel.empty()
| mix(NCBI_FCS_GX_SCREEN_SAMPLES.out.versions.first())
| mix(NCBI_FCS_GX_KRONA_PLOT.out.versions.first())
ch_versions = ch_versions.mix(NCBI_FCS_GX_KRONA_PLOT.out.versions.first())

emit:
gx_report = ch_gx_report
Expand Down

0 comments on commit 1dd2e26

Please sign in to comment.