pegasus.write_output

pegasus.write_output(data, output_file, whitelist=['obs', 'obsm', 'uns', 'var', 'varm'])[source]

Write data back to disk.

This function is used to write data back to disk.

Parameters
  • data (MemData or AnnData) – data to write back, can be either an MemData or AnnData object.

  • output_file (str) – output file name. If data is MemData, output_file should ends with suffix ‘.h5sc’. Otherwise, output_file can end with either ‘.h5ad’, ‘.loom’, or ‘.mtx.gz’. If output_file ends with ‘.loom’, a LOOM file will be generated. If no suffix is detected, an appropriate one will be appended.

  • whitelist (list, optional, default = [“obs”, “obsm”, “uns”, “var”, “varm”]) – List that indicates changed fields when writing h5ad file in backed mode. For example, [‘uns/Groups’, ‘obsm/PCA’] will only write Groups in uns, and PCA in obsm; the rest of the fields will be unchanged.

Returns

Return type

None

Examples

>>> pg.write_output(adata, 'test.h5ad')