Hello,
I’m very excited about the formatting feature! However, I’ve noticed that any comments within “process” blocks are removed during formatting. Here’s an example:
process MY_PROCESS {
/*
This block comment is removed.
*/
label 'foo' // This line comment is also removed.
...
}
Is there a way to preserve comments within process
blocks when formatting? Any help or guidance would be appreciated!
Thank you!
Hi @Sukh_Sekhon ,
Welcome to the community forum. I just talked with the team and this accidental removal of comments within the process block has already been flagged and they’re working on that. Thanks for reporting it here.
If you want to make sure you’re made aware whne it’s fixed, please open an issue at Issues · nextflow-io/vscode-language-nextflow · GitHub .
1 Like
jfy133
(James A. Fellows Yates)
November 15, 2024, 12:29pm
3
I also just (independently) reported this on the GitHub repo
opened 10:13AM - 15 Nov 24 UTC
When formatting the file all comments get removed outside the script scope, and … the one comment within the script block at the end of the line gets placed below (identified by @Krannich479).
- Is it expected that no comments are allowed in the rest of the process file? This seems overly strict.
- I think more naturally a comment should be moved _above_ the line it originally was on
Given a process like this:
```nextflow
process MASON_SIMULATOR {
// Job label
// tag "${sample}"
// Store results
publishDir "${params.outdir}", mode: 'copy', pattern: "*.{NGSWGS.R1.fastq,NGSWGS.R2.fastq,bam}"
// Engine settings
conda 'bioconda::mason=2.0.9'
// Resources
cpus 2
// Process I/O
input:
tuple val(sample), path(vcf)
val ref
val ref_idx
output:
path "simulated_hap${sample}.NGSWGS.{R1,R2}.fastq", emit: fastqs
path "simulated_hap${sample}.NGSWGS.bam", emit: bam
// Job script
script:
unique_seed = (params.seed * sample ) % 2147483647 // that's (2^31)-1, the upper bound for mason
"""
mason_simulator \
-ir ${ref} \
-iv ${vcf} \
-o simulated_hap${sample}.NGSWGS.R1.fastq \
-or simulated_hap${sample}.NGSWGS.R2.fastq \
-oa simulated_hap${sample}.NGSWGS.bam \
--seed ${unique_seed} \
--num-threads ${task.cpus} \
--num-fragments ${params.nb_frag} \
--fragment-min-size ${params.fragment_min_size} \
--fragment-max-size ${params.fragment_max_size} \
--fragment-mean-size ${params.fragment_mean_size} \
--fragment-size-std-dev ${params.fragment_size_std_dev} \
--illumina-read-length ${params.illumina_read_length} \
${params.mason_additional_args}
"""
}
```
It gets formatted like:
```nextflow
process MASON_SIMULATOR {
publishDir "${params.outdir}", mode: 'copy', pattern: "*.{NGSWGS.R1.fastq,NGSWGS.R2.fastq,bam}"
conda 'bioconda::mason=2.0.9'
cpus 2
input:
tuple val(sample), path(vcf)
val ref
val ref_idx
output:
path "simulated_hap${sample}.NGSWGS.{R1,R2}.fastq", emit: fastqs
path "simulated_hap${sample}.NGSWGS.bam", emit: bam
script:
unique_seed = (params.seed * sample) % 2147483647
// that's (2^31)-1, the upper bound for mason
"""
mason_simulator \
-ir ${ref} \
-iv ${vcf} \
-o simulated_hap${sample}.NGSWGS.R1.fastq \
-or simulated_hap${sample}.NGSWGS.R2.fastq \
-oa simulated_hap${sample}.NGSWGS.bam \
--seed ${unique_seed} \
--num-threads ${task.cpus} \
--num-fragments ${params.nb_frag} \
--fragment-min-size ${params.fragment_min_size} \
--fragment-max-size ${params.fragment_max_size} \
--fragment-mean-size ${params.fragment_mean_size} \
--fragment-size-std-dev ${params.fragment_size_std_dev} \
--illumina-read-length ${params.illumina_read_length} \
${params.mason_additional_args}
"""
}
```
2 Likes
Thank you both!! I’m very excited to start using the formatter!
1 Like
Many thanks! The it works great with the latest version
1 Like
system
(system)
Closed
December 9, 2024, 11:05pm
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.