コード例 #1
0
 def test_seqence_contains_function_no_file(self):
     from tinyfasta import FastaRecord
     fasta_record = FastaRecord(">seq101|testing\n")
     fasta_record.add_sequence_line("AAAT")
     fasta_record.add_sequence_line("TAAA")
     self.assertTrue(fasta_record.sequence.contains("ATTA"))
     self.assertFalse(fasta_record.sequence.contains("ACCA"))
コード例 #2
0
 def test_string_representation(self):
     from tinyfasta import FastaRecord
     fasta_record = FastaRecord(">seq101|testing\n")
     fasta_record.add_sequence_line("atta\n")
     fasta_record.add_sequence_line("TAAT")
     self.assertEqual(str(fasta_record),
                      '\n'.join([">seq101|testing", "atta", "TAAT"]))
コード例 #3
0
 def test_seqence_contains_function_with_regex_no_file(self):
     import re
     regex_match = re.compile(r"A[T]{2}A")
     regex_no_match = re.compile(r"A[T]{3}A")
     from tinyfasta import FastaRecord
     fasta_record = FastaRecord(">seq101|testing\n")
     fasta_record.add_sequence_line("AAAT")
     fasta_record.add_sequence_line("TAAA")
     self.assertTrue(fasta_record.sequence.contains(regex_match))
     self.assertFalse(fasta_record.sequence.contains(regex_no_match))
コード例 #4
0
 def test_len_when_empty(self):
     from tinyfasta import FastaRecord
     fasta_record = FastaRecord(">seq101|testing\n")
     self.assertEqual(len(fasta_record), 0)
コード例 #5
0
 def test_len(self):
     from tinyfasta import FastaRecord
     fasta_record = FastaRecord(">seq101|testing\n")
     fasta_record.add_sequence_line("atta\n")
     fasta_record.add_sequence_line("TAAT")
     self.assertEqual(len(fasta_record), 8)
コード例 #6
0
 def test_seqence_type(self):
     from tinyfasta import FastaRecord, Sequence
     fasta_record = FastaRecord(">seq101|testing\n")
     self.assertTrue(isinstance(fasta_record.sequence, Sequence))
コード例 #7
0
 def test_description_type(self):
     from tinyfasta import FastaRecord
     fasta_record = FastaRecord(">seq101|testing\n")
     self.assertTrue(
         isinstance(fasta_record.description, FastaRecord.Description))
コード例 #8
0
 def test_description(self):
     from tinyfasta import FastaRecord
     fasta_record = FastaRecord(">seq101|testing\n")
     self.assertEqual(str(fasta_record.description), ">seq101|testing")
コード例 #9
0
 def test_FastaRecord_initialisation(self):
     from tinyfasta import FastaRecord
     fasta_record = FastaRecord(">seq101|testing\n")
     self.assertTrue(isinstance(fasta_record, FastaRecord))