Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ File type Conventional base calls
Encoding Illumina 1.5
Total Sequences 5
Total Bases 80 bp
Sequences flagged as poor quality 0
Sequence length 16
Mean Length 16.0
Median Length 16
%GC 50
>>END_MODULE
>>Per base sequence quality pass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,15 @@ <h2 id="M0"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYA
<td>80 bp</td>
</tr>
<tr>
<td>Sequences flagged as poor quality</td>
<td>0</td>
<td>Sequence length</td>
<td>16</td>
</tr>
<tr>
<td>Sequence length</td>
<td>Mean Length</td>
<td>16.0</td>
</tr>
<tr>
<td>Median Length</td>
<td>16</td>
</tr>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ File type Conventional base calls
Encoding Illumina 1.5
Total Sequences 1
Total Bases 16 bp
Sequences flagged as poor quality 0
Sequence length 16
Mean Length 16.0
Median Length 16
%GC 0
>>END_MODULE
>>Per base sequence quality pass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,15 @@ <h2 id="M0"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYA
<td>16 bp</td>
</tr>
<tr>
<td>Sequences flagged as poor quality</td>
<td>0</td>
<td>Sequence length</td>
<td>16</td>
</tr>
<tr>
<td>Sequence length</td>
<td>Mean Length</td>
<td>16.0</td>
</tr>
<tr>
<td>Median Length</td>
<td>16</td>
</tr>
<tr>
Expand Down
4 changes: 3 additions & 1 deletion uk/ac/babraham/FastQC/Modules/BasicStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.awt.BorderLayout;
import java.io.IOException;
import java.util.Locale;

import javax.swing.JLabel;
import javax.swing.JPanel;
Expand Down Expand Up @@ -249,7 +250,8 @@ public Object getValueAt(int rowIndex, int columnIndex) {
}

case 6 :
return ""+(totalBases/actualCount);
if (actualCount == 0) return "0.0";
return String.format(Locale.ROOT, "%.1f", (double)totalBases/actualCount);
case 7 :
if (lengthDist == null) {
return "NA";
Expand Down
36 changes: 22 additions & 14 deletions uk/ac/babraham/FastQC/Modules/SequenceLengthDistribution.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,29 +56,37 @@ public boolean ignoreInReport () {
}

public int medianLength() {
// We need to go through the data twice - once to get the
// total number of reads and the second time to find the
// length at the 50th percent rank

long total = 0;
for (int i=0;i<lengthCounts.length;i++) {
total += lengthCounts[i];
}

long rank50 = total/2;

if (total == 0) return 0;

// For an odd number of reads the median is the single central value.
// For an even number it's the mean of the two central values, rounded up.
if (total % 2 == 1) {
return lengthAtRank(total/2);
}
else {
long lo = lengthAtRank((total/2) - 1);
long hi = lengthAtRank(total/2);
return (int)((lo + hi + 1) / 2);
}
}

// Returns the length at the given zero-based rank in ascending order of length.
private int lengthAtRank(long rank) {
long runningCount = 0;
for (int i=0;i<lengthCounts.length;i++) {
if (runningCount + lengthCounts[i] > rank50) {
return(i);
}

runningCount += lengthCounts[i];
if (runningCount > rank) {
return i;
}
}

throw new RuntimeException("Should never fail to find a value above the 50th percentile");
}

throw new RuntimeException("Should never fail to find a value above the rank");
}

private synchronized void calculateDistribution () {
int maxLen = 0;
int minLen = -1;
Expand Down
Loading