Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
db08971
add mbovis reference files
abhi18av Aug 1, 2024
ab2f0f9
add the GBK reference file
abhi18av Aug 2, 2024
456711a
rename the bovis genbank file [ci skip]
abhi18av Aug 2, 2024
a4bcb32
refactor the variant recalibration steps
abhi18av Aug 8, 2024
7e75ec2
disable the SNP recalibration [ci skip]
abhi18av Aug 22, 2024
0e2d743
enable dump channel [ci skip]
abhi18av Aug 22, 2024
4b6c7cd
structure the output channel [ci skip]
abhi18av Aug 22, 2024
467b3d1
remove the requirement for a specific loci [ci skip]
abhi18av Aug 22, 2024
c6fa62d
tweak empty channel [ci skip]
abhi18av Aug 22, 2024
591a8ea
tweak gatk select variants [ci skip]
abhi18av Aug 22, 2024
cbf479c
rename bovis reference [ci skip]
abhi18av Aug 22, 2024
4977ae7
produce an intermediate file in snpeff [ci skip]
abhi18av Aug 23, 2024
9ec4f69
update the output annotated file [ci skip]
abhi18av Aug 23, 2024
9166b2e
fix the snpeff output [ci skip]
abhi18av Aug 23, 2024
79285fc
refactor the snpeff script [ci skip]
abhi18av Aug 23, 2024
c23a772
disable stdout [ci skip]
abhi18av Aug 23, 2024
9783374
tweak the file name [ci skip]
abhi18av Aug 23, 2024
2836b64
tweak the bgzip execution [ci skip]
abhi18av Aug 23, 2024
091bc1f
revert the keep option [ci skip]
abhi18av Aug 23, 2024
e24a4ad
tweak the bash mode [ci skip]
abhi18av Aug 27, 2024
4f865e1
update gitignore
abhi18av Jun 29, 2025
eb38acd
Merge branch 'dev' into feature/mbovis-reference [ci skip]
abhi18av Jun 29, 2025
08dbfc9
update the reference fasta name in tbprofiler processes [ci skip]
abhi18av Jul 1, 2025
934829b
tweak the snpeff command [ci skip]
abhi18av Jul 2, 2025
ef5c079
update the mbovis reference and snpeff container [ci skip]
abhi18av Jul 2, 2025
73ade63
use a trimmed version of modules.json for snpeff modules [ci skip]
abhi18av Jul 2, 2025
dfa46b9
comment out the downloads [ci skip]
abhi18av Jul 2, 2025
dcb595e
source nf-core snpeff [ci skip]
abhi18av Jul 2, 2025
cb448a1
fix import [ci skip]
abhi18av Jul 2, 2025
458d9c7
fix import [ci skip]
abhi18av Jul 2, 2025
5592d1f
iterate [ci skip]
abhi18av Jul 2, 2025
5c587fe
patch nf-core/snpeff [ci skip]
abhi18av Jul 2, 2025
896fa6d
patch snpeff [ci skip]
abhi18av Jul 2, 2025
4e770fb
download database via snpeff [ci skip]
abhi18av Jul 2, 2025
63547e5
add snpeff download [ci skip]
abhi18av Jul 2, 2025
1922b21
patch import [ci skip]
abhi18av Jul 2, 2025
c0af467
enable nf-core/snpeff [ci skip]
abhi18av Jul 2, 2025
67803b4
use snpeff cache [ci skip]
abhi18av Jul 2, 2025
af5f1a6
use downloaded cache [ci skip]
abhi18av Jul 2, 2025
f4e24cf
use different mbovis strain [ci skip]
abhi18av Jul 2, 2025
26360ea
Merge branch 'dev' into feature/mbovis-reference
abhi18av Jul 14, 2025
ba80eb4
fix the merge induced issue [ci skip]
abhi18av Jul 14, 2025
7cae441
update reference [ci skip]
abhi18av Aug 7, 2025
983ced2
ignore snpeff entirely [ci skip]
abhi18av Aug 7, 2025
c9e370f
add mbovis database [ci skip]
abhi18av Sep 16, 2025
39330df
update code [ci skip]
abhi18av Sep 16, 2025
af3fb3a
use the custom database [ci skip]
abhi18av Sep 16, 2025
b436c8e
snpeff is functional now [ci skip]
abhi18av Sep 16, 2025
466b536
dev iteration [ci skip]
abhi18av Oct 28, 2025
f708d3a
interim commit after meeting with Giovanni [ci skip]
abhi18av Oct 29, 2025
ff3de87
dev iteration [ci skip]
abhi18av Dec 2, 2025
606e5e2
restore the SNPEFF output [ci skip]
abhi18av Dec 2, 2025
62f20cb
refactor variant recalibrator [ci skip]
abhi18av Dec 2, 2025
292101e
initialize channels [ci skip]
abhi18av Dec 2, 2025
2019c1c
initialize the remaining channels [ci skip]
abhi18av Dec 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ samplesheet.csv
magma.sh
.Rproj.user

docs/_site
docs/.quarto

.DS_Store
docs/_site
resources/snpeff/data/mbovis_AF2122/snpEffectPredictor.bin
25 changes: 16 additions & 9 deletions bin/rename_vcf_chrom.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def errlog(x,ext=False):
quit(1)

def cmd_out(cmd,verbose=1):
cmd = "set -u pipefail; " + cmd
if verbose==2:
sys.stderr.write("\nRunning command:\n%s\n" % cmd)
stderr = open("/dev/stderr","w")
Expand All @@ -56,19 +55,27 @@ def cmd_out(cmd,verbose=1):

def main(args):
generator = cmd_out("bcftools view " + args.vcf) if args.vcf else sys.stdin
convert = dict(zip(args.source,args.target))
for l in generator:
if l[0]=="#":
sys.stdout.write(l.strip()+"\n")
else:
row = l.strip().split()
row[0] = convert[row[0]]
sys.stdout.write("\t".join(row)+"\n")
convert = dict(zip(args.source, args.target))

# Open the output file for writing, or use stdout if not specified
outfile = open(args.outfile, 'w') if args.outfile else sys.stdout
try:
for l in generator:
if l[0] == "#":
outfile.write(l.strip() + "\n")
else:
row = l.strip().split()
row[0] = convert[row[0]]
outfile.write("\t".join(row) + "\n")
finally:
if args.outfile:
outfile.close()

parser = argparse.ArgumentParser(description='tbprofiler script',formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--vcf',type=str,help='')
parser.add_argument('--source',nargs="+",type=str,help='')
parser.add_argument('--target',nargs="+",type=str,help='')
parser.add_argument('--outfile', type=str, required=False, help='Output VCF file')
parser.set_defaults(func=main)
args = parser.parse_args()
args.func(args)
6 changes: 6 additions & 0 deletions conf/docker.config
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ process {
container = "ghcr.io/torch-consortium/magma/magma-container-2:1.1.1"
}

// withName:
// 'SNPEFF.*' {
// container = "quay.io/biocontainers/snpeff:4.3.1t--2"
// }


}


Expand Down
2 changes: 1 addition & 1 deletion default_params.config
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ GATK_GENOTYPE_GVCFS {
SNPEFF {
results_dir = "${params.outdir}/vcf_files/cohort/raw_variant_files/annotated"

arguments = " -nostats -ud 100 Mycobacterium_tuberculosis_h37rv "
arguments = " -nostats -ud 100 mbovis_AF2122 "

should_publish = true
}
Expand Down
197 changes: 23 additions & 174 deletions modules.json
Original file line number Diff line number Diff line change
@@ -1,177 +1,26 @@
{
"name": "TORCH-consortium/magma",
"homePage": "https://github.com/TORCH-consortium/MAGMA",
"repos": {
"https://github.com/nf-core/modules.git": {
"modules": {
"nf-core": {
"bcftools/merge": {
"branch": "master",
"git_sha": "c9c3ef86c1892413b3c86fb38c4e39fd7288512f",
"installed_by": ["modules"]
},
"bcftools/view": {
"branch": "master",
"git_sha": "c9c3ef86c1892413b3c86fb38c4e39fd7288512f",
"installed_by": ["modules"]
},
"bwa/mem": {
"branch": "master",
"git_sha": "a29f18660f5e3748d44d6f716241e70c942c065d",
"installed_by": ["modules"]
},
"bwamem2/mem": {
"branch": "master",
"git_sha": "a29f18660f5e3748d44d6f716241e70c942c065d",
"installed_by": ["modules"]
},
"delly/call": {
"branch": "master",
"git_sha": "05954dab2ff481bcb999f24455da29a5828af08d",
"installed_by": ["modules"]
},
"fastqc": {
"branch": "master",
"git_sha": "08108058ea36a63f141c25c4e75f9f872a5b2296",
"installed_by": ["modules"]
},
"fastqutils/info": {
"branch": "master",
"git_sha": "92168db7097574f7407062f26e901f2d2fb96135",
"installed_by": ["modules"]
},
"gatk4/applybqsr": {
"branch": "master",
"git_sha": "8a7e6e269f4044d922ce84bbe5717a8c07de8834",
"installed_by": ["modules"]
},
"gatk4/applyvqsr": {
"branch": "master",
"git_sha": "05954dab2ff481bcb999f24455da29a5828af08d",
"installed_by": ["modules"]
},
"gatk4/baserecalibrator": {
"branch": "master",
"git_sha": "f63c350bc9dc0b0a934d14d3a85298002c15adc1",
"installed_by": ["modules"]
},
"gatk4/combinegvcfs": {
"branch": "master",
"git_sha": "05954dab2ff481bcb999f24455da29a5828af08d",
"installed_by": ["modules"]
},
"gatk4/genotypegvcfs": {
"branch": "master",
"git_sha": "81880787133db07d9b4c1febd152c090eb8325dc",
"installed_by": ["modules"]
},
"gatk4/haplotypecaller": {
"branch": "master",
"git_sha": "05954dab2ff481bcb999f24455da29a5828af08d",
"installed_by": ["modules"]
},
"gatk4/indexfeaturefile": {
"branch": "master",
"git_sha": "05954dab2ff481bcb999f24455da29a5828af08d",
"installed_by": ["modules"]
},
"gatk4/markduplicates": {
"branch": "master",
"git_sha": "1ec937ab3edc307bc0d79a2200d784e9f0868359",
"installed_by": ["modules"]
},
"gatk4/mergevcfs": {
"branch": "master",
"git_sha": "05954dab2ff481bcb999f24455da29a5828af08d",
"installed_by": ["modules"]
},
"gatk4/selectvariants": {
"branch": "master",
"git_sha": "05954dab2ff481bcb999f24455da29a5828af08d",
"installed_by": ["modules"]
},
"gatk4/variantrecalibrator": {
"branch": "master",
"git_sha": "81880787133db07d9b4c1febd152c090eb8325dc",
"installed_by": ["modules"]
},
"gatk4/variantstotable": {
"branch": "master",
"git_sha": "05954dab2ff481bcb999f24455da29a5828af08d",
"installed_by": ["modules"]
},
"iqtree": {
"branch": "master",
"git_sha": "2ae11ef01a83c7330c09d08d14d21ff445e32141",
"installed_by": ["modules"]
},
"ismapper": {
"branch": "master",
"git_sha": "81880787133db07d9b4c1febd152c090eb8325dc",
"installed_by": ["modules"]
},
"lofreq/call": {
"branch": "master",
"git_sha": "81880787133db07d9b4c1febd152c090eb8325dc",
"installed_by": ["modules"]
},
"lofreq/filter": {
"branch": "master",
"git_sha": "05954dab2ff481bcb999f24455da29a5828af08d",
"installed_by": ["modules"]
},
"lofreq/indelqual": {
"branch": "master",
"git_sha": "05954dab2ff481bcb999f24455da29a5828af08d",
"installed_by": ["modules"]
},
"multiqc": {
"branch": "master",
"git_sha": "f0719ae309075ae4a291533883847c3f7c441dad",
"installed_by": ["modules"]
},
"samtools/index": {
"branch": "master",
"git_sha": "d090922b1a4b80ba283186459ababf8e308abcbb",
"installed_by": ["modules"]
},
"samtools/merge": {
"branch": "master",
"git_sha": "d090922b1a4b80ba283186459ababf8e308abcbb",
"installed_by": ["modules"]
},
"samtools/stats": {
"branch": "master",
"git_sha": "05954dab2ff481bcb999f24455da29a5828af08d",
"installed_by": ["modules"]
},
"snpdists": {
"branch": "master",
"git_sha": "81880787133db07d9b4c1febd152c090eb8325dc",
"installed_by": ["modules"]
},
"snpeff/download": {
"branch": "master",
"git_sha": "81880787133db07d9b4c1febd152c090eb8325dc",
"installed_by": ["modules"]
},
"snpeff/snpeff": {
"branch": "master",
"git_sha": "05954dab2ff481bcb999f24455da29a5828af08d",
"installed_by": ["modules"]
},
"snpsites": {
"branch": "master",
"git_sha": "05954dab2ff481bcb999f24455da29a5828af08d",
"installed_by": ["modules"]
},
"tbprofiler/profile": {
"branch": "master",
"git_sha": "81880787133db07d9b4c1febd152c090eb8325dc",
"installed_by": ["modules"]
}
"name": "TORCH-consortium/magma",
"homePage": "https://github.com/TORCH-consortium/MAGMA",
"repos": {
"https://github.com/nf-core/modules.git": {
"modules": {
"nf-core": {
"snpeff/download": {
"branch": "master",
"git_sha": "81880787133db07d9b4c1febd152c090eb8325dc",
"installed_by": [
"modules"
]
},
"snpeff/snpeff": {
"branch": "master",
"git_sha": "05954dab2ff481bcb999f24455da29a5828af08d",
"installed_by": [
"modules"
]
}
}
}
}
}
}
}
}
}
26 changes: 5 additions & 21 deletions modules/local/gatk/variant_recalibrator.nf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ process GATK_VARIANT_RECALIBRATOR {
tag "annotation: ${annotations}"
publishDir params.results_dir, mode: params.save_mode, enabled: params.should_publish


input:
val(analysisMode)
val(annotations)
Expand All @@ -47,16 +46,11 @@ process GATK_VARIANT_RECALIBRATOR {
tuple val(joint_name), path("*${analysisMode}*.command.log"), emit: annotationsLog

script:

def finalResourceFilesArg = (resourceFilesArg ? "--resource:${resourceFilesArg}" : "")

def optionalAnnotationPrefix = ""

if (task.process.split("__").length == 1) {
optionalAnnotationPrefix = ""
} else {
optionalAnnotationPrefix = ".${task.process.split("__")[-1]}"
}
// Only add --resource argument if resourceFiles and resourceFileIndexes are non-empty
def resourceFilesExist = resourceFiles && resourceFiles.size() > 0
def resourceFileIndexesExist = resourceFileIndexes && resourceFileIndexes.size() > 0
def finalResourceFilesArg = (resourceFilesArg && resourceFilesExist && resourceFileIndexesExist) ? "--resource:${resourceFilesArg}" : ""
def optionalAnnotationPrefix = (task.process.split("__").length == 1) ? "" : ".${task.process.split('__')[-1]}"

"""
${params.gatk_path} VariantRecalibrator --java-options "-Xmx${task.memory.giga}G" \\
Expand All @@ -73,15 +67,5 @@ process GATK_VARIANT_RECALIBRATOR {
2>${joint_name}.${analysisMode}${optionalAnnotationPrefix}.command.log

cp ${joint_name}.${analysisMode}${optionalAnnotationPrefix}.command.log .command.log

"""

stub:

"""
touch ${joint_name}.${analysisMode}.tranches
touch ${joint_name}.${analysisMode}.R
touch ${joint_name}.${analysisMode}.recal.vcf.gz
touch ${joint_name}.${analysisMode}.mod
"""
}
10 changes: 7 additions & 3 deletions modules/local/snpeff/snpeff.nf
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ process SNPEFF {
input:
tuple val(joint_name), path(rawJointVariantsFile)
path(ref_fasta)
path(snpeff_config)
path(snpeff_db)

output:
tuple val(joint_name), path("*.annotated.vcf")
Expand All @@ -38,9 +40,11 @@ process SNPEFF {
shell:

'''
rename_vcf_chrom.py --vcf !{rawJointVariantsFile} --source !{params.ref_fasta_basename} --target 'Chromosome' \
| !{params.snpeff_path} -nostats !{params.arguments} \
| rename_vcf_chrom.py --target !{params.ref_fasta_basename} --source 'Chromosome' \
snpEff build -c complete_snpeff.config -gff3 -v mbovis_AF2122

rename_vcf_chrom.py --vcf !{rawJointVariantsFile} --source !{params.ref_fasta_basename} --target 'Chromosome' \\
| !{params.snpeff_path} -nostats -c !{snpeff_config} !{params.arguments} \\
| rename_vcf_chrom.py --target !{params.ref_fasta_basename} --source 'Chromosome' \\
> !{joint_name}.raw_variants.annotated.vcf
'''

Expand Down
4 changes: 2 additions & 2 deletions modules/local/tbprofiler/vcf_profile__cohort.nf
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ process TBPROFILER_VCF_PROFILE__COHORT {

"""

bcftools view ${mergedVcf} | sed 's/NC-000962-3-H37Rv/Chromosome/g' > intermediate.vcf
bcftools view ${mergedVcf} | sed 's/${params.ref_fasta_basename}/Chromosome/g' > intermediate.vcf

cat intermediate.vcf | bcftools view -Oz -o intermediate.vcf.gz

${params.tbprofiler_path} profile \\
Expand Down
4 changes: 2 additions & 2 deletions modules/local/tbprofiler/vcf_profile__lofreq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ process TBPROFILER_VCF_PROFILE__LOFREQ {

"""

bcftools view ${mergedLofreqVcf} | sed 's/NC-000962-3-H37Rv/Chromosome/g' > intermediate.vcf
bcftools view ${mergedLofreqVcf} | sed 's/${params.ref_fasta_basename}/Chromosome/g' > intermediate.vcf

cat intermediate.vcf | bcftools view -Oz -o intermediate.vcf.gz

${params.tbprofiler_path} profile \\
Expand Down
13 changes: 0 additions & 13 deletions modules/nf-core/bwa/mem/environment.yml

This file was deleted.

Loading