Skip to content

Commit

Permalink
🔀 Merge pull request #13 from bunop/issue-8
Browse files Browse the repository at this point in the history
➕ add est-sfs custom module dependency
  • Loading branch information
bunop authored Feb 26, 2024
2 parents 638efb1 + 1813128 commit f4c267a
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 22 deletions.
Binary file removed tskit-pipeline/bin/est-sfs
Binary file not shown.
8 changes: 8 additions & 0 deletions tskit-pipeline/conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ process {
]
}

withName: "GENERATE_SEED" {
publishDir = [
path: { "${params.outdir}/estsfs" },
mode: params.publish_dir_mode,
pattern: 'seedfile.txt'
]
}

withName: "TSINFER" {
ext.args = { "--mutation_rate ${params.tsdate_mutation_rate} --ne ${params.tsdate_ne}" }
}
Expand Down
16 changes: 11 additions & 5 deletions tskit-pipeline/modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
"name": "tskit-pipeline",
"homePage": "https://github.com/bunop/TSKITetude",
"repos": {
"https://github.com/cnr-ibba/nf-modules.git": {
"modules": {
"cnr-ibba": {
"estsfs": {
"branch": "master",
"git_sha": "e9a3d75c0a0eb9743eeb791802f9a6876c155122",
"installed_by": ["modules"]
}
}
}
},
"https://github.com/nf-core/modules.git": {
"modules": {
"nf-core": {
Expand Down Expand Up @@ -35,11 +46,6 @@
"git_sha": "8ec825f465b9c17f9d83000022995b4f7de6fe93",
"installed_by": ["modules"]
},
"estsfs": {
"branch": "master",
"git_sha": "9678944d908e5aedab318c94a79d6ecbfa854fbc",
"installed_by": ["modules"]
},
"plink/recode": {
"branch": "master",
"git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ process ESTSFS {
label 'process_long'

// WARN: Version information not provided by tool on CLI. Please update version string below when bumping container versions.
container "docker.io/bunop/est-sfs:2.0.5"

input:
tuple val(meta), path(e_config), path(data)
tuple val(meta), path(e_config), path(data), path(seed)

output:
tuple val(meta), path("${prefix}_sfs.txt") , emit: sfs_out
tuple val(meta), path("${prefix}_pvalues.txt"), emit: pvalues_out
tuple val(meta), path("${prefix}.seed"), emit: seed
tuple val(meta), path("${prefix}_sfs.txt") , emit: sfs_out
tuple val(meta), path("${prefix}_pvalues.txt") , emit: pvalues_out
tuple val(meta), path("${prefix}.seed") , emit: seed
path "versions.yml", emit: versions

when:
Expand All @@ -22,6 +23,7 @@ process ESTSFS {
def VERSION = '2.05' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
prefix = task.ext.prefix ?: "${meta.id}"
"""
cp ${seed} ${prefix}.seed
est-sfs ${e_config} ${data} ${prefix}.seed ${prefix}_sfs.txt ${prefix}_pvalues.txt
cat <<-END_VERSIONS > versions.yml
Expand Down
3 changes: 1 addition & 2 deletions tskit-pipeline/modules/local/tsinfer.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ process TSINFER {
"--volume ${HOME}/.cache/tsdate/:/.cache/tsdate/" }"""

input:
tuple val(meta), path(vcf)
tuple val(meta2), path(ancestral)
tuple val(meta), path(vcf), path(ancestral)
path(sample_file)

output:
Expand Down
7 changes: 0 additions & 7 deletions tskit-pipeline/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,14 @@ profiles {
cleanup = false
nextflow.enable.configProcessNamesValidation = true
}
conda {
conda.enabled = true
docker.enabled = false
singularity.enabled = false
}
docker {
docker.enabled = true
conda.enabled = false
singularity.enabled = false
docker.runOptions = '-u $(id -u):$(id -g)'
}
singularity {
singularity.enabled = true
singularity.autoMounts = true
conda.enabled = false
docker.enabled = false
}
test { includeConfig 'conf/test.config' }
Expand Down
36 changes: 32 additions & 4 deletions tskit-pipeline/workflows/tskit.nf
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ include {
TABIX_TABIX as ANCIENT_SPLIT_TABIX } from '../modules/nf-core/tabix/tabix/main'
include { BCFTOOLS_MERGE } from '../modules/nf-core/bcftools/merge/main'
include { ESTSFS_INPUT } from '../modules/local/estsfs_input'
include { ESTSFS } from '../modules/nf-core/estsfs/main'
include { ESTSFS } from '../modules/cnr-ibba/estsfs/main'
include { ESTSFS_OUTPUT } from '../modules/local/estsfs_output'
include { TSINFER } from '../modules/local/tsinfer'
include { CUSTOM_DUMPSOFTWAREVERSIONS } from '../modules/nf-core/custom/dumpsoftwareversions/main'
Expand All @@ -89,6 +89,16 @@ include { CUSTOM_DUMPSOFTWAREVERSIONS } from '../modules/nf-core/custom/du
def multiqc_report = []


process GENERATE_SEED {
output:
path 'seedfile.txt'

'''
echo $RANDOM > seedfile.txt
'''
}


workflow TSKIT {
ch_versions = Channel.empty()

Expand Down Expand Up @@ -249,17 +259,35 @@ workflow TSKIT {
outgroup_files_ch.collect()
)

// determine a seedfile
seedfile = GENERATE_SEED()

// call custom est-sfs
ESTSFS(
ESTSFS_INPUT.out.config.join(ESTSFS_INPUT.out.input)
ESTSFS_INPUT.out.config
.join(ESTSFS_INPUT.out.input)
.combine(seedfile)
)
ch_versions = ch_versions.mix(ESTSFS.out.versions)

ESTSFS_OUTPUT(ESTSFS_INPUT.out.mapping.join(ESTSFS.out.pvalues_out))

tsinfer_in_ch = BCFTOOLS_REHEADER.out.vcf
.map{ meta, vcf -> [meta.chrom, meta, vcf] }
.join(
ESTSFS_OUTPUT.out.ancestral
.map{ meta, ancestral ->
chrom = ancestral.name.tokenize(".")[-3]
[chrom, ancestral]
},
by: [0],
failOnMismatch: true
).map{ chrom, meta, vcf, ancestral -> [[id: meta.id], vcf, ancestral]}
// .view()

// now create a tstree file
TSINFER(
BCFTOOLS_REHEADER.out.vcf,
ESTSFS_OUTPUT.out.ancestral,
tsinfer_in_ch,
samples_ch.first()
)

Expand Down

0 comments on commit f4c267a

Please sign in to comment.