# Fraction of reads mapping to the human genome

![](https://2763969089-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M52gq1rRSDQOKMQGEuR%2F-M9Z39Nd7c6cJRknLQBm%2F-M9Z5UXTJ3K-CHa7LXJU%2FScreen%20Shot%202020-06-11%20at%2011.57.37%20AM.png?alt=media\&token=ed53ecc9-7372-4e64-9385-4c3f368fce48)

#### **Theoretical Method**

This metric is obtained by iterating through the bam file, and looking at the sam flag which indicates whether each read has an adequate mapping to the HG19 reference.

#### **Technical Methods**

Waltz uses a method from the [SAMRecord Class](https://www.javadoc.io/doc/com.github.samtools/htsjdk/1.133/htsjdk/samtools/SAMRecord.html) of the HTSJDK library:

```
SAMRecord.getReadUnmappedFlag()
```

{% hint style="info" %}
Note: This method is distinct from `getProperPairFlag(),`which will only consider reads which are mapped in a proper pair.
{% endhint %}

* Tool Used
  * waltz.jar CountReads
  * Aggregate\_bam\_metrics.sh
  * tables\_module.py (TotalMapped / TotalReads)
  * plots\_module.r
* Input
  * Standard Bam (tables also produced for U / S / D bams)
* Output
  * Text file with read count information: “sample\_id.bam.read-counts.txt”&#x20;

#### **Interpretations**

Mapping fraction to the human genome should be above 97%, in most cases if it is below that, there is a chance that there is contamination from another species. <br>

{% hint style="info" %}
Note: this metric come from the standard bam, and is calculated across the entire bam file (as opposed to pool A or pool B on their own)
{% endhint %}
