Пример #1
0
    def sequences(self):
        """Generates each sequence in the genome as a FASTASequence

        >>> from tigerlily.sequences import PolymerSequence
        >>> refgen = GRCGenome.download('test1')
        >>> for seq in refgen.sequences():
        ...     isinstance(seq,PolymerSequence)
        True
        True
        True
        """
        if self._archive is None:
            raise ValueError('Empty reference genome, no archive loaded')

        for fasta_file in self._archive.getfasta():
            for seq in  parseFASTA(file=fasta_file):
                yield seq
Пример #2
0
    def _handle_arch(self,arch):
        "handler for testing an Archive object regardless of format"
        self.assertEqual(len(arch.getnames()),4)

        fasta_files = [f for f in arch.getfasta()]
        self.assertEqual(len(fasta_files),3)

        nofasta_files = [f for f in arch.getnofasta()]
        self.assertEqual(len(nofasta_files),1)

        # Finally, just test to make sure that FASTA can handle the test files
        # This isn't really a test of this unit, but it's a logical extension
        # and it would be bad if it failed, so let's do the test.
        for fasta_fileobj in arch.getfasta():
            for fasta_seq in parseFASTA(fasta_fileobj):
                self.assertTrue(len(fasta_seq.sequence) > 0)
                self.assertTrue(fasta_seq.identifier.startswith('seq'))