Commit e7722c0c authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

Merge branch 'issue-8-remove-database-configuration' of...

Merge branch 'issue-8-remove-database-configuration' of into issue-8-remove-database-configuration
parents 0df3423e 4a1731f6
Pipeline #3741 passed with stages
in 52 minutes and 45 seconds
......@@ -22,7 +22,7 @@ class Preprocessor:
A list of keyword arguments to be written in the :py:meth:`__str__` function.
def __init__(self, writes_data = True, read_original_data = lambda biofile,directory,extension : biofile.load(directory,extension), **kwargs):
def __init__(self, writes_data = True, read_original_data = utils.read_original_data, **kwargs):
# Each class needs to have a constructor taking
# all the parameters that are required for the preprocessing as arguments
self.writes_data = writes_data
......@@ -4,6 +4,7 @@ import tempfile, tarfile
import logging
logger = logging.getLogger("")
from .. import database
def filter_missing_files(file_names, split_by_client=False, allow_missing_files=True):
......@@ -51,6 +52,33 @@ def check_file(filename, force, expected_file_size = 1):
return False
def read_original_data(biofile, directory, extension):
"""read_original_data(biofile, directory, extension) -> data
This function reads the original data using the given ``biofile`` instance.
It simply calls ``load(directory, extension)`` from :py:class:`` or one of its derivatives.
``biofile`` : :py:class:`` or one of its derivatives
The file to read the original data.
``directory`` : str
The base directory of the database.
``extension`` : str or ``None``
The extension of the original data.
Might be ``None`` if the ``biofile`` itself has the extension stored.
``data`` : object
Whatver ``biofile.load`` returns; usually a :py:class:`numpy.ndarray`
assert isinstance(biofile, database.BioFile)
return biofile.load(directory, extension)
def load(file):
"""Loads data from file. The given file might be an HDF5 file open for reading or a string."""
if isinstance(file,
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment