Skip to content

Commit

Permalink
Merge pull request #7 from VDBWRAIR/vcf
Browse files Browse the repository at this point in the history
standardized vcf dict to have ALT of list (possilby size one)
  • Loading branch information
averagehat committed Mar 2, 2016
2 parents adf0d42 + 3712f37 commit bf60674
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions biotest/biohypothesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,20 @@ def ref_with_vcf_dicts_strategy_factory(draw):
#assume(len(vcfs) > 0)
return (seq, vcfs)



#TODO: combine parse_header with ref_with_vcf_dicts_strategy_factory so that the generated VCF records match the reference sequence
@st.composite
def vcf_dict_strategy_factory(draw, chrom, pos, ref):
'''a generator that returns a single
VCF dict at a certain position or w/e for testing `call_base`'''
an_alt = st.text(alphabet='ACGT', min_size=0, max_size=6)
alts = draw(st.lists(an_alt, min_size=2, max_size=4) | an_alt)
alts = draw(st.lists(an_alt, min_size=1, max_size=4))
draw_ao = lambda: draw(st.integers(min_value=1))
draw_dp = lambda: draw(st.integers(min_value=0))
if hasattr(alts, '__iter__'):
ao = [draw_ao() for i in range(len(alts))]
#NOTE: Don't know if DP is guaranteed greater than all the AOs summed. probably.
dp = sum(ao) + draw_dp() #Don't know if DP is guaranteed greater than all the AOs summed. probably.
else:
ao = draw_ao()
dp = ao + draw_dp()
ao = [draw_ao() for i in range(len(alts))]
#NOTE: Don't know if DP is guaranteed greater than all the AOs summed. probably.
dp = sum(ao) + draw_dp() #Don't know if DP is guaranteed greater than all the AOs summed. probably.
#an AO (alternate base count) of 0 doesn't make sense
fields = ['alt', 'ref', 'pos', 'chrom', 'DP', 'AO']
values = [alts, ref, pos, chrom, dp, ao]
Expand Down

0 comments on commit bf60674

Please sign in to comment.