Skip to content
代码片段 群组 项目
提交 801dbf15 编辑于 作者: Michael Gatzen's avatar Michael Gatzen
浏览文件

Merged bugfix

无相关合并请求
......@@ -129,7 +129,7 @@ public class CollectSamErrorMetrics extends CommandLineProgram {
"ERROR:INSERT_LENGTH",
"ERROR:GC_CONTENT",
"ERROR:READ_DIRECTION",
"ERROR:PAIR_ORIENTATION",
// "ERROR:PAIR_ORIENTATION",
"ERROR:HOMOPOLYMER",
"ERROR:BINNED_HOMOPOLYMER",
"ERROR:CYCLE",
......@@ -339,8 +339,8 @@ public class CollectSamErrorMetrics extends CommandLineProgram {
nTotalLoci++;
// while there is a next (non-filtered) variant and it is before the locus, advance the pointer.
if (checkLocus(vcfFileReader, info.getLocus(), sequenceDictionary)) {
log.debug("Locus does not overlap any variants: " + locusToInterval(info.getLocus(), sequenceDictionary));
if (checkLocus(vcfFileReader, info.getLocus())) {
log.debug("Locus does not overlap any variants: " + info.getLocus(), sequenceDictionary);
nSkippedLoci++;
continue;
}
......@@ -434,18 +434,16 @@ public class CollectSamErrorMetrics extends CommandLineProgram {
* HAS SIDE EFFECTS!!! Queries the vcfFileReader
*
* @param vcfFileReader a {@link VCFFileReader} to query for the given locus
* @param locus a {@link Locus} at which to examine the variants
* @param sequenceDictionary a dictionary with which to compare the Locatable to the Locus...
* @param locusInfo a {@link SamLocusIterator.LocusInfo} at which to examine the variants
* @return true if there's a variant over the locus, false otherwise.
*/
private static boolean checkLocus(final VCFFileReader vcfFileReader, final Locus locus, final SAMSequenceDictionary sequenceDictionary) {
private static boolean checkLocus(final VCFFileReader vcfFileReader, final SamLocusIterator.LocusInfo locusInfo) {
boolean overlaps = false;
final Interval queryInterval = locusToInterval(locus, sequenceDictionary);
if (queryInterval != null) {
if (locusInfo != null) {
try (final CloseableIterator<VariantContext> vcfIterator = vcfFileReader.query(queryInterval)) {
try (final CloseableIterator<VariantContext> vcfIterator = vcfFileReader.query(locusInfo)) {
overlaps = true;
......@@ -468,22 +466,6 @@ public class CollectSamErrorMetrics extends CommandLineProgram {
return overlaps;
}
/**
* Converts the given locus into an interval using the given sequenceDictionary.
*
* @param locus The {@link Locus} to convert.
* @param sequenceDictionary The {@link SAMSequenceDictionary} to use to convert the given {@code locus}.
* @return An {@link Interval} representing the given {@code locus} or {@code null} if it cannot be converted.
*/
private static Interval locusToInterval(final Locus locus, final SAMSequenceDictionary sequenceDictionary) {
final SAMSequenceRecord samSequenceRecord = sequenceDictionary.getSequence(locus.getSequenceIndex());
if (samSequenceRecord == null) {
return null;
}
return new Interval(samSequenceRecord.getSequenceName(), locus.getPosition(), locus.getPosition());
}
/**
* Map of previously seen deletion records, associated with the locus they have been last seen
*/
......@@ -697,7 +679,10 @@ public class CollectSamErrorMetrics extends CommandLineProgram {
*/
private void readFiltersFromFiles() {
for (final File filterFile : FILTERS) {
samErrorReadFilters.add(SamErrorReadFilter.fromFile(filterFile));
final SamErrorReadFilter filter = SamErrorReadFilter.fromFile(filterFile);
if (filter != null) {
samErrorReadFilters.add(filter);
}
}
}
......
......@@ -43,7 +43,7 @@ public class IndelErrorMetric extends BaseErrorMetric {
public long NUM_INSERTED_BASES = 0;
/**
* The (phred) rate of insertions. TODO mgatzen Does this make sense?
* The (phred) rate of insertions.
*/
@NoMergingIsDerived
public int INSERTS_Q = 0;
......@@ -61,7 +61,7 @@ public class IndelErrorMetric extends BaseErrorMetric {
public long NUM_DELETED_BASES = 0;
/**
* The (phred) rate of deletions. TODO mgatzen Does this make sense?
* The (phred) rate of deletions.
*/
@NoMergingIsDerived
public int DELETIONS_Q = 0;
......
......@@ -1249,12 +1249,10 @@ public class ReadBaseStratification {
return null;
}
if (operation == CollectSamErrorMetrics.BaseOperation.Insertion && cigarElement.getOperator() != CigarOperator.I) {
log.warn("Wrong CIGAR operator for the given position. This is an error and should be fixed.");
return null;
throw new IllegalStateException("Wrong CIGAR operator for the given position.");
}
if (operation == CollectSamErrorMetrics.BaseOperation.Deletion && cigarElement.getOperator() != CigarOperator.D) {
log.warn("Wrong CIGAR operator for the given position. This is an error and should be fixed.");
return null;
throw new IllegalStateException("Wrong CIGAR operator for the given position.");
}
return cigarElement.getLength();
}
......
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册