Bases: BaseExporter

Exporter for Annotations curations.

Attributes:
  • attribute (Literal['tissue', 'disease', 'sex', 'age']) –

    Attribute of the annotations to save.

  • level (Literal['sample', 'series']) –

    Level of the annotations.

  • logger (Logger) –

    Python builtin Logger.

  • loglevel (int) –

    Logging level.

  • logdir (str | Path) –

    Path to directory storing logs.

  • verbose (bool) –

    Controls logging outputs.

get_sra(anno, fields)

Retrieve SRA IDs from the annotations if they exist.

Parameters:
  • anno (Annotations) –

    An Annotations curation containing samples and terms matching user-specified filters.

  • fields (list[str]) –

    SRA ID levels (i.e., srr, srx, srs, or srp)

Returns:
  • Annotations

    A new Annotations curation with merged SRA IDs.

save(anno, fmt, file, citation_config, metadata=None, **kwargs)

Save annotations curation to json. Keys are terms and values are positively annotated indices.

Parameters:
  • anno (Annotations) –

    A populated Annotations object.

  • fmt (Literal['json', 'parquet', 'csv', 'tsv']) –

    File format to save to.

  • file (FilePath) –

    Path to outfile.json.

  • citation_config (CitationConfig) –

    Parameters for saving citations.

  • metadata (str, default: None ) –

    Metadata fields to include.

to_csv(anno, file, citation_config, metadata=None, **kwargs)

Save annotations to csv.

Parameters:
  • anno (Annotations) –

    A populated Annotations object.

  • file (FilePath) –

    Path to outfile.csv.

  • metadata (str, default: None ) –

    Metadata fields to include.

to_json(anno, file, citation_config, metadata=None)

Save annotations curation to json. Keys are terms and values are positively annotated indices.

Parameters:
  • anno (Annotations) –

    A populated Annotations object.

  • file (FilePath) –

    Path to outfile.json.

  • metadata (str, default: None ) –

    Metadata fields to include.

to_numpy(anno)

Returns the annotation data as a numpy array.

to_parquet(anno, file, citation_config, metadata=None, **kwargs)

Save annotations to parquet.

Parameters:
  • anno (Annotations) –

    Annotations curation object to save.

  • file (FilePath) –

    Path to outfile.parquet.

  • metadata (str | None, default: None ) –

    Metadata fields to include.

to_tsv(anno, file, citation_config, metadata=None, **kwargs)

Save annotations to tsv.

Parameters:
  • anno (Annotations) –

    A populated Annotations object.

  • file (FilePath) –

    Path to outfile.tsv.

  • metadata (str, default: None ) –

    Metadata fields to include.