Ejemplo n.º 1
0
    def test_get_accession(self):
        """Get an accession"""
        exp_gb1 = "AGIY01000001.1"
        exp_gb2 = "FO117587.1"

        obs_gb1 = get_accession(self.gb1)
        obs_gb2 = get_accession(self.gb2)

        self.assertEqual(obs_gb1, exp_gb1)
        self.assertEqual(obs_gb2, exp_gb2)
Ejemplo n.º 2
0
                next_record = records.next()
            except PartialRecordError, e:
                failure_count += 1
                continue
            except StopIteration:
                break
            except Exception, e:
                logline = log_f("Caught: %s, previous accession: %s" % (e, accession))
                logger.write(logline)
                if verbose:
                    stdout.write(logline)
                failure_count += 1

            # accession is str including version
            try:
                accession = get_accession(next_record)
            except:
                failure_count += 1
                continue
            if accession in observed_records:
                continue
            if accession in seen:
                continue
                # accession added at the end of this while loop

            # sequence is just a str of sequence
            try:
                sequence = get_sequence(next_record)
            except NoSequenceError:
                # this isn't a failure, so no point in continuing but record
                # the accession so it isn't hit again