class FastaIterator(InputFile): def __init__(self, name=""): self.init() # initialize if (name != ""): self.setName(name) self.open() self.fasta = None def nextHeader(self): # Find the start of the next sequence. while ( ( self.isEndOfFile () == 0 ) and \ ( self.line != "" ) and \ ( self.line [ 0 ] != '>' ) ): self.next() return self.line def nextSequence(self): self.nextHeader() # Parse the header line. self.fasta = FastaSequence() self.fasta.parseHeader(self.line) # Read in the sequence data. self.next() seq = "" while ( ( self.isEndOfFile () == 0 ) and \ ( self.line != "" ) and ( self.line [ 0 ] != '>' ) ): seq = seq + string.rstrip(self.line) self.next() self.fasta.setSequence(seq) return self.fasta
class FastaIterator ( InputFile ): def __init__ ( self, name = "" ): self.init (); # initialize if ( name != "" ): self.setName ( name ) self.open () self.fasta = None def nextHeader ( self ): # Find the start of the next sequence. while ( ( self.isEndOfFile () == 0 ) and \ ( self.line != "" ) and \ ( self.line [ 0 ] != '>' ) ): self.next () return self.line def nextSequence ( self ): self.nextHeader () # Parse the header line. self.fasta = FastaSequence () self.fasta.parseHeader ( self.line ) # Read in the sequence data. self.next () seq = "" while ( ( self.isEndOfFile () == 0 ) and \ ( self.line != "" ) and ( self.line [ 0 ] != '>' ) ): seq = seq + string.rstrip ( self.line ) self.next () self.fasta.setSequence ( seq ) return self.fasta
class FastaIterator ( InputFile ): ############################################################################# # # FastaIterator constructor. # def __init__ ( self, name = "" ): self.initialize (); # initialize if ( name != "" ): self.setFileName ( name ) self.openFile () self.fasta = None ############################################################################# # # This method reads the FASTA sequence library file to the next header line. # def nextHeader ( self ): # Find the start of the next sequence. while ( ( self.isEndOfFile () == 0 ) and \ ( self.line != "" ) and \ ( self.line [ 0 ] != '>' ) ): self.nextLine () return self.line ############################################################################# # # This method returns the next FastaSequence sequence object. # def nextSequence ( self ): self.nextHeader () # Parse the header line. self.fasta = FastaSequence () self.fasta.parseHeader ( self.line ) # Read in the sequence data. self.nextLine () seq = "" while ( ( self.isEndOfFile () == 0 ) and \ ( self.line != "" ) and ( self.line [ 0 ] != '>' ) ): seq = seq + self.line.rstrip () self.nextLine () self.fasta.setSequence ( seq ) return self.fasta
class FastaIterator(InputFile): ############################################################################# # # FastaIterator constructor. # def __init__(self, name=""): self.initialize() # initialize if (name != ""): self.setFileName(name) self.openFile() self.fasta = None ############################################################################# # # This method reads the FASTA sequence library file to the next header line. # def nextHeader(self): # Find the start of the next sequence. while ( ( self.isEndOfFile () == 0 ) and \ ( self.line != "" ) and \ ( self.line [ 0 ] != '>' ) ): self.nextLine() return self.line ############################################################################# # # This method returns the next FastaSequence sequence object. # def nextSequence(self): self.nextHeader() # Parse the header line. self.fasta = FastaSequence() self.fasta.parseHeader(self.line) # Read in the sequence data. self.nextLine() seq = "" while ( ( self.isEndOfFile () == 0 ) and \ ( self.line != "" ) and ( self.line [ 0 ] != '>' ) ): seq = seq + self.line.rstrip() self.nextLine() self.fasta.setSequence(seq) return self.fasta
def nextSequence(self): self.nextHeader() # Parse the header line. self.fasta = FastaSequence() self.fasta.parseHeader(self.line) # Read in the sequence data. self.nextLine() seq = "" while ( ( self.isEndOfFile () == 0 ) and \ ( self.line != "" ) and ( self.line [ 0 ] != '>' ) ): seq = seq + self.line.rstrip() self.nextLine() self.fasta.setSequence(seq) return self.fasta
def nextSequence ( self ): self.nextHeader () # Parse the header line. self.fasta = FastaSequence () self.fasta.parseHeader ( self.line ) # Read in the sequence data. self.nextLine () seq = "" while ( ( self.isEndOfFile () == 0 ) and \ ( self.line != "" ) and ( self.line [ 0 ] != '>' ) ): seq = seq + self.line.rstrip () self.nextLine () self.fasta.setSequence ( seq ) return self.fasta