class documentation
Local file system implementation of FileReader.
This class provides functionality to:
- Read files from the local filesystem
- Load file contents into pandas DataFrames
- List directory contents
- Execute shell commands locally
| Static Method | get |
Returns the size of a local file in bytes. |
| Method | __init__ |
Initializes an instance of LocalFileReader. |
| Method | listdir |
Lists directories and files in a given local directory path. |
| Method | run |
Executes a shell command locally and returns its output. |
| Method | _read |
Smart file content reader. |
| Method | _read |
Undocumented |
Inherited from FileReader:
| Method | __del__ |
Destructor to clean up temporary files if clean_on_destruction is enabled. |
| Method | clean |
Deletes a temporary file if it exists. |
| Method | decode |
Decodes content based on file type, returning a DataFrame or raw string. |
| Method | download |
Abstract method. Downloads a file from a remote location. |
| Method | get |
Extracts the file extension from a given path. |
| Method | get |
Placeholder to get file size. |
| Method | is |
Checks if the reader is set to remote mode. |
| Method | isfile |
Checks if a given path exists and is a file. |
| Method | load |
Placeholder for remote/local logic in loading H5AD files. |
| Method | read |
Unified file reader for local or remote paths. :param path: File path. :param type: Optional file type override (generic types: pdf, image, text, csv, zip). :param as_dataframe: Whether to parse into a DataFrame... |
| Method | read |
File reader into a dataframe for local and remote paths :param path: File path. :param type: Optional file type override (generic types: pdf, image, text, csv, zip). :param as_dataframe: Force a parsing into a DataFrame... |
| Method | read |
Reads an H5AD file using `anndatareader`. |
| Method | read |
Reads a VCF (Variant Call Format) file using `pysam`. |
| Method | set |
Sets the `clean_on_destruction` flag. |
| Method | write |
Abstract method. Writes data to a remote file. |
| Instance Variable | clean |
Undocumented |
| Instance Variable | files |
Undocumented |
| Instance Variable | remote |
Undocumented |
| Method | _is |
Undocumented |
| Method | _is |
Undocumented |
| Method | _is |
Undocumented |
Returns the size of a local file in bytes.
:param file_path: Path to the file. :type file_path: str
:return: File size in bytes or None if the file doesn't exist. :rtype: int | None
overrides
pyalma.fileReader.FileReader.listdirLists directories and files in a given local directory path.
:param path: Directory path to list contents from. :type path: str
:return: A tuple containing a list of subdirectories and a list of files. :rtype: tuple[list[str], list[str]]
Executes a shell command locally and returns its output.
:param command: Command string to execute. :type command: str
:return: Dictionary with 'output' and 'err' keys. :rtype: dict