Step 4: Edit file_factory.py
This file implements a class whose purpose is to create a list of all files
that should be processed by parsomics-core
.
Explanation
In file_factory.py
you should include a subclass of the FileFactory
class,
from the parsomics-core
library. The FileFactory
class has ready-made code
for recursively traversing a directory and creating a list of all valid files
within it.
All you need to do in your implementation is specifying the file validation
class that the factory should use. For that, use the class that we just
implemented in validated_file.py
.
Hands on
-
The template most likely generated the entire file correctly. All you need to do is remove the triple quotes and test the factory for correctness.
-
Stage
file_factory.py
and commit it
Result
file_factory.py
from typing import Sequence
from parsomics_core.factories import FileFactory
from .validated_file import InterproValidatedFile
class InterproFileFactory(FileFactory):
def __init__(self, path: str, dereplicated_genomes: Sequence[str]):
return super().__init__(
validation_class=InterproValidatedFile,
path=path,
dereplicated_genomes=dereplicated_genomes,
)