Skip to content

Commit

Permalink
split alleles before merge_duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
glennhickey committed Dec 9, 2024
1 parent 9111187 commit 0b533c0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/cactus/refmap/cactus_graphmap_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,17 +1130,21 @@ def vcfwave(job, config, out_name, vcf_ref, vcf_id, tbi_id, max_ref_allele, fast
['bcftools', 'annotate', '-x', 'INFO/AT'],
['vcfwave'] + wave_opts.split(' ') + ['-t', str(job.cores)]]
run_norm = getOptionalAttrib(findRequiredNode(config.xmlRoot, "graphmap_join"), "vcfwaveNorm", typeFn=bool, default=True)
merge_duplicates_opts = getOptionalAttrib(findRequiredNode(config.xmlRoot, "graphmap_join"), "mergeDuplicatesOptions", typeFn=str, default=None)
run_merge = merge_duplicates_opts is not None and merge_duplicates_opts != "0" and run_norm
if run_norm:
fa_ref_path = os.path.join(work_dir, tag + 'fa.gz')
job.fileStore.readGlobalFile(fasta_ref_dict[vcf_ref], fa_ref_path)
bubwave_cmd.append(['bcftools', 'norm', '-f', fa_ref_path])
bubwave_cmd.append(['bcftools', 'sort', '-T', os.path.join(work_dir, 'bcftools.XXXXXX')])
if run_merge:
#merge_duplicates.py want biallelic
bubwave_cmd.append(['bcftools', 'norm', '-m', '-any'])
bubwave_cmd.append(['bgzip'])

cactus_call(parameters=bubwave_cmd, outfile=vcfwave_path)

merge_duplicates_opts = getOptionalAttrib(findRequiredNode(config.xmlRoot, "graphmap_join"), "mergeDuplicatesOptions", typeFn=str, default=None)
if merge_duplicates_opts and merge_duplicates_opts != "0" and run_norm:
if run_merge:
#note: merge_duplcates complains about not having a .tbi but I don't think it actually affects anything
merge_path = os.path.join(work_dir, os.path.basename(out_name) + '.' + vcf_ref + tag + 'wave.merge.vcf.gz')
cactus_call(parameters=['merge_duplicates.py', '-i', vcfwave_path, '-o', merge_path] + merge_duplicates_opts.split(' '))
Expand Down

0 comments on commit 0b533c0

Please sign in to comment.