Skip to content

Commit

Permalink
adding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ACEnglish committed Jan 6, 2024
1 parent d79bae2 commit 3d4bffa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
Binary file added repo_utils/answer_key/phab/phab_result_poa.vcf.gz
Binary file not shown.
11 changes: 11 additions & 0 deletions repo_utils/sub_tests/phab.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ if [ $test_phab_wfa ]; then
assert_equal $(fn_md5 $ANSDIR/phab/phab_result_wfa.vcf.gz) $(fn_md5 $OD/phab_result_wfa.vcf.gz)
fi

run test_phab_poa $truv phab -o $OD/phab_result_poa.vcf.gz \
-b $INDIR/variants/phab_base.vcf.gz \
-c $INDIR/variants/phab_comp.vcf.gz \
-f $INDIR/references/phab_ref.fa \
-r chr1:700-900 --align poa
if [ $test_phab_poa ]; then
assert_exit_code 0
assert_equal $(fn_md5 $ANSDIR/phab/phab_result_poa.vcf.gz) $(fn_md5 $OD/phab_result_poa.vcf.gz)
fi


run test_phab_badparams $truv phab -o $OD/phab_result\
-b doesntexist.vcf \
-c alsobad.vcf \
Expand Down
11 changes: 8 additions & 3 deletions truvari/phab.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,15 @@ def poa_to_vars(seq_bytes):
"""
Run partial order alignment to create msa
"""
fasta = {k: v.decode() for k, v in fasta_reader(seq_bytes.decode(), False)}
parts = sorted(list(fasta_reader(seq_bytes.decode(), False)))
names = []
seqs = []
for k,v in parts:
names.append(k)
seqs.append(v.decode().strip())
aligner = pyabpoa.msa_aligner()
aln_result = aligner.msa(fasta.values(), False, True)
return truvari.msa2vcf(dict(zip(fasta.keys(), aln_result.msa_seq)))
aln_result = aligner.msa(seqs, False, True)
return truvari.msa2vcf(dict(zip(names, aln_result.msa_seq)))


def harmonize_variants(harm_jobs, mafft_params, base_vcf, samp_names, output_fn, threads, method="mafft"):
Expand Down

0 comments on commit 3d4bffa

Please sign in to comment.