parsing a fasta file using a generator ( python )
问题 I am trying to parse a large fasta file and I am encountering out of memory errors. Some suggestions to improve the data handling would be appreciated. Currently the program correctly prints out the names however partially through the file I get a MemoryError Here is the generator def readFastaEntry( fp ): name = "" seq = "" for line in fp: if line.startswith( ">" ): tmp = [] tmp.append( name ) tmp.append( seq ) name = line seq = "" yield tmp else: seq = seq.join( line ) and here is the