fasta_lake.multi_omics.sources#
fasta_lake.multi_omics.sources
#
Portable specimen-qualified DNA/RNA and optional metabolite inputs.
MolecularSource
dataclass
#
Verified specimen inputs and their gene-level relationships.
genes retains parsed DNA/RNA values and original TPM text. proteins
maps gene IDs to (header, normalized sequence, exact-sequence SHA256).
available is their intersection; coverage retains the excluded genes.
Optional annotations, compounds and direct reaction links remain separate.
Source code in fasta_lake/multi_omics/sources.py
table_rows
#
Yield string-valued rows from plain/gzipped TSV with a complete unique header.
required names mandatory columns. Malformed rows raise ValueError; numeric
conversion and missing-value interpretation belong to the calling parser.
Source code in fasta_lake/multi_omics/sources.py
load_reference
#
Load a v1/v2 source.json and verify its pinned files and reference contract.
Relative input paths resolve beside the manifest. Complete scope requires matching TPM/protein gene populations; explicitly available scope retains exclusions for coverage reporting. Return a MolecularSource; reject changed files, inconsistent sequences or unsupported schemas before selection. Provider records supply biological specimen provenance.
Source code in fasta_lake/multi_omics/sources.py
write_coverage
#
Write missing-gene and measurement coverage to a caller-owned output directory.
Preserve original TPM values for genes without sequences, and separately report proteins without TPM rows. This function does not select candidates. Callers create a fresh directory before writing these three report files.
Source code in fasta_lake/multi_omics/sources.py
prepare_source
#
prepare_source(output, *, specimen, reference_id, tpm, proteins, provenance, reference_scope='complete', alternate_proteins=None, annotations=None, metabolites=None, compound_links=None)
Package checked specimen-matched molecular inputs for portable reuse.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output
|
path - like
|
New source directory; existing output is rejected. |
required |
specimen
|
str
|
Explicit biological specimen and shared gene-reference identifiers. |
required |
reference_id
|
str
|
Explicit biological specimen and shared gene-reference identifiers. |
required |
tpm
|
path - like
|
Gene TPM table, encoded-protein FASTA and provider linkage record. |
required |
proteins
|
path - like
|
Gene TPM table, encoded-protein FASTA and provider linkage record. |
required |
provenance
|
path - like
|
Gene TPM table, encoded-protein FASTA and provider linkage record. |
required |
reference_scope
|
('complete', 'available')
|
Complete requires matching TPM/protein gene sets. Available retains exclusions for a deliberately incomplete sequence reference. |
"complete"
|
alternate_proteins
|
path - like or None
|
Optional second FASTA for validating shared gene sequences. |
None
|
annotations
|
path - like or None
|
Optional gene annotations, measured compounds and reaction/KO links. |
None
|
metabolites
|
path - like or None
|
Optional gene annotations, measured compounds and reaction/KO links. |
None
|
compound_links
|
path - like or None
|
Optional gene annotations, measured compounds and reaction/KO links. |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Path to the written source manifest and sequence/measurement coverage counts. |
Notes
Input consistency is checked before packaging. Provider records establish specimen provenance; filenames alone do not. Missing TPM is retained as missing, separately from genes whose protein sequence is unavailable.
Source code in fasta_lake/multi_omics/sources.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | |
write_reference
#
Write every available exact sequence, including genes with zero/missing TPM.