Skip to content

Commit

Permalink
Merge pull request #22 from iobio/yang_bam2_complete_info_dialogs
Browse files Browse the repository at this point in the history
Completed the info dialog
  • Loading branch information
anderspitman authored Nov 22, 2024
2 parents 87f38dc + 961e662 commit 8e8fec9
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 12 deletions.
81 changes: 70 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,22 @@
align-items: center;
justify-content: center;
}

.inline-container {
display: flex;
align-items: center;
}

iobio-percent-box.info-dialog-percent-box {
margin-right: 30px;
flex-shrink: 0;
width: 150px;
height: 150px;
}

span {
color: red;
}
</style>

</head>
Expand Down Expand Up @@ -131,7 +147,19 @@ <h1 id="home-button" data-link="/">bam2.iobio</h1>
<iobio-panel>
<iobio-label-info-button label="Mapped Reads">
<div slot="content">
<p>This is custom content for the Mapped Reads percent box.</p>
<p>The mapped reads chart shows how many of the reads in the sample were successfully mapped to the reference genome. Genetic variation, in particular structural variants, ensure that every sequenced sample is genetically different to the reference genome it was aligned to. If the sample differs only in a small number of single base pair changes (e.g. SNVs), the read will still likely map to the reference, but, for more significant variation, the read can fail to be placed. Therefore, it is not expected that the mapped reads rate will hit 100%, but it is expected to be high (usually >90%).</p>
<div class="inline-container">
<iobio-percent-box class="info-dialog-percent-box" data="[88866,267]"></iobio-percent-box>
<p>This is an example of a human, whole exome. In this case, 99.7% of the sampled reads map to the reference, corresponding to 88,666 actual reads. It is important to note that when the wheel is blue, only reads that have been assigned to a reference sequence are included. This means that the 0.3% of reads that are unmapped have a mate pair that successfully maps to the reference genome.</p>
</div>
<div class="inline-container">
<iobio-percent-box class="info-dialog-percent-box" data="[1108009142,8864073]" style="--data-color: rgb(9,176,135); --data-color-secondary: rgba(9,176,135,0.5);"></iobio-percent-box>
<p>For the case that both mates from paired end sequencing are unmapped, they appear at the end of the BAM file. Usually, the number of such unmapped reads can be obtained from the index file. When this is possible, the wheel will appear in green, as shown for this whole genome sample.</p>
</div>
<div class="inline-container">
<iobio-percent-box class="info-dialog-percent-box" data="[479405211,141424537]" style="--data-color: rgb(9,176,135); --data-color-secondary: rgba(9,176,135,0.5);"></iobio-percent-box>
<p>If the rate of mapped reads is low (usually below 90%), questions need to be asked about the sample to understand why so many reads are unmapped. The last example only has 77.2% of reads mapping to the reference genome for a whole genome sample. This was caused as the sample was contaminated with a significant amount of bacterial DNA; the DNA sample was obtained from a saliva sample, rather than a blood draw.</p>
</div>
</div>
</iobio-label-info-button>

Expand All @@ -141,7 +169,7 @@ <h1 id="home-button" data-link="/">bam2.iobio</h1>
<iobio-panel>
<iobio-label-info-button label="Forward Strands">
<div slot="content">
<p>This is custom content for the Forward Strands percent box.</p>
<p>The forward strand chart shows the fraction of reads that map to the forward DNA strand. The general expectation is that the DNA library preparation step will generate DNA from the forward and reverse strands in equal amounts. After mapping the reads to the reference genome, approximately 50% of the reads will consequently map to the forward strand. If the observed rate is significantly different to 50%, this may be indicative of problems with the library preparation step.</p>
</div>
</iobio-label-info-button>

Expand All @@ -151,7 +179,8 @@ <h1 id="home-button" data-link="/">bam2.iobio</h1>
<iobio-panel>
<iobio-label-info-button label="Proper Pairs">
<div slot="content">
<p>This is custom content for the Proper Pairs percent box.</p>
<p>A fragment consisting of two mates is called a proper pair if both mates map to the reference genome in a manner consistent with expectations. In particular, if the DNA library consists of fragments ~500 base pairs in length, and 100 base pair reads are sequenced from either end, the expectation would be that the two reads map to the reference genome separated by ~300 base pairs. If the sequenced sample contains large structural variants, e.g. a large insertion, reads mapping with a large separation would be a signal for this variant, and the reads would not be proper pairs. Based on the sequencing technology, there is also an expectation on the orientation of each read in the fragment.</p>
<p>When calculating the proper pair rate, pairs where both mates are unmapped are not included in the analysis. As a consequence, the rate of proper pairs is expected to be well over 90%; even if the mapping rate itself is low as a result of bacterial contamination, for example.</p>
</div>
</iobio-label-info-button>

Expand All @@ -161,7 +190,7 @@ <h1 id="home-button" data-link="/">bam2.iobio</h1>
<iobio-panel>
<iobio-label-info-button label="Singletons">
<div slot="content">
<p>This is custom content for the Singletons percent box.</p>
<p>When working with paired-end sequencing, each DNA fragment is sequenced from both ends, creating two mates for each pair. If one mate in the pair successfully maps to the reference genome, but the other is unmapped, the mapped mate is a singleton. One way in which a singleton could occur would be if the sample has a large insertion compared with the reference genome; one mate can fall in sequence flanking the insertion and will be mapped, but the other falls in the inserted sequence and so cannot map to the reference genome. There are unlikely to many such structural variants in the sample, or sequencing errors that would could cause a read to not be able to map. Consequently, the singleton rate is expected to be very low (<1%).</p>
</div>
</iobio-label-info-button>

Expand All @@ -171,7 +200,7 @@ <h1 id="home-button" data-link="/">bam2.iobio</h1>
<iobio-panel>
<iobio-label-info-button label="Both Mates Mapped">
<div slot="content">
<p>This is custom content for the Both Mates Mapped percent box.</p>
<p>When working with paired-end sequencing, each DNA fragment is sequenced from both ends, creating two mates for each pair. This chart shows the fraction of reads in pairs where both of the mates successfully map to the reference genome. When calculating this metric, pairs where both mates are unmapped are not included..</p>
</div>
</iobio-label-info-button>

Expand All @@ -181,7 +210,19 @@ <h1 id="home-button" data-link="/">bam2.iobio</h1>
<iobio-panel>
<iobio-label-info-button label="Duplicates">
<div slot="content">
<p>This is custom content for the Duplicates percent box.</p>
<p>PCR duplicates are two (or more) reads that originate from the same DNA fragment. When sequencing data is analysed, it is assumed that each observation (i.e. each read) is independent; an assumption that fails in the presence of duplicate reads. Typically, algorithms look for reads that map to the same genomic coordinate, and whose mates also map to identical genomic coordinates. It is important to note that as the sequencing depth increases, more reads are sampled from the DNA library, and consequently it is increasingly likely that duplicate reads will be sampled. As a result, the true duplicate rate is not independent of the depth, and they should both be considered when looking at the duplicate rate. Additionally, as the sequencing depth in increases, it is also increasingly likely that reads will map to the same location and be marked as duplicates, even when they are not. As such, as the sequencing depth approaches and surpasses the read length, the duplicate rate starts to become less indicative of problems.</p>
<div class="inline-container">
<iobio-percent-box class="info-dialog-percent-box" data="[2483,73425]"></iobio-percent-box>
<p>This is an example of the duplicate rate for a ~80X human whole genome. The expectation is that the duplicate rate is low (well below 10%), and consequently, this sample would be considered good.</p>
</div>
<div class="inline-container">
<iobio-percent-box class="info-dialog-percent-box" data="[401,100651]"></iobio-percent-box>
<p>If the median coverage drops to ~50X, the duplicate rate should be even lower.</p>
</div>
<div class="inline-container">
<iobio-percent-box class="info-dialog-percent-box" data="[54960,401167]"></iobio-percent-box>
<p>This is a different sample with ~50X coverage, but now the duplicate rate is much higher. This sample could well have problems at the library prep stage and should potentially be resequenced.</p>
</div>
</div>
</iobio-label-info-button>

Expand All @@ -194,7 +235,19 @@ <h1 id="home-button" data-link="/">bam2.iobio</h1>
<iobio-panel>
<iobio-label-info-button label="Read Coverage Distribution">
<div slot="content">
<p>This is custom content for the Read Coverage Distribution histogram.</p>
<p>This chart shows how read coverage is distributed, and the expected distribution is dependent on the type of sequencing data being visualized.</p>

<p>In a <span>Whole Genome Sequencing</span> experiment, the expectation is that the read coverage follows a Poisson distribution centred about the requested sequencing depth. The following example shows a high quality read coverage distribution for a sample sequenced to ~50X coverage. The distribution shows a nice Poisson distribution, and is centred around ~53X. (Note that the second scale at the bottom of the chart can be used to zoom in on desired parts of the distribution).</p>
<iobio-histogram data-url="https://s3.us-east-1.amazonaws.com/static.iobio.io/prod/bam.iobio.io/bam2.0/data-whole-genome.json"></iobio-histogram>

<p>Alternatively, if the distribution shows multiple peaks, isn't Poisson distributed, or is not centred around the expected coverage, it may be necessary to consider resequencing the sample, or at least, being aware that problems may arise in analysing the data. While the following distribution shows a median coverage around that expected (~80X), but with a significant portion of the genome at zero coverage and the multiple peaks, this would not be considered a good sample.</p>
<iobio-histogram data-url="https://s3.us-east-1.amazonaws.com/static.iobio.io/prod/bam.iobio.io/bam2.0/data-whole-genome-with-multiple-peaks.json"></iobio-histogram>

<p><span>Whole Exome Sequencing</span> relies on the targetted capture of DNA from the exome, followed by DNA amplification. This leads to large variation in the sequencing depth across exons, and consequently, the read coverage distribution is no longer expected to be Poisson distributed. When sampling across the entire genome, the majority of genomic regions will contain no sequencing reads as will are not exonic regions. This leads to a read coverage distribution overwhelmingly weighted to zero coverage as shown below.</p>
<iobio-histogram data-url="https://s3.us-east-1.amazonaws.com/static.iobio.io/prod/bam.iobio.io/bam2.0/data-exome.json"></iobio-histogram>

<p>To restrict sampling to exonic regions, select the default bed file in the top 'Exonic Regions'. It is also possible to select a custom bed file, if available. After selecting the default bed, the sequenced depth appears to be centred around ~50X, so if this is consistent with the requested depth, this sample would be considered good. The distribution above is updated to as shown below.</p>
<iobio-histogram data-url="https://s3.us-east-1.amazonaws.com/static.iobio.io/prod/bam.iobio.io/bam2.0/data-exome-with-bed.json"></iobio-histogram>
</div>
</iobio-label-info-button>

Expand All @@ -206,7 +259,13 @@ <h1 id="home-button" data-link="/">bam2.iobio</h1>
<iobio-tab slot="tab">
<iobio-label-info-button label="Fragment Length" icon-position="left" slot="tab-content">
<div slot="content">
<p>This is custom content for the Fragment Length histogram.</p>
<p>For paired end sequencing, DNA fragments are typically size selected to a uniform length and then sequenced from either end. Once the two mates are aligned back to the reference genome, the fragment length can be inferred from how far apart these two mates map. If the sequenced sample has a deletion or insertion relative to the reference, this will result in the two mates mapping closer together, or further apart than expected. Under the assumption that the sequenced sample has a relatively small number of insertions and deletions, we expect to see the fragment length follow a normal distribution.</p>

<p><span>Whole genome sequencing</span>, this is an example of the fragment length distribution for a high coverage (~80X) whole genome. The read lengths in this sample are 150bp, so a fragment can not be shorter than this value, consequently, we see a sharp cutoff at a fragment length of 150bp.</p>
<iobio-histogram data-url="https://s3.us-east-1.amazonaws.com/static.iobio.io/prod/bam.iobio.io/bam2.0/data-whole-genome-fragment-length.json"></iobio-histogram>

<p><span>Whole exome sequencing</span>, this is the fragment length distribution for a high coverage exome.</p>
<iobio-histogram data-url="https://s3.us-east-1.amazonaws.com/static.iobio.io/prod/bam.iobio.io/bam2.0/data-exome-fragment-length.json"></iobio-histogram>
</div>
</iobio-label-info-button>
</iobio-tab>
Expand All @@ -218,7 +277,7 @@ <h1 id="home-button" data-link="/">bam2.iobio</h1>
<iobio-tab slot="tab">
<iobio-label-info-button label="Read Length" slot="tab-content">
<div slot="content">
<p>This is custom content for the Read Length histogram.</p>
<p>The read length is usually a very simple distribution. In most cases, the read length is fixed at a uniform length, e.g. 100 base pairs, or 150 base pairs etc. The read length distribution, therefore, tends to be a single spike at this read length. Depending on the sequencing technology used, this may not always be the case.</p>
</div>
</iobio-label-info-button>
</iobio-tab>
Expand All @@ -233,7 +292,7 @@ <h1 id="home-button" data-link="/">bam2.iobio</h1>
<iobio-tab slot="tab">
<iobio-label-info-button label="Mapping Quality" icon-position="left" slot="tab-content">
<div slot="content">
<p>This is custom content for the Mapping Quality histogram.</p>
<p>The mapping quality distribution shows the Phred quality scores describing the probability that a read does not map to the location that it has been assigned to (specifically, Q=-log10(P), where Q is the Phred score and P is the probability the read is in the wrong location). So the larger the score, the higher the quality of the mapping. Some scores have specific meaning, e.g. a score of 0 means that the read could map equally to multiple places in the reference genome. The majority of reads should be well mapped and so we expect to see this distribution heavily skewed to large value (typically around 60). It is not unusual to see some scores around zero. Reads originating from repetitive elements in the genome will plausibly map to multiple locations.</p>
</div>
</iobio-label-info-button>
</iobio-tab>
Expand All @@ -245,7 +304,7 @@ <h1 id="home-button" data-link="/">bam2.iobio</h1>
<iobio-tab slot="tab">
<iobio-label-info-button label="Base Quality" slot="tab-content">
<div slot="content">
<p>This is custom content for the Base Quality histogram.</p>
<p>Similar to the mapping quality distribution, the base quality distribution shows the Phred quality scores describing the probability that a nucleotide has been incorrectly assigned; e.g. an error in the sequencing. Specifically, Q=-log10(P), where Q is the Phred score and P is the probability the nucleotide is wrong. The larger the score, the more confident we are in the base call. Depending on the sequencing technology, we can expect to see different distributions, but we expect to see a distribution skewed towards larger (more confident) scores; typically around 40.</p>
</div>
</iobio-label-info-button>
</iobio-tab>
Expand Down
2 changes: 1 addition & 1 deletion lib/iobio-charts

0 comments on commit 8e8fec9

Please sign in to comment.