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: beagle AP field #224

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion trtools/mergeSTR/mergeSTR.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
FORMATFIELDS = {
trh.VcfTypes.gangstr: ["DP", "Q", "REPCN", "REPCI", "RC", "ENCLREADS", "FLNKREADS", "ML", "INS", "STDERR", "QEXP"],
trh.VcfTypes.hipstr: ["GB", "Q", "PQ", "DP", "DSNP", "PSNP", "PDP", "GLDIFF", "DSTUTTER", "DFLANKINDEL", "AB", "FS",
"DAB", "ALLREADS", "MALLREADS"],
"DAB", "ALLREADS", "MALLREADS","AP1","AP2","DS"],
trh.VcfTypes.eh: ["ADFL", "ADIR", "ADSP", "LC", "REPCI", "REPCN", "SO"],
trh.VcfTypes.popstr: ["AD", "DP", "PL"],
trh.VcfTypes.advntr: ["DP", "SR", "FR", "ML"]
Expand Down
31 changes: 31 additions & 0 deletions trtools/mergeSTR/tests/test_mergeSTR.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from ..mergeSTR import *
from trtools.testsupport.utils import assert_same_vcf
import gzip, shutil



# Set up base argparser
Expand Down Expand Up @@ -115,6 +117,21 @@ def test_hipSTRRightFile(args, mrgvcfdir):
args.verbose = True
assert main(args)==0

# Test right files or directory - hipstr with FORMAT AP field
def test_hipSTRRightFile_AP(args, mrgvcfdir):
fname1 = os.path.join(mrgvcfdir, "hipstr_imputed_merge1.vcf.gz")
fname2 = os.path.join(mrgvcfdir, "hipstr_imputed_merge2.vcf.gz")
args.vcftype = "hipstr"
args.vcfs = fname1 + "," + fname2
assert main(args)==0
args.vcftype = "auto"
assert main(args)==0
args.update_sample_from_file = True
assert main(args)==0
args.verbose = True
assert main(args)==0


# Test right files or directory - ExpansionHunter
def test_ExpansionHunterRightFile(args, mrgvcfdir):
fname1 = os.path.join(mrgvcfdir, "test_file_eh1.vcf.gz")
Expand Down Expand Up @@ -351,6 +368,20 @@ def test_hipstr_output(args, mrgvcfdir):
assert main(args) == 0
assert_same_vcf(args.out + '.vcf', mrgvcfdir + "/hipstr_merged.vcf")

#test if AP field exist
def test_hipstr_output_AP(args, mrgvcfdir):
fname1 = os.path.join(mrgvcfdir, "hipstr_imputed_merge1.vcf.gz")
fname2 = os.path.join(mrgvcfdir, "hipstr_imputed_merge2.vcf.gz")
args.vcftype = "hipstr"
args.vcfs = fname1 + "," + fname2

nicholema marked this conversation as resolved.
Show resolved Hide resolved

with gzip.open(mrgvcfdir+"/hipstr_imputed_merged.vcf.gz", 'r') as f_in, open("hipstr_imputed_merged.vcf", 'wb') as f_out:
shutil.copyfileobj(f_in, f_out)
assert main(args) == 0
assert_same_vcf(args.out + '.vcf', "hipstr_imputed_merged.vcf")
os.remove("hipstr_imputed_merged.vcf")

def test_hipstr_output_flanking_pb_harmonization(args, mrgvcfdir):
fname1 = os.path.join(mrgvcfdir, "hipstr-harmonized-merge-contains-flanking.vcf.gz")
fname2 = os.path.join(mrgvcfdir, "hipstr-harmonized-merge-no-flanking.vcf.gz")
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading