Skip to content

Commit

Permalink
Improvements and refactoring of Nucleotide.java
Browse files Browse the repository at this point in the history
  • Loading branch information
vruano committed Jun 1, 2018
1 parent 3189612 commit ec7029d
Show file tree
Hide file tree
Showing 7 changed files with 566 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,6 @@ public Object onTraversalSuccess() {
@Override
public void apply(AlignmentContext alignmentContext, ReferenceContext referenceContext, FeatureContext featureContext) {
final byte refAsByte = referenceContext.getBase();
allelicCountCollector.collectAtLocus(Nucleotide.valueOf(refAsByte), alignmentContext.getBasePileup(), alignmentContext.getLocation(), minimumBaseQuality);
allelicCountCollector.collectAtLocus(Nucleotide.decode(refAsByte), alignmentContext.getBasePileup(), alignmentContext.getLocation(), minimumBaseQuality);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private static IntervalList generateBins(final IntervalList preparedIntervalList
private static IntervalList filterBinsContainingOnlyNs(final IntervalList unfilteredBins, final ReferenceDataSource reference) {
final IntervalList bins = new IntervalList(reference.getSequenceDictionary());
for (final Interval unfilteredBin : unfilteredBins) {
if (!Utils.stream(reference.query(new SimpleInterval(unfilteredBin))).allMatch(b -> b == Nucleotide.N.toBase())) {
if (!Utils.stream(reference.query(new SimpleInterval(unfilteredBin))).allMatch(b -> Nucleotide.decode(b) == Nucleotide.N)) {
bins.add(unfilteredBin);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ enum AllelicCountTableColumn {
final int position = dataLine.getInt(AllelicCountTableColumn.POSITION);
final int refReadCount = dataLine.getInt(AllelicCountTableColumn.REF_COUNT);
final int altReadCount = dataLine.getInt(AllelicCountTableColumn.ALT_COUNT);
final Nucleotide refNucleotide = Nucleotide.valueOf(dataLine.get(AllelicCountTableColumn.REF_NUCLEOTIDE.name()).getBytes()[0]);
final Nucleotide altNucleotide = Nucleotide.valueOf(dataLine.get(AllelicCountTableColumn.ALT_NUCLEOTIDE.name()).getBytes()[0]);
final Nucleotide refNucleotide = Nucleotide.decode(dataLine.get(AllelicCountTableColumn.REF_NUCLEOTIDE.name()).charAt(0));
final Nucleotide altNucleotide = Nucleotide.decode(dataLine.get(AllelicCountTableColumn.ALT_NUCLEOTIDE.name()).charAt(0));
final SimpleInterval interval = new SimpleInterval(contig, position, position);
return new AllelicCount(interval, refReadCount, altReadCount, refNucleotide, altNucleotide);
};
Expand Down
Loading

0 comments on commit ec7029d

Please sign in to comment.