fasta_lake.study#
fasta_lake.study
#
Group accepted study peptides and assign LFQ features directly by peptide.
The greedy cover follows the reviewed publication procedure. A representative labels a group and explains its assigned peptides; it is not proof of their unique biological origin. Pre-search selection and search confidence are unchanged.
canonical_peptide
#
Remove Sage modifications and use the declared I/L equivalence.
Sage writes residue mods in brackets (PEPT[+15.9949]LDEK) and N-terminal
mods as a bracket followed by - ([+42.0106]-PEPTLDEK); both go.
Source code in fasta_lake/study.py
member_set_key
#
Preserve the full distinct accession membership, without source-tag stripping.
greedy_set_cover
#
Choose study representatives by maximum uncovered peptide gain.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
protein_peptides
|
dict[str, set[str]]
|
Observed canonical peptides for each compatible protein accession. |
required |
Returns:
| Type | Description |
|---|---|
tuple
|
Selection-ordered (accession, newly covered peptide count) pairs and the set of covered peptides. Equal gains resolve by lexical accession. |
Notes
Gains are recalculated as evidence is covered. This is post-search reporting, distinct from pre-search razor's fixed evidence counts. Greedy cover does not guarantee the smallest possible protein set; inputs are not modified.
Source code in fasta_lake/study.py
study_dictionary
#
Assign accepted peptides to a fixed set of study representatives.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
protein_peptides
|
dict[str, set[str]]
|
Accepted canonical peptides associated with observed target accessions. |
required |
searched
|
set[str]
|
Accessions in the union of FASTAs actually searched for the study. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Selected representatives, covered peptides, selection ranks, peptide_to_group assignments and unobserved searched accessions. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If an observed accession is outside the searched universe. |
Notes
Each peptide belongs to the first selected representative explaining it. A protein may be compatible with peptides assigned to several groups. This function checks graph membership; group_searches additionally verifies peptide containment in the actual representative sequences.
Source code in fasta_lake/study.py
group_searches
#
group_searches(search_root: str | Path, output: str | Path, q_threshold: float = 0.01, *, config_name: str = 'config.json', acquisition_names: list[str] | None = None) -> dict
Build study groups and sum quantities from completed acquisition searches.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
search_root
|
str or Path
|
Directory containing one completed Sage search subdirectory per acquisition. Each contains a configuration, results.sage.tsv and single-acquisition lfq.tsv. |
required |
output
|
str or Path
|
New directory outside search_root. Existing paths are refused. |
required |
q_threshold
|
float
|
Inclusive target peptide-q threshold in (0, 1], applied within each search. |
0.01
|
config_name
|
('config.json', 'results.json')
|
Filename recording the exact searched FASTA and one mzML path. |
"config.json"
|
acquisition_names
|
list[str] or None
|
Explicit acquisition directory names. None uses all direct subdirectories; the final roster is sorted and must contain unique, nonempty names. |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
The exported summary: roster, grouping rule, counts, intensity accounting and checks. Tables, representatives, peptide evidence and input hashes are written beside summary.json. |
Raises:
| Type | Description |
|---|---|
ValueError
|
For inconsistent acquisitions, malformed evidence, accession/sequence conflicts, invalid confidence settings or incompatible representatives. |
FileExistsError
|
If the requested output already exists. |
Notes
Greedy cover uses only accepted evidence and actually searched proteins. Positive finite LFQ features require an accepted peptide in that acquisition. Each feature is assigned once; missing cells stay blank. Local members and representative presence are retained separately. This adds no study-wide or protein-group FDR estimate. Invalid inputs leave no completed bundle.
Source code in fasta_lake/study.py
226 227 228 229 230 231 232 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 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | |