Made the FastaFile object an instance variable of the fasta extractor. By doing so, the file is only opened once, on construction of the extractor instead of on every call. This significantly improves performance when this function called many times. If this is behavior is not always the preferred one, we could introduce a flag indicating which type of behavior is preferred (but for simplicity and the fact that genomelake is tailored towards machine learning, probably performance of data retrieval is almost always most important).
Made the FastaFile object an instance variable of the fasta extractor. By doing so, the file is only opened once, on construction of the extractor instead of on every call. This significantly improves performance when this function called many times. If this is behavior is not always the preferred one, we could introduce a flag indicating which type of behavior is preferred (but for simplicity and the fact that genomelake is tailored towards machine learning, probably performance of data retrieval is almost always most important).