-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9cf6fed
commit 2df4fc5
Showing
3 changed files
with
66 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,4 @@ obj/ | |
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
|
||
results.json | ||
|
||
*.gz | ||
*.bam | ||
tmp/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
|
||
namespace Ovation.FasterQC.Net | ||
{ | ||
public class AlignmentStatistics : IQcModule | ||
{ | ||
private ulong sequenceCount; | ||
|
||
private ulong paired; | ||
|
||
private ulong aligned; | ||
|
||
private ulong segmentUnmapped; | ||
|
||
private ulong nextSegmentUnmapped; | ||
|
||
private ulong reverseComplemented; | ||
|
||
private ulong nextSegmenteverseComplemented; | ||
|
||
private ulong nonPrimaryAlignment; | ||
|
||
private ulong failedQualityChecks; | ||
|
||
private ulong opticalDuplicate; | ||
|
||
public string Name => "alignmentStatistics"; | ||
|
||
public string Description => "Calculates alignment statistics for SAM/BAM files"; | ||
|
||
public void ProcessSequence(Sequence sequence) | ||
{ | ||
sequenceCount++; | ||
|
||
if ((sequence.ReadFlag & ReadFlag.Paired) != 0) paired++; | ||
if ((sequence.ReadFlag & ReadFlag.Aligned) != 0) aligned++; | ||
if ((sequence.ReadFlag & ReadFlag.SegmentUnmapped) != 0) segmentUnmapped++; | ||
if ((sequence.ReadFlag & ReadFlag.NextSegmentUnmapped) != 0) nextSegmentUnmapped++; | ||
if ((sequence.ReadFlag & ReadFlag.ReverseComplemented) != 0) reverseComplemented++; | ||
if ((sequence.ReadFlag & ReadFlag.NextSegmentReverseComplemented) != 0) nextSegmenteverseComplemented++; | ||
if ((sequence.ReadFlag & ReadFlag.NotPrimaryAlignment) != 0) nonPrimaryAlignment++; | ||
if ((sequence.ReadFlag & ReadFlag.FailedQualityChecks) != 0) failedQualityChecks++; | ||
if ((sequence.ReadFlag & ReadFlag.OpticalDuplicate) != 0) opticalDuplicate++; | ||
} | ||
|
||
public void Reset() | ||
{ | ||
sequenceCount = 0; | ||
} | ||
|
||
public object Data => new | ||
{ | ||
sequenceCount, | ||
paired, | ||
aligned, | ||
segmentUnmapped, | ||
nextSegmentUnmapped, | ||
reverseComplemented, | ||
nextSegmenteverseComplemented, | ||
nonPrimaryAlignment, | ||
failedQualityChecks, | ||
opticalDuplicate | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters