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) {
// Can only call from UnifiedGenotyper
if ( !(walker instanceof UnifiedGenotyper) ) {
if ( !walkerIdentityCheckWarningLogged ) {
if ( walker != null )
logger.warn("Annotation will not be calculated, must be called from UnifiedGenotyper, not " + walker.getClass().getName());
else
logger.warn("Annotation will not be calculated, must be called from UnifiedGenotyper");
walkerIdentityCheckWarningLogged = true;
synchronized (this) {
if (!walkerIdentityCheckWarningLogged) {
if (walker != null)
logger.warn("Annotation will not be calculated, must be called from UnifiedGenotyper, not " + walker.getClass().getSimpleName());
else
logger.warn("Annotation will not be calculated, must be called from UnifiedGenotyper");
walkerIdentityCheckWarningLogged = true;
}
}
return null;
}

View File

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

View File

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

View File

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

View File

@ -79,7 +79,6 @@ import java.util.*;
*/
public class TandemRepeatAnnotator extends InfoFieldAnnotation implements StandardUGAnnotation, ActiveRegionBasedAnnotation {
private final static Logger logger = Logger.getLogger(TandemRepeatAnnotator.class);
private boolean walkerIdentityCheckWarningLogged = false;
@Override
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
if ( !(walker instanceof VariantAnnotator) ) {
if ( !walkerIdentityCheckWarningLogged ) {
if ( walker != null )
logger.warn("Annotation will not be calculated, must be called from VariantAnnotator, not " + walker.getClass().getName());
else
logger.warn("Annotation will not be calculated, must be called from VariantAnnotator");
walkerIdentityCheckWarningLogged = true;
synchronized (this) {
if (!walkerIdentityCheckWarningLogged) {
if (walker != null)
logger.warn("Annotation will not be calculated, must be called from VariantAnnotator, not " + walker.getClass().getSimpleName());
else
logger.warn("Annotation will not be calculated, must be called from VariantAnnotator");
walkerIdentityCheckWarningLogged = true;
}
}
return null;
}
@ -115,9 +117,11 @@ public class TransmissionDisequilibriumTest extends InfoFieldAnnotation implemen
if ( trios == null ) {
trios = ((VariantAnnotator) walker).getSampleDB().getChildrenWithParents();
if (trios == null || trios.isEmpty()) {
if ( !pedigreeCheckWarningLogged ) {
logger.warn("Transmission disequilibrium test annotation requires a valid ped file be passed in.");
pedigreeCheckWarningLogged = true;
synchronized (this) {
if (!pedigreeCheckWarningLogged) {
logger.warn("Transmission disequilibrium test annotation requires a valid ped file be passed in.");
pedigreeCheckWarningLogged = true;
}
}
return null;
}

View File

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

View File

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