From 7c96d19378d85a2c45f284473ca5eea09989d3fa Mon Sep 17 00:00:00 2001 From: maxozo Date: Tue, 10 Oct 2023 11:46:33 +0100 Subject: [PATCH] account for chr prefix --- modules/nf-core/modules/genotypes/main.nf | 9 +++++++++ modules/nf-core/modules/subset_genotype/main.nf | 1 + 2 files changed, 10 insertions(+) diff --git a/modules/nf-core/modules/genotypes/main.nf b/modules/nf-core/modules/genotypes/main.nf index 5a152aa6..f9302cdb 100755 --- a/modules/nf-core/modules/genotypes/main.nf +++ b/modules/nf-core/modules/genotypes/main.nf @@ -265,6 +265,15 @@ process GT_MATCH_POOL_AGAINST_PANEL panel_filnam = "${ref_gt_vcf}" - (~/\.[bv]cf(\.gz)?$/) gt_check_output_txt = "${pool_id}_gtcheck_${panel_filnam}.txt" """ + STR=\$(bcftools index -s ${ref_gt_vcf} | cut -f1 | head -n1) + SUB='chr' + if [[ "\$STR" == *"\$SUB"* ]]; then + echo -e "1 chr1\\n2 chr2\\n3 chr3\\n4 chr4\\n5 chr5\\n6 chr6\\n7 chr7\\n8 chr8\\n9 chr9\\n10 chr10\\n11 chr11\\n12 chr12\\n13 chr13\\n14 chr14\\n15 chr15\\n16 chr16\\n17 chr17\\n18 chr18\\n19 chr19\\n20 chr20\\n21 chr21\\n22 chr22\\n23 chr23" >> chr_name2_conv.txt + bcftools annotate --rename-chrs chr_name2_conv.txt ${vireo_gt_vcf} -Oz -o renamed.vcf.gz + else + ls -s ${vireo_gt_vcf} renamed.vcf.gz + fi + bcftools gtcheck --no-HWE-prob -g ${ref_gt_vcf} ${vireo_gt_vcf} > ${gt_check_output_txt} """ } diff --git a/modules/nf-core/modules/subset_genotype/main.nf b/modules/nf-core/modules/subset_genotype/main.nf index 2585a8b2..95846da2 100755 --- a/modules/nf-core/modules/subset_genotype/main.nf +++ b/modules/nf-core/modules/subset_genotype/main.nf @@ -363,6 +363,7 @@ workflow SUBSET_WORKF{ // all_GT_pannels_and_pools.subscribe {println "all_GT_pannels_and_pools:= ${it}\n"} // If nothing is provided then there are no genotypes emmited, hence nothing is passed down to the chromosome merge. combined_pool_subset.groupTuple(by: 0).set{grouped_chrs_poolComps} + grouped_chrs_poolComps.subscribe {println "grouped_chrs_poolComps:= ${it}\n"} if (!params.genotype_input.subset_vireo_genotypes && mode=='AllExpectedGT'){ // Here we have joned the shards of the same cohort together without subsetting down to the individuals since we want to use all the genotypes as an input file in the vcf. // While this will work, if the same cohort is used multiple times its better to provide already merged genotype, to avoid all the shard processing every time.