Skip to content

Commit

Permalink
Square with David's fix and more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ldgauthier committed Sep 18, 2019
1 parent 0a7c7d3 commit 9f935c0
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public final class RMSMappingQuality extends InfoFieldAnnotation implements Stan
@Override
public List<String> getRawKeyNames() { return Arrays.asList(GATKVCFConstants.RAW_MAPPING_QUALITY_WITH_DEPTH_KEY);} //new key for the two-value MQ data to prevent version mismatch catastrophes

public static String getDeprecatedRawKeyName() { return GATKVCFConstants.RAW_RMS_MAPPING_QUALITY_KEY;} //new key for the two-value MQ data to prevent version mismatch catastrophes
public static String getDeprecatedRawKeyName() { return GATKVCFConstants.RAW_RMS_MAPPING_QUALITY_KEY;} //old key that used the janky depth estimation method

@Override
public List<String> getKeyNames() {
Expand Down Expand Up @@ -135,7 +135,7 @@ public Map<String, Object> finalizeRawData(final VariantContext vc, final Varian
else if (vc.hasAttribute(getDeprecatedRawKeyName())) {
if (!allowOlderRawKeyValues) {
throw new UserException.BadInput("Presence of '-"+getDeprecatedRawKeyName()+"' annotation is detected. This GATK version expects key "
+ getRawKeyNames() + " with a tuple of sum of squared MQ values and total reads over variant "
+ getRawKeyNames().get(0) + " with a tuple of sum of squared MQ values and total reads over variant "
+ "genotypes as the value. This could indicate that the provided input was produced with an older version of GATK. " +
"Use the argument '--"+RMS_MAPPING_QUALITY_OLD_BEHAVIOR_OVERRIDE_ARGUMENT+"' to override and attempt the deprecated MQ calculation. There " +
"may be differences in how newer GATK versions calculate DP and MQ that may result in worse MQ results. Use at your own risk.");
Expand All @@ -155,7 +155,7 @@ else if (vc.hasAttribute(getDeprecatedRawKeyName())) {
}
else {
logger.warn("MQ annotation data is not properly formatted. This GATK version expects key "
+ getRawKeyNames() + " with a tuple of sum of squared MQ values and total reads over variant "
+ getRawKeyNames().get(0) + " with a tuple of sum of squared MQ values and total reads over variant "
+ "genotypes as the value. Attempting to use deprecated MQ calculation.");
final long numOfReads = getNumOfReads(vc, null);
rawMQdata = Math.round(Double.parseDouble(rawMQdata)) + "," + numOfReads; //deprecated format was double so it needs to be converted to long
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public Map<String, Object> combineAnnotations(final List<Allele> allelesList, Ma
final List<ReducibleAnnotationData<?>> annotationValue = (List<ReducibleAnnotationData<?>>) annotationMap.get(currentASannotation.getRawKeyNames().get(0));
final Map<String, Object> annotationsFromCurrentType = currentASannotation.combineRawData(allelesList, annotationValue);
combinedAnnotations.putAll(annotationsFromCurrentType);
//remove the combined annotations so that the next method only processes the non-reducible ones
//remove all the raw keys for the annotation because we already used all of them in combineRawData
for (final String rk : currentASannotation.getRawKeyNames()) {
annotationMap.remove(rk);
}
Expand Down
Loading

0 comments on commit 9f935c0

Please sign in to comment.