Пример #1
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"]))
Пример #2
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"))
Пример #3
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"))
Пример #4
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))
Пример #5
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))
Пример #6
0
    def test_create_fasta_record(self):
        from tinyfasta import FastaRecord
        description = ">seq101|testing"
        sequence = "ATCG"*30
        fasta_record = FastaRecord.create(description, sequence)
        self.assertEqual(str(fasta_record),
""">seq101|testing
ATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCG
ATCGATCGATCGATCGATCGATCGATCGATCGATCGATCG""")
Пример #7
0
    def test_create_fasta_record(self):
        from tinyfasta import FastaRecord
        description = ">seq101|testing"
        sequence = "ATCG" * 30
        fasta_record = FastaRecord.create(description, sequence)
        self.assertEqual(
            str(fasta_record), """>seq101|testing
ATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCG
ATCGATCGATCGATCGATCGATCGATCGATCGATCGATCG""")
Пример #8
0
 def test_update_description(self):
     from tinyfasta import FastaRecord
     description = FastaRecord.Description(">seq101|testing\n")
     self.assertEqual(str(description), ">seq101|testing")
     description.update(">seq102|testing\n")
     self.assertEqual(str(description), ">seq102|testing")
     description.update(">seq103|testing")
     self.assertEqual(str(description), ">seq103|testing")
     description.update(">seq104|testing")
     self.assertEqual(str(description), ">seq104|testing")
Пример #9
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"]))
Пример #10
0
 def test_Description_initialisation(self):
     from tinyfasta import FastaRecord
     description = FastaRecord.Description(">seq101|testing\n")
     self.assertTrue(isinstance(description, FastaRecord.Description))
Пример #11
0
 def test_FastaRecord_initialisation(self):
     from tinyfasta import FastaRecord
     fasta_record = FastaRecord(">seq101|testing\n")
     self.assertTrue(isinstance(fasta_record, FastaRecord))
Пример #12
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)
Пример #13
0
 def test_description(self):
     from tinyfasta import FastaRecord
     fasta_record = FastaRecord(">seq101|testing\n")
     self.assertEqual(str(fasta_record.description), ">seq101|testing")
Пример #14
0
 def test_str(self):
     from tinyfasta import FastaRecord
     description = FastaRecord.Description(">seq101|testing\n")
     self.assertEqual(str(description), ">seq101|testing")
Пример #15
0
 def test_content(self):
     from tinyfasta import FastaRecord
     description = FastaRecord.Description(">seq101|testing\n")
     self.assertEqual(description._content, ">seq101|testing")
Пример #16
0
 def test_Description_initialisation_withount_leading_arrow(self):
     from tinyfasta import FastaRecord
     description = FastaRecord.Description("seq101|testing\n")
     self.assertEqual(str(description), ">seq101|testing")
Пример #17
0
 def test_len_when_empty(self):
     from tinyfasta import FastaRecord
     fasta_record = FastaRecord(">seq101|testing\n")
     self.assertEqual(len(fasta_record), 0)
Пример #18
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)
Пример #19
0
 def test_seqence_type(self):
     from tinyfasta import FastaRecord, Sequence
     fasta_record = FastaRecord(">seq101|testing\n")
     self.assertTrue(isinstance(fasta_record.sequence, Sequence))
Пример #20
0
 def test_description_type(self):
     from tinyfasta import FastaRecord
     fasta_record = FastaRecord(">seq101|testing\n")
     self.assertTrue(
         isinstance(fasta_record.description, FastaRecord.Description))