Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. from Bio.SeqRecord import SeqRecord
  2. from Bio.Seq import Seq
  3. from Bio.Alphabet import IUPAC
  4.  
  5. """
  6. record = SeqRecord(
  7. Seq("ATGC", IUPAC.ambiguous_dna),
  8. id="id1",
  9. name="id1name",
  10. description="some description"
  11. )
  12. """
  13.  
  14. from hypothesis import strategies as st
  15. from hypothesis import find, note, given, assume
  16.  
  17. make_seqrec = lambda seq, quals: \
  18. SeqRecord(Seq(seq, IUPAC.ambiguous_dna), id='id', description='', letter_annotations={'phred_quality':quals})
  19. rec = make_seqrec('AAAA', [40,40,40,40])
  20. assert rec.format('fastq') == '@id\nAAAA\n+\nIIII\n', rec.format('fastq')
  21.  
  22. recs = st.integers(min_value=10, max_value=500).flatmap(
  23. lambda n:
  24. st.tuples(
  25. st.text(alphabet='ATGC', min_size=n, max_size=n),
  26. st.lists(st.integers(min_value=0, max_value=40), min_size=n, max_size=n)
  27. )
  28. )
  29.  
  30. @given(recs)
  31. def test_records_work(seqqual):
  32. seq, qual = seqqual
  33. print 'Seq: %s\nQual: %s' % (seq, qual)
  34. assume(set(seq) != set('A'))
  35. assert False
  36.  
  37. test_records_work()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement