Example #1
0
 def test__guess_seqtype_from_file_fasta_correct(self):
     "Test guessing the sequence type from correct fasta contents"
     with open(get_file_path('melanin.fasta'), 'rU') as h:
         self.assertEqual("fasta", seqio._guess_seqtype_from_file(h))
         h.seek(0)
         string_seq = h.read()
         self.assertEqual("fasta", seqio._guess_seqtype_from_file(string_seq))
Example #2
0
 def test__guess_seqtype_from_file_genbank_no_header(self):
     "Test guessing the sequence type from a genbank file without header"
     with open(get_file_path('no_header.gbk'), 'rU') as h:
         self.assertEqual("genbank", seqio._guess_seqtype_from_file(h))
         h.seek(0)
         string_seq = h.read()
         self.assertEqual("genbank", seqio._guess_seqtype_from_file(string_seq))
Example #3
0
 def test__guess_seqtype_from_file_embl_no_header(self):
     "Test guessing the sequence type from an embl file without header"
     with open(get_file_path('no_header.embl'), 'rU') as h:
         self.assertEqual("embl", seqio._guess_seqtype_from_file(h))
         h.seek(0)
         string_seq = h.read()
         self.assertEqual("embl",
                          seqio._guess_seqtype_from_file(string_seq))
Example #4
0
 def test__guess_seqtype_from_file_fasta_correct(self):
     "Test guessing the sequence type from correct fasta contents"
     with open(get_file_path('melanin.fasta'), 'rU') as h:
         self.assertEqual("fasta", seqio._guess_seqtype_from_file(h))
         h.seek(0)
         string_seq = h.read()
         self.assertEqual("fasta",
                          seqio._guess_seqtype_from_file(string_seq))
Example #5
0
 def test_read_fasta_no_header(self):
     "Test reading a fasta record without header"
     with open(get_file_path('no_header.fasta'), 'rU') as h:
         # plain BioPython reading should fail
         self.assertRaises(ValueError, seqio.read, h)
         h.seek(0)
         # robust reading should work
         record = seqio.read(h, robust=True)
         self.assertEqual("DUMMY", record.id)
Example #6
0
 def test_read_fasta_no_header(self):
     "Test reading a fasta record without header"
     with open(get_file_path('no_header.fasta'), 'rU') as h:
         # plain BioPython reading should fail
         self.assertRaises(ValueError, seqio.read, h)
         h.seek(0)
         # robust reading should work
         record = seqio.read(h, robust=True)
         self.assertEqual("DUMMY", record.id)
Example #7
0
 def test_parse_fasta_no_header(self):
     "Test parsing a fasta record without header"
     with open(get_file_path('no_header.fasta'), 'rU') as h:
         # plain BioPython parsing should fail
         records = list(seqio.parse(h))
         self.assertEqual(0, len(records))
         h.seek(0)
         # robust parsing should work
         records = list(seqio.parse(h, robust=True))
         self.assertEqual(1, len(records))
Example #8
0
 def test_parse_fasta_no_header(self):
     "Test parsing a fasta record without header"
     with open(get_file_path('no_header.fasta'), 'rU') as h:
         # plain BioPython parsing should fail
         records = list(seqio.parse(h))
         self.assertEqual(0, len(records))
         h.seek(0)
         # robust parsing should work
         records = list(seqio.parse(h, robust=True))
         self.assertEqual(1, len(records))
Example #9
0
 def test_read_fasta_valid(self):
     "Test reading a valid fasta record"
     with open(get_file_path('melanin.fasta'), 'rU') as h:
         record = seqio.read(h)
     self.assertEqual("AB070938", record.id)
Example #10
0
 def test_read_embl_valid(self):
     "Test reading a valid embl record"
     with open(get_file_path('melanin.embl'), 'rU') as h:
         record = seqio.read(h)
     self.assertEqual("AB070938.1", record.id)
Example #11
0
 def test_parse_fasta_valid(self):
     "Test parsing a valid fasta record"
     with open(get_file_path('melanin.fasta'), 'rU') as h:
         records = list(seqio.parse(h))
     self.assertEqual(1, len(records))
Example #12
0
 def test_parse_genbank_valid(self):
     "Test parsing a valid genbank record"
     with open(get_file_path('melanin.gbk'), 'rU') as h:
         records = list(seqio.parse(h))
     self.assertEqual(1, len(records))
Example #13
0
 def test_read_embl_valid(self):
     "Test reading a valid embl record"
     with open(get_file_path('melanin.embl'), 'rU') as h:
         record = seqio.read(h)
     self.assertEqual("AB070938.1", record.id)
Example #14
0
 def test_parse_genbank_path(self):
     "Test parsing a gzipped GenBank file specified by path"
     fname = get_file_path('melanin.gbk.gz')
     records = list(seqio.parse(fname))
     self.assertEqual(1, len(records))
Example #15
0
 def test_parse_genbank(self):
     "Test parsing a gzipped GenBank file"
     with open(get_file_path('melanin.gbk.gz'), 'rb') as h:
         records = list(seqio.parse(h))
     self.assertEqual(1, len(records))
Example #16
0
 def test_read_genbank_path(self):
     "Test reading a gzipped GenBank file specified by path"
     fname = get_file_path('melanin.gbk.gz')
     record = seqio.read(fname)
     self.assertEqual("AB070938.1", record.id)
Example #17
0
 def test_parse_genbank_path(self):
     "Test parsing a gzipped GenBank file specified by path"
     fname = get_file_path('melanin.gbk.gz')
     records = list(seqio.parse(fname))
     self.assertEqual(1, len(records))
Example #18
0
 def test_read_genbank(self):
     "Test reading a gzipped GenBank file"
     with open(get_file_path('melanin.gbk.gz'), 'rb') as h:
         record = seqio.read(h)
     self.assertEqual("AB070938.1", record.id)
Example #19
0
 def test_parse_genbank(self):
     "Test parsing a gzipped GenBank file"
     with open(get_file_path('melanin.gbk.gz'), 'rb') as h:
         records = list(seqio.parse(h))
     self.assertEqual(1, len(records))
Example #20
0
 def test_read_fasta_valid(self):
     "Test reading a valid fasta record"
     with open(get_file_path('melanin.fasta'), 'rU') as h:
         record = seqio.read(h)
     self.assertEqual("AB070938", record.id)
Example #21
0
 def test_read_genbank(self):
     "Test reading a gzipped GenBank file"
     with open(get_file_path('melanin.gbk.gz'), 'rb') as h:
         record = seqio.read(h)
     self.assertEqual("AB070938.1", record.id)
Example #22
0
 def test_parse_fasta_valid(self):
     "Test parsing a valid fasta record"
     with open(get_file_path('melanin.fasta'), 'rU') as h:
         records = list(seqio.parse(h))
     self.assertEqual(1, len(records))
Example #23
0
 def test_read_genbank_path(self):
     "Test reading a gzipped GenBank file specified by path"
     fname = get_file_path('melanin.gbk.gz')
     record = seqio.read(fname)
     self.assertEqual("AB070938.1", record.id)
Example #24
0
 def test_parse_genbank_valid(self):
     "Test parsing a valid genbank record"
     with open(get_file_path('melanin.gbk'), 'rU') as h:
         records = list(seqio.parse(h))
     self.assertEqual(1, len(records))
Example #25
0
 def test__guess_seqtype_from_file_fasta_no_header_lower_case(self):
     "Test guessing the sequence type from a lower case fasta file without header"
     with open(get_file_path('no_header.fasta'), 'rU') as h:
         string_seq = h.read().lower()
         self.assertEqual("fasta", seqio._guess_seqtype_from_file(string_seq))
Example #26
0
 def test__guess_seqtype_from_file_fasta_no_header_lower_case(self):
     "Test guessing the sequence type from a lower case fasta file without header"
     with open(get_file_path('no_header.fasta'), 'rU') as h:
         string_seq = h.read().lower()
         self.assertEqual("fasta",
                          seqio._guess_seqtype_from_file(string_seq))