Data Loading
IO module containing DataLoader
for interop between DataFrames/CSVs and AnnData H5AD
DataLoader
dataclass
¶
A class for loading and manipulating data for the DFMDash project.
Attributes:
Name | Type | Description |
---|---|---|
ad |
Optional[AnnData]
|
An optional AnnData object representing the loaded data. |
data |
Optional[DataFrame]
|
An optional pandas DataFrame representing the data. |
var |
Optional[DataFrame]
|
An optional pandas DataFrame representing the factors. |
obs |
Optional[DataFrame]
|
An optional pandas DataFrame representing the metadata. |
Methods:
Name | Description |
---|---|
load |
Path, factors: Path, metadata: Optional[Path] = None) -> DataLoader: Loads the data, factors, and metadata from the specified paths and returns the DataLoader object. |
convert |
AnnData) -> DataLoader: Converts the provided AnnData object to DataLoader format and returns the DataLoader object. |
dfs_to_ad |
pd.DataFrame, factors: pd.DataFrame, metadata: Optional[pd.DataFrame]) -> AnnData: Converts the provided pandas DataFrames to an AnnData object and returns it. |
write_csvs |
Path) -> DataLoader: Writes the data, factors, and metadata to CSV files in the specified output directory and returns the DataLoader object. |
write_h5ad |
Path) -> DataLoader: Writes the AnnData object to an H5AD file in the specified output directory and returns the DataLoader object. |
Source code in dfmdash/io.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|