Exemplo n.º 1
0
 def test_read_sequences_from_fasta_string(self):
     """test reading sequences from a string in FASTA format"""
     with open("testdata/fasta_test.fa") as inputfile:
         fasta_string = inputfile.read()
     seqs = st.read_sequences_from_fasta_string(fasta_string)
     self.assertEquals(7, len(seqs))
     seq = ("CCGAGGAAGACAGACGCAATTTCACATCGAACTCGTGTACGGCATCCTCT" +
            "TTATTGCCGGCTTTGCTTTTCTCGTCTTCCGCGTCGATCCCCGGGTGGCA" +
            "GCGTTCGAAGGAGGTCTCGTCATTGGTTACTTATTGAGAATTTAGGGGAA" +
            "AATGTCAATCTACGAGTGGA")
     self.assertEquals('VNG6198H', seqs[6][0])
     self.assertEquals(seq, seqs[6][1])
Exemplo n.º 2
0
 def test_read_sequences_from_fasta_string(self):
     """test reading sequences from a string in FASTA format"""
     with open("testdata/fasta_test.fa") as inputfile:
         fasta_string = inputfile.read()
     seqs = st.read_sequences_from_fasta_string(fasta_string)
     self.assertEquals(7, len(seqs))
     seq = ("CCGAGGAAGACAGACGCAATTTCACATCGAACTCGTGTACGGCATCCTCT" +
            "TTATTGCCGGCTTTGCTTTTCTCGTCTTCCGCGTCGATCCCCGGGTGGCA" +
            "GCGTTCGAAGGAGGTCTCGTCATTGGTTACTTATTGAGAATTTAGGGGAA" +
            "AATGTCAATCTACGAGTGGA")
     self.assertEquals('VNG6198H', seqs[6][0])
     self.assertEquals(seq, seqs[6][1])
Exemplo n.º 3
0
 def process_with_dust(seqs):
     """data conversion from and to dust tool"""
     dust_tmp_file = None
     with tempfile.NamedTemporaryFile(mode='w+',
                                      prefix='dust',
                                      delete=False) as dust_input:
         for feature_id, seq in seqs.items():
             dust_input.write(">%s\n" % feature_id)
             if isinstance(seq, str):
                 dust_input.write("%s\n" % seq)
             else:
                 dust_input.write("%s\n" % seq)
         dust_tmp_file = dust_input.name
         #logging.info("DUST input written to: %s", dust_input.name)
     seqpairs = st.read_sequences_from_fasta_string(
         self.dust(dust_tmp_file))
     os.remove(dust_tmp_file)
     return {feature_id: seq for feature_id, seq in seqpairs}
Exemplo n.º 4
0
 def process_with_dust(seqs):
     """data conversion from and to dust tool"""
     dust_tmp_file = None
     with tempfile.NamedTemporaryFile(mode='w+',
                                      prefix='dust',
                                      delete=False) as dust_input:
         for feature_id, seq in seqs.items():
             dust_input.write(">%s\n" % feature_id)
             if isinstance(seq, str):
                 dust_input.write("%s\n" % seq)
             else:
                 dust_input.write("%s\n" % seq)
         dust_tmp_file = dust_input.name
         #logging.info("DUST input written to: %s", dust_input.name)
     seqpairs = st.read_sequences_from_fasta_string(
         self.dust(dust_tmp_file))
     os.remove(dust_tmp_file)
     return {feature_id: seq for feature_id, seq in seqpairs}