SampleMetadata¶
- class SampleMetadata(samples, axis=1, index_col=0, **kwargs)[source]¶
An essential class for handling sample metadata.
Constructor for
SampleMetadata- Parameters
samples (Union[pandas.core.frame.DataFrame, str]) – Data containing sample metadata
axis (Union[int, str]) – Sample index axis. Using 0/index sets rows as sample indices while 1/columns sets columns as indices.
index_col (Union[str, int]) – Which row/column to use as index.
kwargs (Any) – Passed to
read_csv()orbiomeloader.
- Return type
Attributes
controllerActive essentials controller instance.
dataSample metadata.
is_buckledIs current essentials instance is mounted or not.
is_mountedTrue if current essentials instance is mounted or not.
metadataThe essential instance metadata.
nameThe essential instance name.
shapeReturn the shape/size of the essential instance.
variablesSample metadata variables.
xsidSample identifiers.
Methods
copy()Copy of the instance.
drop_sample_by_id(ids, **kwargs)Drop samples by sample identifiers.
export(output_fp, *args[, _add_ext, sep])Exports the sample metadata content into the specified file.
from_biom(filepath, **kwargs)Factory method to construct a
SampleMetadatafrombiomfile.from_csv(filepath, **kwargs)Factory method to construct a
SampleMetadatafrom CSV file.get_sample_ids([dtype])This function and its sample twin is a rescue method to fix RepPhylogeny index problem.
get_subset([sids])Get subset of the
SampleMetadata.get_variables_by_id([ids, variables])Get sample metadata by sample identifiers and variables.
merge_samples_by_variable(variable[, aggfunc])Merge samples by variable.
rename_samples(mapper)Rename sample names by mapper