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() or biome loader.

Return type

None

Attributes

controller

Active essentials controller instance.

data

Sample metadata.

is_buckled

Is current essentials instance is mounted or not.

is_mounted

True if current essentials instance is mounted or not.

metadata

The essential instance metadata.

name

The essential instance name.

shape

Return the shape/size of the essential instance.

variables

Sample metadata variables.

xsid

Sample 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 SampleMetadata from biom file.

from_csv(filepath, **kwargs)

Factory method to construct a SampleMetadata from 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