arcfish.pp.FOF_CT_Loader#
- class arcfish.pp.FOF_CT_Loader(path: str | list | dict, nm_ratio: dict | None = None, var_cols_add: list | None = None, obs_cols_add: list | None = None, **kwargs)#
Read in FOF_CT file(s).
For FOF_CT-core files, call
create_adata()to create anAnnData. The x, y, and z coordinates of each chromatin trace are stored as layers. If multiple file paths are passed in, merge traces from all the files.When having multiple files, will add a prefix to Trace_ID to make it unique. If path is a list, will add a single number prefix to Trace_ID. If path is a dictionary, prepend the dictionary key to Trace_ID.
For other FOF_CT files, call
read_data()to read in the data field as a dataframe. The only required argument is path, all other arguments passed to the constructor will be ignored.- Parameters:
path (str | list | dict) – The path of the FOF_CT file. Can be a list or a dictionary specifying multiple files.
nm_ratio (dict | None, optional) – The conversion factor to convert raw coordinate to physical coordinate in nm. No conversion if None, by default None.
var_cols_add (list | None, optional) – Additional columns added to var field in the AnnData object, by default None.
obs_cols_add (list | None, optional) – Additional columns added to obs field in the AnnData object, by default None.
kwargs (dict) – Additional keyword arguments passed to
anndata.AnnDataconstructor.
- Raises:
ValueError – If path is not a string, a list, or a dictionary.
- __init__(path: str | list | dict, nm_ratio: dict | None = None, var_cols_add: list | None = None, obs_cols_add: list | None = None, **kwargs)#
Methods
__init__(path[, nm_ratio, var_cols_add, ...])create_adata(chr_id)Create an
anndata.AnnDataobject from a single or multiple FOF_CT-core files.Read the data field of the file(s).
Attributes
Available chromosomes in FOF_CT-core.
If path is a single file name, returns a dictionary of the header information.
Conversion factor to convert voxel coordinate to actual physical coordinate.
Path of input files.
- property nm_ratio: dict | None#
Conversion factor to convert voxel coordinate to actual physical coordinate.
- Type:
dict|None
- property info: list | dict#
If path is a single file name, returns a dictionary of the header information. If path is a list, returns a list of information dictionaries. If path is a dictionary, returns a dictionary of information dictionaries.
- create_adata(chr_id: str) AnnData#
Create an
anndata.AnnDataobject from a single or multiple FOF_CT-core files. The output is for a single chromosome instead of all chromosomes imaged.- Parameters:
chr_id (str) – Chromosome ID used to filter Chrom column.
- Returns:
A n by p AnnData object, where n is the number of traces, and p is the number of locus on the chromosome. var field includes Chrom_Start, Chrom_End, and any additional columns specified by var_cols_add. obs field includes columns specified by obs_cols_add. The converted 3D coordinates are stored in layers with names X, Y, and Z.
- Return type:
AnnData