Exemplo n.º 1
0
 def test_write_sequence(self):
     """writes a sequence"""
     f = StringIO()
     exp = ">abc\nAATTGG\n>efg\nATGGG\n"
     write_sequence(f, "abc", "AATTGG")
     write_sequence(f, "efg", "ATGGG")
     f.seek(0)
     obs = f.read()
     self.assertEqual(obs, exp)
Exemplo n.º 2
0
 def test_write_sequence(self):
     """writes a sequence"""
     f = StringIO()
     exp = ">abc\nAATTGG\n>efg\nATGGG\n"
     write_sequence(f, "abc", "AATTGG")
     write_sequence(f, "efg", "ATGGG")
     f.seek(0)
     obs = f.read()
     self.assertEqual(obs,exp)
Exemplo n.º 3
0
                logline = log_f("Corrupt sequence, accession: %s" % (accession))
                logger.write(logline)
                if verbose:
                    stdout.write(logline)
                failure_count += 1
                continue

            # gg_record contains gb summary data  
            try:
                gg_record = get_genbank_summary(next_record)
            except KeyError, e:
                failure_count += 1
                continue

            seen.add(accession)
            write_sequence(sequences, accession, sequence)
            write_gg_record(gg_records, gg_record)
            write_obs_record(obs_records, accession)
            
        if failure_count >= max_failures:
            logline = log_f("MAX FAILURES OF %d REACHED IN %s" % (max_failures, \
                                                                  gb_fp))
            logger.write(logline)
            stderr.write(logline)
        else:
            logline = log_f("Parsed %s, %d failures observed." % (gb_fp, \
                                                                  failure_count))
            logger.write(logline)

            if verbose:
                stdout.write(logline)