Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix wfmash v0.12.6 parameters and other bugs #183

Merged
merged 4 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
strategy:
matrix:
parameters:
- '--vcf_spec "gi|568815561:#,gi|568815567:#"'
- '--vcf_spec "gi|568815561:5,gi|568815567:25"'
steps:
- name: Check out pipeline code
uses: actions/checkout@v3
Expand Down Expand Up @@ -164,7 +164,7 @@ jobs:
parameters:
- "--communities"
- "--communities --wfmash_chunks 2"
- '--communities --vcf_spec "gi|568815561:#,gi|568815567:#"'
- '--communities --vcf_spec "gi|568815561:5,gi|568815567:25"'
steps:
- name: Check out pipeline code
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion conf/hla.config
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ process {
}

withName:'SMOOTHXG' {
cpus = 4
cpus = 8
memory = 8.GB
// container = "ghcr.io/pangenome/pggb:20230331171956507fc0"
}
Expand Down
12 changes: 8 additions & 4 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ process {
withName: WFMASH_MAP_ALIGN {
ext.args = {
[
"-n ${params.n_haplotypes - 1}",
"-n ${params.wfmash_n_mappings}",
"-s ${parse_int(params.wfmash_segment_length)}",
"-p ${params.wfmash_map_pct_id}",
params.wfmash_merge_segments ? "-M" : "",
Expand All @@ -114,6 +114,7 @@ process {
"${wfmash_sparse_map_cmd}",
params.wfmash_temp_dir ? "-B ${wfmash_temp_dir}" : "",
"-2 ${params.wfmash_hg_filter_ani_diff}",
"--lower-triangular",
].join(" ").trim()
}
publishDir = [
Expand All @@ -126,7 +127,7 @@ process {
withName: WFMASH_MAP {
ext.args = {
[
"-n ${params.n_haplotypes - 1}",
"-n ${params.wfmash_n_mappings}",
"-s ${parse_int(params.wfmash_segment_length)}",
"-p ${params.wfmash_map_pct_id}",
params.wfmash_merge_segments ? "-M" : "",
Expand All @@ -139,6 +140,7 @@ process {
params.wfmash_temp_dir ? "-B ${wfmash_temp_dir}" : "",
"-m",
"-2 ${params.wfmash_hg_filter_ani_diff}",
"--lower-triangular",
].join(" ").trim()
}
publishDir = [
Expand All @@ -151,7 +153,7 @@ process {
withName: WFMASH_MAP_COMMUNITY {
ext.args = {
[
"-n ${params.n_haplotypes - 1}",
"-n ${params.wfmash_n_mappings}",
"-s ${parse_int(params.wfmash_segment_length)}",
"-p ${params.wfmash_map_pct_id}",
params.wfmash_merge_segments ? "-M" : "",
Expand All @@ -164,6 +166,7 @@ process {
params.wfmash_temp_dir ? "-B ${wfmash_temp_dir}" : "",
"-m",
"-2 ${params.wfmash_hg_filter_ani_diff}",
"--lower-triangular",
].join(" ").trim()
}
publishDir = [
Expand All @@ -185,7 +188,7 @@ process {
withName: WFMASH_ALIGN {
ext.args = {
[
"-n ${params.n_haplotypes - 1}",
"-n ${params.wfmash_n_mappings}",
"-s ${parse_int(params.wfmash_segment_length)}",
"-p ${params.wfmash_map_pct_id}",
params.wfmash_merge_segments ? "-M" : "",
Expand All @@ -198,6 +201,7 @@ process {
params.wfmash_temp_dir ? "-B ${wfmash_temp_dir}" : "",
"--invert-filtering",
"-2 ${params.wfmash_hg_filter_ani_diff}",
"--lower-triangular",
].join(" ").trim()
}
publishDir = [
Expand Down
14 changes: 9 additions & 5 deletions modules/local/vg_deconstruct/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ process VG_DECONSTRUCT {
'https://depot.galaxyproject.org/singularity/pggb:0.5.3--hdfd78af_2':
'quay.io/biocontainers/pggb:0.5.3--hdfd78af_2' }"
*/
container "ghcr.io/pangenome/pggb:20230819064109936a2c"
container "ghcr.io/pangenome/pggb:202402032147026ffe7f"

input:
tuple val(meta), path(graph), val(vcf_spec)
Expand All @@ -47,16 +47,20 @@ process VG_DECONSTRUCT {
def prefix = task.ext.prefix ?: "${meta.id}"
"""
ref=\$(echo "$vcf_spec" | cut -f 1 -d:)
delim=\$(echo "$vcf_spec" | cut -f 2 -d:)
pop_length=\$(echo "$vcf_spec" | cut -f 3 -d:)
if [[ "$vcf_spec" == *":"* ]]; then
pop_length=\$(echo "$vcf_spec" | cut -f 2 -d:)
else
pop_length=""
fi

if [[ -z \$pop_length ]]; then
pop_length=0
fi

vcf="${graph}".\$(echo \$ref | tr '/|' '_').vcf
vg deconstruct -P \$ref -H \$delim -e -a -t "${task.cpus}" "${graph}" > \$vcf
vg deconstruct -P \$ref -H "#" -e -a -t "${task.cpus}" "${graph}" > \$vcf
bcftools stats \$vcf > \$vcf.stats

if [[ \$pop_length -gt 0 ]]; then
vcf_decomposed=${graph}.final.\$(echo \$ref | tr '/|' '_').decomposed.vcf
vcf_decomposed_tmp=\$vcf_decomposed.tmp.vcf
Expand All @@ -65,7 +69,7 @@ process VG_DECONSTRUCT {
#TODO: to remove when vcfwave will be bug-free
# The TYPE info sometimes is wrong/missing
# There are variants without the ALT allele
bcftools sort \$vcf_decomposed_tmp | bcftools annotate -x INFO/TYPE \$vcf_decomposed_tmp | awk '\$5 != "."' > \$vcf_decomposed
bcftools sort \$vcf_decomposed_tmp | bcftools annotate -x INFO/TYPE | awk '\$5 != "."' > \$vcf_decomposed
rm \$vcf_decomposed_tmp \$vcf.gz
bcftools stats \$vcf_decomposed > \$vcf_decomposed.stats
fi
Expand Down
1 change: 1 addition & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ params {
wfmash_only = false
wfmash_temp_dir = null
wfmash_hg_filter_ani_diff = 30
wfmash_n_mappings = 1

// Seqwish options
seqwish_paf = null
Expand Down
5 changes: 5 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@
"type": "integer",
"default": 30,
"description": "Filter out mappings unlikely to be this Average Nucleotide Identity (ANI) less than the best mapping."
},
"wfmash_n_mappings": {
"type": "integer",
"default": 1,
"description": "Number of mappings for each segment."
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion workflows/pangenome.nf
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ workflow PANGENOME {
ch_multiqc_files = ch_multiqc_files.mix(ch_collated_versions)
if (!params.communities) {
if (!params.wfmash_only) {
ch_multiqc_files = ch_multiqc_files.mix(PGGB.out.qc.map{return it[1..8]})
ch_multiqc_files = ch_multiqc_files.mix(PGGB.out.qc.map{return it[1..9]})
}
} else {
ch_multiqc_files = ch_multiqc_files.mix(ODGI_QC.out.qc.map{return it[1..8]})
Expand Down
Loading