Skip to content

Commit

Permalink
Merge pull request #135 from nate-d-olson/ndo-fix-hap-convert-gvcf
Browse files Browse the repository at this point in the history
Fixing argument namespace issue introduced with hguturu:hg-fix-pre-convert-gvcf
  • Loading branch information
dskola authored Mar 18, 2021
2 parents 214ec68 + 5f5b042 commit 79de3c7
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/python/hap.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ def main():

# control preprocessing
pre.updateArgs(parser)
parser.add_argument('--convert-gvcf-truth', dest='convert_gvcf_truth', action="store_true", default=False,
help='Convert the truth set from genome VCF format to a VCF before processing.')
parser.add_argument('--convert-gvcf-query', dest='convert_gvcf_query', action="store_true", default=False,
help='Convert the query set from genome VCF format to a VCF before processing.')
parser.add_argument("--preprocess-truth", dest="preprocessing_truth", action="store_true", default=False,
help="Preprocess truth file with same settings as query (default is to accept truth in original format).")
parser.add_argument("--usefiltered-truth", dest="usefiltered_truth", action="store_true", default=False,
Expand Down Expand Up @@ -282,10 +286,13 @@ def main():
if args.preprocessing_truth:
if args.filter_nonref:
logging.info("Filtering out any variants genotyped as <NON_REF>")

if args.convert_gvcf_truth:

## Only converting truth gvcf to vcf if both arguments are true
convert_gvcf_truth = False
if args.convert_gvcf_truth or args.convert_gvcf_to_vcf:
logging.info("Converting genome VCF to VCF")

convert_gvcf_truth=True

tempfiles.append(ttf.name)
tempfiles.append(ttf.name + ".csi")
tempfiles.append(ttf.name + ".tbi")
Expand All @@ -306,7 +313,7 @@ def main():
args.somatic_allele_conversion,
"TRUTH",
filter_nonref=args.filter_nonref if args.preprocessing_truth else False,
convert_gvcf_to_vcf=args.convert_gvcf_truth)
convert_gvcf_to_vcf=convert_gvcf_truth)

args.vcf1 = ttf.name

Expand Down Expand Up @@ -337,8 +344,12 @@ def main():
logging.info("Preprocessing query: %s" % args.vcf2)
if args.filter_nonref:
logging.info("Filtering out any variants genotyped as <NON_REF>")
if args.convert_gvcf_query:
logging.info("Converting genome VCF to VCF")

## Only converting truth gvcf to vcf if both arguments are true
convert_gvcf_query = False
if args.convert_gvcf_query or args.convert_gvcf_to_vcf:
logging.info("Converting genome VCF to VCF")
convert_gvcf_query=True

starttime = time.time()

Expand Down Expand Up @@ -380,7 +391,7 @@ def main():
args.somatic_allele_conversion,
"QUERY",
filter_nonref=args.filter_nonref,
convert_gvcf_to_vcf=args.convert_gvcf_query)
convert_gvcf_to_vcf=convert_gvcf_query)

args.vcf2 = qtf.name
h2 = vcfextract.extractHeadersJSON(args.vcf2)
Expand Down

0 comments on commit 79de3c7

Please sign in to comment.