structboost.write_encoder_weights¶
- structboost.write_encoder_weights(weights, path, *, gene_ids=None, gene_symbols=None, metadata=None, drop_zero_rows=False, format=None)[source]¶
Write an encoder weight matrix with its gene identifiers.
- Parameters:
weights (NDArray[np.floating] | pd.DataFrame) – Array of shape
(n_genes, latent_dim), or a DataFrame indexed by gene identifier whose remaining columns are the latent dimensions.path (str | Path) – Destination. Format is inferred from the suffix unless
formatis given.gene_ids (object | None) – Ensembl accessions, length
n_genes. The join key on read.gene_symbols (object | None) – Gene symbols, length
n_genes. Carried as a label only.metadata (dict[str, Any] | None) – Provenance recorded with the matrix.
structboost_versionandlatent_dimare filled in automatically. Callers should add the species and annotation release: without the release the Ensembl accessions are only probably joinable to another dataset.drop_zero_rows (bool) – Omit genes whose weights are zero in every dimension. Safe for the coverage guard (a zero weight contributes nothing to either side of the ratio), but the file then no longer distinguishes the reference panel from the reference support, so the full panel is stored in the metadata.
format (str | None) –
"parquet"or"text". Inferred from the suffix when omitted.
- Returns:
The path written.
- Return type:
Path