Merge pull request #1546 from broadinstitute/rhl_annot_warn_1540

Log annotation warning once if using multithreads
This commit is contained in:
Ron Levine 2017-01-09 11:59:53 -05:00 committed by GitHub
commit bb87730ddc
8 changed files with 66 additions and 49 deletions

View File

@ -105,12 +105,14 @@ public class HaplotypeScore extends InfoFieldAnnotation implements StandardAnnot
final Map<String, PerReadAlleleLikelihoodMap> stratifiedPerReadAlleleLikelihoodMap) { final Map<String, PerReadAlleleLikelihoodMap> stratifiedPerReadAlleleLikelihoodMap) {
// Can only call from UnifiedGenotyper // Can only call from UnifiedGenotyper
if ( !(walker instanceof UnifiedGenotyper) ) { if ( !(walker instanceof UnifiedGenotyper) ) {
if ( !walkerIdentityCheckWarningLogged ) { synchronized (this) {
if ( walker != null ) if (!walkerIdentityCheckWarningLogged) {
logger.warn("Annotation will not be calculated, must be called from UnifiedGenotyper, not " + walker.getClass().getName()); if (walker != null)
else logger.warn("Annotation will not be calculated, must be called from UnifiedGenotyper, not " + walker.getClass().getSimpleName());
logger.warn("Annotation will not be calculated, must be called from UnifiedGenotyper"); else
walkerIdentityCheckWarningLogged = true; logger.warn("Annotation will not be calculated, must be called from UnifiedGenotyper");
walkerIdentityCheckWarningLogged = true;
}
} }
return null; return null;
} }

View File

@ -109,12 +109,14 @@ public class MVLikelihoodRatio extends InfoFieldAnnotation implements RodRequiri
// Can only be called from VariantAnnotator // Can only be called from VariantAnnotator
if ( !(walker instanceof VariantAnnotator) ) { if ( !(walker instanceof VariantAnnotator) ) {
if ( !walkerIdentityCheckWarningLogged ) { synchronized (this) {
if ( walker != null ) if (!walkerIdentityCheckWarningLogged) {
logger.warn("Annotation will not be calculated, must be called from VariantAnnotator, not " + walker.getClass().getName()); if (walker != null)
else logger.warn("Annotation will not be calculated, must be called from VariantAnnotator, not " + walker.getClass().getSimpleName());
logger.warn("Annotation will not be calculated, must be called from VariantAnnotator"); else
walkerIdentityCheckWarningLogged = true; logger.warn("Annotation will not be calculated, must be called from VariantAnnotator");
walkerIdentityCheckWarningLogged = true;
}
} }
return null; return null;
} }
@ -123,9 +125,11 @@ public class MVLikelihoodRatio extends InfoFieldAnnotation implements RodRequiri
// Must have a pedigree file // Must have a pedigree file
trios = ((Walker) walker).getSampleDB().getTrios(); trios = ((Walker) walker).getSampleDB().getTrios();
if ( trios.isEmpty() ) { if ( trios.isEmpty() ) {
if ( !pedigreeCheckWarningLogged ) { synchronized (this) {
logger.warn("Annotation will not be calculated, mendelian violation annotation must provide a valid PED file (-ped) from the command line."); if (!pedigreeCheckWarningLogged) {
pedigreeCheckWarningLogged = true; logger.warn("Annotation will not be calculated, mendelian violation annotation must provide a valid PED file (-ped) from the command line.");
pedigreeCheckWarningLogged = true;
}
} }
return null; return null;
} }

View File

@ -112,12 +112,14 @@ public class PossibleDeNovo extends InfoFieldAnnotation implements RodRequiringA
final Map<String, PerReadAlleleLikelihoodMap> stratifiedPerReadAlleleLikelihoodMap) { final Map<String, PerReadAlleleLikelihoodMap> stratifiedPerReadAlleleLikelihoodMap) {
if ( !(walker instanceof VariantAnnotator ) ) { if ( !(walker instanceof VariantAnnotator ) ) {
if ( !walkerIdentityCheckWarningLogged ) { synchronized (this) {
if ( walker != null ) if (!walkerIdentityCheckWarningLogged) {
logger.warn("Annotation will not be calculated, must be called from VariantAnnotator, not " + walker.getClass().getName()); if (walker != null)
else logger.warn("Annotation will not be calculated, must be called from VariantAnnotator, not " + walker.getClass().getSimpleName());
logger.warn("Annotation will not be calculated, must be called from VariantAnnotator"); else
walkerIdentityCheckWarningLogged = true; logger.warn("Annotation will not be calculated, must be called from VariantAnnotator");
walkerIdentityCheckWarningLogged = true;
}
} }
return null; return null;
} }

View File

@ -95,12 +95,14 @@ public class SpanningDeletions extends InfoFieldAnnotation implements StandardUG
final Map<String, PerReadAlleleLikelihoodMap> stratifiedPerReadAlleleLikelihoodMap) { final Map<String, PerReadAlleleLikelihoodMap> stratifiedPerReadAlleleLikelihoodMap) {
// Can only call from UnifiedGenotyper // Can only call from UnifiedGenotyper
if ( !(walker instanceof UnifiedGenotyper) ) { if ( !(walker instanceof UnifiedGenotyper) ) {
if ( !walkerIdentityCheckWarningLogged ) { synchronized (this) {
if ( walker != null ) if (!walkerIdentityCheckWarningLogged) {
logger.warn("Annotation will not be calculated, must be called from UnifiedGenotyper, not " + walker.getClass().getName()); if (walker != null)
else logger.warn("Annotation will not be calculated, must be called from UnifiedGenotyper, not " + walker.getClass().getSimpleName());
logger.warn("Annotation will not be calculated, must be called from UnifiedGenotyper"); else
walkerIdentityCheckWarningLogged = true; logger.warn("Annotation will not be calculated, must be called from UnifiedGenotyper");
walkerIdentityCheckWarningLogged = true;
}
} }
return null; return null;
} }

View File

@ -79,7 +79,6 @@ import java.util.*;
*/ */
public class TandemRepeatAnnotator extends InfoFieldAnnotation implements StandardUGAnnotation, ActiveRegionBasedAnnotation { public class TandemRepeatAnnotator extends InfoFieldAnnotation implements StandardUGAnnotation, ActiveRegionBasedAnnotation {
private final static Logger logger = Logger.getLogger(TandemRepeatAnnotator.class); private final static Logger logger = Logger.getLogger(TandemRepeatAnnotator.class);
private boolean walkerIdentityCheckWarningLogged = false;
@Override @Override
public Map<String, Object> annotate(final RefMetaDataTracker tracker, public Map<String, Object> annotate(final RefMetaDataTracker tracker,

View File

@ -101,12 +101,14 @@ public class TransmissionDisequilibriumTest extends InfoFieldAnnotation implemen
// Can only be called from VariantAnnotator // Can only be called from VariantAnnotator
if ( !(walker instanceof VariantAnnotator) ) { if ( !(walker instanceof VariantAnnotator) ) {
if ( !walkerIdentityCheckWarningLogged ) { synchronized (this) {
if ( walker != null ) if (!walkerIdentityCheckWarningLogged) {
logger.warn("Annotation will not be calculated, must be called from VariantAnnotator, not " + walker.getClass().getName()); if (walker != null)
else logger.warn("Annotation will not be calculated, must be called from VariantAnnotator, not " + walker.getClass().getSimpleName());
logger.warn("Annotation will not be calculated, must be called from VariantAnnotator"); else
walkerIdentityCheckWarningLogged = true; logger.warn("Annotation will not be calculated, must be called from VariantAnnotator");
walkerIdentityCheckWarningLogged = true;
}
} }
return null; return null;
} }
@ -115,9 +117,11 @@ public class TransmissionDisequilibriumTest extends InfoFieldAnnotation implemen
if ( trios == null ) { if ( trios == null ) {
trios = ((VariantAnnotator) walker).getSampleDB().getChildrenWithParents(); trios = ((VariantAnnotator) walker).getSampleDB().getChildrenWithParents();
if (trios == null || trios.isEmpty()) { if (trios == null || trios.isEmpty()) {
if ( !pedigreeCheckWarningLogged ) { synchronized (this) {
logger.warn("Transmission disequilibrium test annotation requires a valid ped file be passed in."); if (!pedigreeCheckWarningLogged) {
pedigreeCheckWarningLogged = true; logger.warn("Transmission disequilibrium test annotation requires a valid ped file be passed in.");
pedigreeCheckWarningLogged = true;
}
} }
return null; return null;
} }

View File

@ -115,12 +115,14 @@ public class BaseQualitySumPerAlleleBySample extends GenotypeAnnotation implemen
// Can only call from MuTect2 // Can only call from MuTect2
if ( !(walker instanceof MuTect2) ) { if ( !(walker instanceof MuTect2) ) {
if ( !walkerIdentityCheckWarningLogged ) { synchronized (this) {
if ( walker != null ) if (!walkerIdentityCheckWarningLogged) {
logger.warn("Annotation will not be calculated, can only be called from MuTect2, not " + walker.getClass().getName()); if (walker != null)
else logger.warn("Annotation will not be calculated, can only be called from MuTect2, not " + walker.getClass().getSimpleName());
logger.warn("Annotation will not be calculated, can only be called from MuTect2"); else
walkerIdentityCheckWarningLogged = true; logger.warn("Annotation will not be calculated, can only be called from MuTect2");
walkerIdentityCheckWarningLogged = true;
}
} }
return; return;
} }

View File

@ -121,12 +121,14 @@ public class OxoGReadCounts extends GenotypeAnnotation {
// Can only call from MuTect2 // Can only call from MuTect2
if ( !(walker instanceof MuTect2) ) { if ( !(walker instanceof MuTect2) ) {
if ( !walkerIdentityCheckWarningLogged ) { synchronized (this) {
if ( walker != null ) if (!walkerIdentityCheckWarningLogged) {
logger.warn("Annotation will not be calculated, can only be called from MuTect2, not " + walker.getClass().getName()); if (walker != null)
else logger.warn("Annotation will not be calculated, can only be called from MuTect2, not " + walker.getClass().getSimpleName());
logger.warn("Annotation will not be calculated, can only be called from MuTect2"); else
walkerIdentityCheckWarningLogged = true; logger.warn("Annotation will not be calculated, can only be called from MuTect2");
walkerIdentityCheckWarningLogged = true;
}
} }
return; return;
} }