Skip to content

Commit

Permalink
fix to match nf-core updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Smith Nicholas committed Jan 14, 2022
1 parent 8cb7490 commit 1e5034e
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ results/
testing/
testing*
*.pyc
*.swp
18 changes: 8 additions & 10 deletions bin/concatenateVCFs.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail

# This script concatenates all VCF files that are in the local directory,
# that were created from different intervals to make a single final VCF

Expand Down Expand Up @@ -49,8 +48,8 @@ if [ -z ${noInt+x} ]
then
# First make a header from one of the VCF
# Remove interval information from the GATK command-line, but leave the rest
FIRSTVCF=$(set +o pipefail; ls *.vcf | head -n 1)
sed -n '/^[^#]/q;p' $FIRSTVCF | \
FIRSTVCF=$(set +o pipefail; ls *.vcf.gz | head -n 1)
sed -n '/^[^#]/q;p' <(zcat $FIRSTVCF) | \
awk '!/GATKCommandLine/{print}/GATKCommandLine/{for(i=1;i<=NF;i++){if($i!~/intervals=/ && $i !~ /out=/){printf("%s ",$i)}}printf("\n")}' \
> header

Expand All @@ -65,9 +64,9 @@ then

for chr in "${CONTIGS[@]}"; do
# Skip if globbing would not match any file to avoid errors such as
# "ls: cannot access chr3_*.vcf: No such file or directory" when chr3
# "ls: cannot access chr3_*.vcf.gz: No such file or directory" when chr3
# was not processed.
pattern="${chr}_*.vcf"
pattern="*_${chr}_*.vcf.gz"
if ! compgen -G "${pattern}" > /dev/null; then continue; fi

# ls -v sorts by numeric value ("version"), which means that chr1_100_
Expand All @@ -76,20 +75,19 @@ then
# Determine length of header.
# The 'q' command makes sed exit when it sees the first non-header
# line, which avoids reading in the entire file.
L=$(sed -n '/^[^#]/q;p' ${vcf} | wc -l)
L=$(sed -n '/^[^#]/q;p' <(zcat ${vcf}) | wc -l)

# Then print all non-header lines. Since tail is very fast (nearly as
# fast as cat), this is way more efficient than using a single sed,
# awk or grep command.
tail -n +$((L+1)) ${vcf}
tail -n +$((L+1)) <(zcat ${vcf})
done
done
) | bgzip -@${cpus} > rawcalls.vcf.gz
tabix rawcalls.vcf.gz
else
VCF=$(ls no_intervals*.vcf)
cp $VCF rawcalls.vcf
bgzip -@${cpus} rawcalls.vcf
VCF=$(ls no_intervals*.vcf.gz)
mv -v $VCF rawcalls.vcf.gz
tabix rawcalls.vcf.gz
fi

Expand Down
2 changes: 1 addition & 1 deletion conf/base.config
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ process {
time = { check_max( 4.h * task.attempt, 'time' ) }
shell = ['/bin/bash', '-euo', 'pipefail']

errorStrategy = { task.exitStatus in [143,137,104,134,139, 247] ? 'retry' : 'finish' }
errorStrategy = { task.exitStatus in [143,137,104,134,139,140,247] ? 'retry' : 'finish' }
maxRetries = 1
maxErrors = '-1'

Expand Down
6 changes: 0 additions & 6 deletions lib/WorkflowMain.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ class WorkflowMain {

// Check AWS batch settings
NfcoreTemplate.awsBatch(workflow, params)

// Check input has been provided
if (!params.input) {
log.error "Please provide an input samplesheet to the pipeline e.g. '--input samplesheet.csv'"
System.exit(1)
}
}

//
Expand Down
2 changes: 1 addition & 1 deletion modules/nf-core/modules/samtools/merge/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions subworkflows/local/germline_variant_calling.nf
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,13 @@ workflow GERMLINE_VARIANT_CALLING {
haplotypecaller_gvcf = CONCAT_GVCF.out.vcf

// include interval name into meta.id
HAPLOTYPECALLER.out.interval_vcf.map{ meta, vcf, intervals ->
haplotypecaller_gvcf.combine(intervals).map{ meta, vcf, vcf_index, intervals ->
new_meta = meta.clone()
new_meta.id = meta.sample + "_" + intervals.baseName
[new_meta, vcf, intervals]
[new_meta, vcf, vcf_index, intervals]
}.set{haplotypecaller_interval_vcf}


// STEP GATK HAPLOTYPECALLER.2
GENOTYPEGVCF(
haplotypecaller_interval_vcf,
Expand Down

0 comments on commit 1e5034e

Please sign in to comment.