diff --git a/Dockerfile b/Dockerfile index f68f933..1f88de2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,3 +38,7 @@ RUN jbang export portable -O=PatternSearch.jar PatternSearch.java COPY ./bin/MutservePerformance.java ./ RUN jbang export portable -O=MutservePerformance.jar MutservePerformance.java + +WORKDIR "/opt" +ENV GENOMIC_UTILS_VERSION="v0.3.7" +RUN wget https://github.com/genepi/genomic-utils/releases/download/${GENOMIC_UTILS_VERSION}/genomic-utils.jar \ No newline at end of file diff --git a/modules/local/call_variants_mutserve.nf b/modules/local/call_variants_mutserve.nf index 227ffcf..71104d2 100644 --- a/modules/local/call_variants_mutserve.nf +++ b/modules/local/call_variants_mutserve.nf @@ -1,20 +1,20 @@ process CALL_VARIANTS_MUTSERVE { - publishDir "${params.outdir}/mutserve", mode: "copy" + //publishDir "${params.outdir}/mutserve", mode: "copy" input: - path bamFiles + path bam_file path ref_fasta val(contig) output: - path "${params.project}.txt", emit: variants_ch - path "${params.project}_raw.txt", emit: variants_raw_ch + path "${bam_file.simpleName}.txt", emit: variants_ch + path "${bam_file.simpleName}_raw.txt", emit: variants_raw_ch script: def avail_mem = 1024 if (!task.memory) { - log.info 'Available memory not known - defaulting to 1GB. Specify process memory requirements to change this.' + //log.info 'Available memory not known - defaulting to 1GB. Specify process memory requirements to change this.' } else { avail_mem = (task.memory.mega*0.8).intValue() } @@ -22,15 +22,15 @@ process CALL_VARIANTS_MUTSERVE { """ java -Xmx${avail_mem}M -jar /opt/mutserve/mutserve.jar \ call \ - --output ${params.project}.vcf \ - --write-raw --reference ${ref_fasta} \ + --output ${bam_file.simpleName}.txt \ + --write-raw \ + --reference ${ref_fasta} \ --level ${params.mutserve_detection_limit} \ --deletions \ --baseQ ${params.mutserve_baseQ} \ --mapQ ${params.mutserve_mapQ} \ --alignQ ${params.mutserve_alignQ} \ --contig-name ${contig} \ - --threads ${task.cpus} \ --no-ansi \$PWD """ } diff --git a/modules/local/detect_type.nf b/modules/local/detect_type.nf index 19665e4..13a005c 100644 --- a/modules/local/detect_type.nf +++ b/modules/local/detect_type.nf @@ -1,5 +1,5 @@ process DETECT_TYPE { - publishDir "${params.outdir}/pattern", mode: "copy", pattern: '*pattern.txt' + //publishDir "${params.outdir}/pattern", mode: "copy", pattern: '*pattern.txt' input: path bamFile path lpaRegion diff --git a/modules/local/merge_variants_mutserve.nf b/modules/local/merge_variants_mutserve.nf new file mode 100644 index 0000000..560a106 --- /dev/null +++ b/modules/local/merge_variants_mutserve.nf @@ -0,0 +1,27 @@ +process MERGE_VARIANTS_MUTSERVE { + + publishDir "${params.outdir}/variant_calling", mode: "copy" + + input: + path variants + path variants_raw + + output: + path "${params.project}.txt.gz" + path "${params.project}_raw.txt.gz" + """ + java -jar /opt/genomic-utils.jar csv-concat \ + --separator '\t' \ + --output-sep '\t' \ + --gz \ + --output ${params.project}.txt.gz \ + ${variants} + + java -jar /opt/genomic-utils.jar csv-concat \ + --separator '\t' \ + --output-sep '\t' \ + --gz \ + --output ${params.project}_raw.txt.gz \ + ${variants_raw} + """ +} diff --git a/workflows/vntr-calling.nf b/workflows/vntr-calling.nf index aa8a64d..0ca549d 100644 --- a/workflows/vntr-calling.nf +++ b/workflows/vntr-calling.nf @@ -27,6 +27,7 @@ include { EXTRACT_READS } from '../modules/local/extract_reads' addPara include { BAM_TO_FASTQ } from '../modules/local/bam_to_fastq' addParams(outdir: "$outdir") include { REALIGN_FASTQ } from '../modules/local/realign_fastq' addParams(outdir: "$outdir") include { CALL_VARIANTS_MUTSERVE} from '../modules/local/call_variants_mutserve' addParams(outdir: "$outdir") +include { MERGE_VARIANTS_MUTSERVE} from '../modules/local/merge_variants_mutserve' addParams(outdir: "$outdir") include { CALCULATE_PERFORMANCE } from '../modules/local/calculate_performance' addParams(outdir: "$outdir") @@ -54,8 +55,9 @@ workflow VNTR_CALLING { EXTRACT_READS ( bam_bed_tuple ) BAM_TO_FASTQ ( EXTRACT_READS.out.extracted_bams_ch ) REALIGN_FASTQ ( BAM_TO_FASTQ.out.fastq_ch,ref_fasta,BUILD_BWA_INDEX.out.bwa_index_ch ) - CALL_VARIANTS_MUTSERVE ( REALIGN_FASTQ.out.realigned_ch.collect(),ref_fasta, contig ) - + CALL_VARIANTS_MUTSERVE ( REALIGN_FASTQ.out.realigned_ch,ref_fasta, contig ) + MERGE_VARIANTS_MUTSERVE ( CALL_VARIANTS_MUTSERVE.out.variants_ch.collect(), CALL_VARIANTS_MUTSERVE.out.variants_raw_ch.collect()) + if(params.gold != null) { gold_standard = file(params.gold, checkIfExists: true) CALCULATE_PERFORMANCE ( CALL_VARIANTS_MUTSERVE.out.variants_ch,gold_standard )