Metamist¶
Helpers to communicate with the metamist
database.
cpg_flow.metamist.get_metamist
¶
get_metamist()
Return the cohort object
Source code in src/cpg_flow/metamist.py
131 132 133 134 135 136 |
|
cpg_flow.metamist.Metamist
¶
Metamist()
Communication with metamist.
Source code in src/cpg_flow/metamist.py
246 247 248 |
|
make_retry_aapi_call
¶
make_retry_aapi_call(api_func, **kwargv)
Make a generic API call to self.aapi with retries. Retry only if ServiceException is thrown
TODO: How many retries? e.g. try 3 times, wait 2^3: 8, 16, 24 seconds
Source code in src/cpg_flow/metamist.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
|
make_aapi_call
¶
make_aapi_call(api_func, **kwargv)
Make a generic API call to self.aapi. This is a wrapper around retry of API call to handle exceptions and LOGGER.
Source code in src/cpg_flow/metamist.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
|
get_sg_entries
¶
get_sg_entries(dataset_name)
Retrieve sequencing group entries for a dataset, in the context of access level and filtering options.
Source code in src/cpg_flow/metamist.py
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 |
|
update_analysis
¶
update_analysis(analysis, status)
Update "status" of an Analysis entry.
Source code in src/cpg_flow/metamist.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
|
get_analyses_by_sgid
¶
get_analyses_by_sgid(
analysis_type, analysis_status=COMPLETED, dataset=None
)
Query the DB to find the last completed analysis for the type, sequencing group ids, and sequencing type, one Analysis object per sequencing group. Assumes the analysis is defined for a single sequencing group (that is, analysis_type=cram|gvcf|qc).
Source code in src/cpg_flow/metamist.py
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 |
|
create_analysis
¶
create_analysis(
output,
type_,
status,
cohort_ids=None,
sequencing_group_ids=None,
dataset=None,
meta=None,
)
Tries to create an Analysis entry, returns its id if successful.
Source code in src/cpg_flow/metamist.py
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
|
get_ped_entries
¶
get_ped_entries(dataset=None)
Retrieve PED lines for a specified SM project, with external participant IDs.
Source code in src/cpg_flow/metamist.py
434 435 436 437 438 439 440 441 442 443 |
|
get_metamist_proj
¶
get_metamist_proj(dataset=None)
Return the Metamist project name, appending '-test' if the access level is 'test'.
Source code in src/cpg_flow/metamist.py
445 446 447 448 449 450 451 452 453 |
|
cpg_flow.metamist.AnalysisStatus
¶
Bases: Enum
Corresponds to metamist Analysis statuses: https://github.com/populationgenomics/sample-metadata/blob/dev/models/enums/analysis.py#L14-L21
parse
staticmethod
¶
parse(name)
Parse str and create a AnalysisStatus object
Source code in src/cpg_flow/metamist.py
157 158 159 160 161 162 |
|
cpg_flow.metamist.AnalysisType
¶
Bases: Enum
Corresponds to metamist Analysis types: https://github.com/populationgenomics/sample-metadata/blob/dev/models/enums /analysis.py#L4-L11
Re-defined in a separate module to decouple from the main metamist module,
so decorators can use @stage(analysis_type=AnalysisType.QC)
without importing
the metamist package.
parse
staticmethod
¶
parse(val)
Parse str and create a AnalysisStatus object
Source code in src/cpg_flow/metamist.py
185 186 187 188 189 190 191 192 193 194 195 |
|
cpg_flow.metamist.Analysis
dataclass
¶
Analysis(
id, type, status, sequencing_group_ids, output, meta
)
Metamist DB Analysis entry.
See the metamist package for more details: https://github.com/populationgenomics/sample-metadata
parse
staticmethod
¶
parse(data)
Parse data to create an Analysis object.
Source code in src/cpg_flow/metamist.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
|
cpg_flow.metamist.Assay
dataclass
¶
Assay(
id,
sequencing_group_id,
meta,
assay_type,
alignment_input=None,
)
Metamist "Assay" entry.
See metamist for more details: https://github.com/populationgenomics/sample-metadata
parse
staticmethod
¶
parse(
data, sg_id, check_existence=False, run_parse_reads=True
)
Create from a dictionary.
Source code in src/cpg_flow/metamist.py
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 |
|
cpg_flow.metamist.get_cohort_sgs
¶
get_cohort_sgs(cohort_id)
Retrieve sequencing group entries for a single cohort.
Source code in src/cpg_flow/metamist.py
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 |
|
cpg_flow.metamist.parse_reads
¶
parse_reads(
sequencing_group_id, assay_meta, check_existence
)
Parse a AlignmentInput object from the meta dictionary.
check_existence
: check if fastq/crams exist on buckets.
Default value is pulled from self.metamist and can be overridden.
Source code in src/cpg_flow/metamist.py
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 |
|