Skip to main content

qc-metric-aggregator

Build Status

Parse individual metrics out of a directory of QC results for genomic data and output a report containing the desired metrics and the overall PASS/FAIL status of the sample.

Installation


pip install qc-metric-aggregator


Usage


usage: aggregate-qc-metrics [-h]
                            sample_name metrics_dir output_file threshold_file

positional arguments:
  sample_name     The sample name or id for which the QC metrics apply
  metrics_dir     The directory to search for metric files, often a cromwell
                  run directory
  output_file     File path to store the finalized mertrics TSV
  threshold_file  Path to the yml thresholds file to validate against

optional arguments:
  -h, --help      show this help message and exit

Example invocation:

aggregate-qc-metrics HG00096 /opt/qc/results/HG00096/WholeGenomeSingleSampleQc /opt/qc/scores/qc_results.tsv thresholds.yml

Output formats

Coming soon...


Threshold file

You will need to pass in a YAML file containing pass/fail threshold tests for the metrics you are interested in. The file format consists of a list of objects each containing the following keys:

Key Value Comments
metric_name Name of the metric to check This can be any supported metric and should be the value returned by name.
operator Which operation to use to compare the metric value to the PASS/FAIL threshold <,<=,>,>=, and = are all supported. If you instead specify report the metric will be reported in the final output, but not factored into the PASS/FAIL status.
value The PASS/FAIL threshold to compare the metric value to This field is optional if report is specified for the operator.

An example can be found here


Supported Metrics

Name Description Originating Tool
FREEMIX Freemix VerifyBamId2
Q20_BASES Total bases with Q20 or higher Picard CollectQualityYieldMetrics
MEAN_COVERAGE Haploid Coverage Picard CollectWgsMetrics
PCT_10X Percent coverage at 10x Picard CollectWgsMetrics
PCT_20X Percent coverage at 20x Picard CollectWgsMetrics
PCT_30X Percent coverage at 30x Picard CollectWgsMetrics
PCT_CHIMERAS Percent chimeras (PAIR) Picard CollectAlignmentSummaryMetrics
READ1_PF_MISMATCH_RATE Read 1 base mismatch rate Picard CollectAlignmentSummaryMetrics
READ2_PF_MISMATCH_RATE Read 2 base mismatch rate Picard CollectAlignmentSummaryMetrics
MEDIAN_INSERT_SIZE Library insert size median Picard CollectInsertSizeMetrics
MEDIAN_ABSOLUTE_DEVIATION Library insert size mad Picard CollectInsertSizeMetrics
PERCENT_DUPLICATION Percent duplicate marked reads Picard CollectDuplicateMetrics
MEAN_TARGET_COVERAGE The mean coverage of a target region. Picard CollectHsMetrics
PCT_TARGET_BASES_10X The fraction of all target bases achieving 10X or greater coverage Picard CollectHsMetrics
PCT_TARGET_BASES_20X The fraction of all target bases achieving 20X or greater coverage Picard CollectHsMetrics
PCT_TARGET_BASES_30X The fraction of all target bases achieving 30X or greater coverage Picard CollectHsMetrics

Adding Additional Metrics

To add support for additional metrics you simply need to subclass Metric and register it in AvailableMetrics

Because many QC metrics are output in TSV format, there is a helper class TSVMetric that you can inherent from in addition to Metric that will make that easier. All of the currently supported metrics use this helper, so you should be able to look to them for examples.

Metadata

Release files for qc-metric-aggregator 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qc-metric-aggregator 0.1.5
File Size Uploaded
qc-metric-aggregator-0.1.5.tar.gz 9.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qc-metric-aggregator 0.1.5
File Interpreter ABI Platform
qc_metric_aggregator-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 27.4 kB

Release files / qc-metric-aggregator-0.1.5.tar.gz

Download URL qc-metric-aggregator-0.1.5.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3da22cf29af9edce38902503cad769baf3ff3e2299a945aaa9c97568e214832b
BLAKE2b-256 checksum
How to use checksums
4e2d490614c083c511e4da56b12319b0b24ecbf5389da50b46d0305505617ffc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

Release files / qc_metric_aggregator-0.1.5-py3-none-any.whl

Download URL qc_metric_aggregator-0.1.5-py3-none-any.whl
Size 17.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dbd6042e65855e142f6843be59e073e64f062d5ba104b68bb3a51f18b2a11942
BLAKE2b-256 checksum
How to use checksums
c60778da01baeb377442dc2776cd2985b51268818a0f83a99ab979063286e0a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page