Ejemplo n.º 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"]))
Ejemplo n.º 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"))
Ejemplo n.º 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"))
Ejemplo n.º 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))
Ejemplo n.º 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))
Ejemplo n.º 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""")
Ejemplo n.º 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""")
Ejemplo n.º 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")
Ejemplo n.º 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"]))
Ejemplo n.º 10
0
 def test_Description_initialisation(self):
     from tinyfasta import FastaRecord
     description = FastaRecord.Description(">seq101|testing\n")
     self.assertTrue(isinstance(description, FastaRecord.Description))
Ejemplo n.º 11
0
 def test_FastaRecord_initialisation(self):
     from tinyfasta import FastaRecord
     fasta_record = FastaRecord(">seq101|testing\n")
     self.assertTrue(isinstance(fasta_record, FastaRecord))
Ejemplo n.º 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)
Ejemplo n.º 13
0
 def test_description(self):
     from tinyfasta import FastaRecord
     fasta_record = FastaRecord(">seq101|testing\n")
     self.assertEqual(str(fasta_record.description), ">seq101|testing")
Ejemplo n.º 14
0
 def test_str(self):
     from tinyfasta import FastaRecord
     description = FastaRecord.Description(">seq101|testing\n")
     self.assertEqual(str(description), ">seq101|testing")
Ejemplo n.º 15
0
 def test_content(self):
     from tinyfasta import FastaRecord
     description = FastaRecord.Description(">seq101|testing\n")
     self.assertEqual(description._content, ">seq101|testing")
Ejemplo n.º 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")
Ejemplo n.º 17
0
 def test_len_when_empty(self):
     from tinyfasta import FastaRecord
     fasta_record = FastaRecord(">seq101|testing\n")
     self.assertEqual(len(fasta_record), 0)
Ejemplo n.º 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)
Ejemplo n.º 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))
Ejemplo n.º 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))