Bases: BaseExporter

Exporter for Labels 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(labels, fields)

Retrieve SRA IDs from the annotations if they exist.

Parameters:
  • labels (Labels) –

    A Labels curation containing samples and terms matching user-specified filters.

  • fields (list[str]) –

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

Returns:
  • Labels

    A new Annotations curation with merged SRA IDs.

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

Save labels curation to json. Keys are terms and values are positively, negative, netral, and control labeled entries.

Parameters:
  • labels (Labels) –

    A populated Labels curation 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(curation, file, citation_config, metadata=None, **kwargs)

Save labels to csv.

Parameters:
  • curation (Labels) –

    A populated Labels curation object.

  • file (FilePath) –

    Path to outfile.csv.

  • metadata (str, default: None ) –

    Metadata fields to include.

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

Save labels curation to json. Keys are terms and values are positively labelstated indices.

Parameters:
  • curation (Labels) –

    A populated Labels curation object.

  • file (FilePath) –

    Path to outfile.json.

  • metadata (str, default: None ) –

    Metadata fields to include.

to_numpy(curation)

Returns the labelstation data as a numpy array.

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

Save labels to parquet.

Parameters:
  • curation (Labels) –

    Labels curation object to save.

  • file (FilePath) –

    Path to outfile.parquet.

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

    Metadata fields to include.

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

Save labels to tsv.

Parameters:
  • curation (Labels) –

    A populated Labels curation object.

  • file (FilePath) –

    Path to outfile.tsv.

  • metadata (str, default: None ) –

    Metadata fields to include.