htsjdk.samtools.util.Log.warn()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(9.9k)|赞(0)|评价(0)|浏览(244)

本文整理了Java中htsjdk.samtools.util.Log.warn()方法的一些代码示例,展示了Log.warn()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Log.warn()方法的具体详情如下:
包路径:htsjdk.samtools.util.Log
类名称:Log
方法名:warn

Log.warn介绍

[英]Logs a Throwable and optional message parts at level warn.
[中]在警告级别记录可丢弃和可选消息部分。

代码示例

代码示例来源:origin: com.github.samtools/htsjdk

/** Gets a string system property, prefixed with "samjdk." using the default 
 * if the property does not exist or if the java.security manager raises an exception for
 * applications started with  -Djava.security.manager  . */
private static String getStringProperty(final String name, final String def) {
  try {
    return System.getProperty("samjdk." + name, def);
  } catch (final java.security.AccessControlException error) {
    log.warn(error,"java Security Manager forbids 'System.getProperty(\"" + name + "\")' , returning default value: " + def );
    return def;
  }
}

代码示例来源:origin: samtools/htsjdk

/** Gets a string system property, prefixed with "samjdk." using the default 
 * if the property does not exist or if the java.security manager raises an exception for
 * applications started with  -Djava.security.manager  . */
private static String getStringProperty(final String name, final String def) {
  try {
    return System.getProperty("samjdk." + name, def);
  } catch (final java.security.AccessControlException error) {
    log.warn(error,"java Security Manager forbids 'System.getProperty(\"" + name + "\")' , returning default value: " + def );
    return def;
  }
}

代码示例来源:origin: samtools/htsjdk

/** Checks whether a string system property, prefixed with "samjdk.", exists.
 * If the property does not exist or if the java.security manager raises an exception for
 * applications started with  -Djava.security.manager  this method returns false. */
private static boolean hasProperty(final String name){
  try {
    return null != System.getProperty("samjdk." + name);
  } catch (final java.security.AccessControlException error) {
    log.warn(error,"java Security Manager forbids 'System.getProperty(\"" + name + "\")' , returning false");
    return false;
  }
}

代码示例来源:origin: com.github.samtools/htsjdk

/** Checks whether a string system property, prefixed with "samjdk.", exists.
 * If the property does not exist or if the java.security manager raises an exception for
 * applications started with  -Djava.security.manager  this method returns false. */
private static boolean hasProperty(final String name){
  try {
    return null != System.getProperty("samjdk." + name);
  } catch (final java.security.AccessControlException error) {
    log.warn(error,"java Security Manager forbids 'System.getProperty(\"" + name + "\")' , returning false");
    return false;
  }
}

代码示例来源:origin: samtools/htsjdk

ExperimentalCodec(final BitInputStream coreBlockInputStream,
           final BitOutputStream coreBlockOutputStream) {
    super(coreBlockInputStream, coreBlockOutputStream);

    final String subclass = this.getClass().getName();
    final String warning = String.format(
        "Using the experimental codec %s which is untested and scheduled for removal from the CRAM spec",
        subclass);

    final Log log = Log.getInstance(ExperimentalCodec.class);
    log.warn(warning);
  }
}

代码示例来源:origin: com.github.samtools/htsjdk

ExperimentalEncoding(final EncodingID encodingID) {
    super(encodingID);

    final String subclass = this.getClass().getName();
    final String warning = String.format(
        "Using the experimental encoding %s which is untested and scheduled for removal from the CRAM spec",
        subclass);

    final Log log = Log.getInstance(ExperimentalEncoding.class);
    log.warn(warning);
  }
}

代码示例来源:origin: com.github.samtools/htsjdk

private File findIndexForFile(File indexFile, final File cramFile) {
  indexFile = indexFile == null ? SamFiles.findIndex(cramFile) : indexFile;
  if (indexFile != null && indexFile.lastModified() < cramFile.lastModified()) {
    log.warn("CRAM index file " + indexFile.getAbsolutePath() +
        " is older than CRAM " + cramFile.getAbsolutePath());
  }
  return indexFile;
}

代码示例来源:origin: samtools/htsjdk

private File findIndexForFile(File indexFile, final File cramFile) {
  indexFile = indexFile == null ? SamFiles.findIndex(cramFile) : indexFile;
  if (indexFile != null && indexFile.lastModified() < cramFile.lastModified()) {
    log.warn("CRAM index file " + indexFile.getAbsolutePath() +
        " is older than CRAM " + cramFile.getAbsolutePath());
  }
  return indexFile;
}

代码示例来源:origin: samtools/htsjdk

ExperimentalEncoding(final EncodingID encodingID) {
    super(encodingID);

    final String subclass = this.getClass().getName();
    final String warning = String.format(
        "Using the experimental encoding %s which is untested and scheduled for removal from the CRAM spec",
        subclass);

    final Log log = Log.getInstance(ExperimentalEncoding.class);
    log.warn(warning);
  }
}

代码示例来源:origin: com.github.samtools/htsjdk

ExperimentalCodec(final BitInputStream coreBlockInputStream,
           final BitOutputStream coreBlockOutputStream) {
    super(coreBlockInputStream, coreBlockOutputStream);

    final String subclass = this.getClass().getName();
    final String warning = String.format(
        "Using the experimental codec %s which is untested and scheduled for removal from the CRAM spec",
        subclass);

    final Log log = Log.getInstance(ExperimentalCodec.class);
    log.warn(warning);
  }
}

代码示例来源:origin: enasequence/cramtools

private static void eofNotFound(htsjdk.samtools.cram.common.Version version) {
  if (version.major >= 2 && version.minor >= 1) {
    log.error("Incomplete data: EOF marker not found.");
    if (quitOnMissingEOF)
      System.exit(1);
  } else {
    log.warn("EOF marker not found, possibly incomplete file/stream.");
  }
}

代码示例来源:origin: com.github.samtools/htsjdk

/**
 * @return true if we have surpassed the maximum accumulation threshold for the first locus in the accumulator, false otherwise
 */
private boolean surpassedAccumulationThreshold() {
  final boolean surpassesThreshold = !accumulator.isEmpty() && accumulator.get(0).getRecordAndOffsets().size() >= maxReadsToAccumulatePerLocus;
  if (surpassesThreshold && !enforcedAccumulationLimit) {
    LOG.warn("We have encountered greater than " + maxReadsToAccumulatePerLocus + " reads at position " + accumulator.get(0).toString() + " and will ignore the remaining reads at this position.  Note that further warnings will be suppressed.");
    enforcedAccumulationLimit = true;
  }
  return surpassesThreshold;
}

代码示例来源:origin: samtools/htsjdk

/**
 * @return true if we have surpassed the maximum accumulation threshold for the first locus in the accumulator, false otherwise
 */
private boolean surpassedAccumulationThreshold() {
  final boolean surpassesThreshold = !accumulator.isEmpty() && accumulator.get(0).getRecordAndOffsets().size() >= maxReadsToAccumulatePerLocus;
  if (surpassesThreshold && !enforcedAccumulationLimit) {
    LOG.warn("We have encountered greater than " + maxReadsToAccumulatePerLocus + " reads at position " + accumulator.get(0).toString() + " and will ignore the remaining reads at this position.  Note that further warnings will be suppressed.");
    enforcedAccumulationLimit = true;
  }
  return surpassesThreshold;
}

代码示例来源:origin: broadinstitute/picard

/**
   * Main method for the program.  Checks that input file is present and
   * readable, then iterates through the index printing meta data to stdout.
   */
  protected int doWork() {

    if (INPUT.getName().endsWith(BAMIndex.BAMIndexSuffix))
        log.warn("INPUT should be the BAM file name, not its index file");
    IOUtil.assertFileIsReadable(INPUT);
    BAMIndexMetaData.printIndexStats(INPUT);

    return 0;
  }
}

代码示例来源:origin: com.github.broadinstitute/picard

/**
   * Main method for the program.  Checks that input file is present and
   * readable, then iterates through the index printing meta data to stdout.
   */
  protected int doWork() {

    if (INPUT.getName().endsWith(BAMIndex.BAMIndexSuffix))
        log.warn("INPUT should be the BAM file name, not its index file");
    IOUtil.assertFileIsReadable(INPUT);
    BAMIndexMetaData.printIndexStats(INPUT);

    return 0;
  }
}

代码示例来源:origin: PapenfussLab/gridss

@Override
  public void close() {
    log.debug("Closing UntemplatedSequenceAnnotator");
    // TODO: close feeding thread more cleanly than just shutting down the process
    vcfStream.close();
    try {
      aligner.close();
    } catch (IOException e) {
      log.warn(e);
    }
  }
}

代码示例来源:origin: broadinstitute/picard

@Override protected void setup(final SAMFileHeader header, final File samFile) {
  IOUtil.assertFileIsWritable(OUTPUT);
  if (header.getSequenceDictionary().isEmpty()) {
    log.warn(INPUT.getAbsoluteFile() + " has no sequence dictionary.  If any reads " +
        "in the file are aligned, then alignment summary metrics collection will fail.");
  }
  final boolean doRefMetrics = REFERENCE_SEQUENCE != null;
  collector = new AlignmentSummaryMetricsCollector(METRIC_ACCUMULATION_LEVEL, header.getReadGroups(), doRefMetrics,
      ADAPTER_SEQUENCE, MAX_INSERT_SIZE, EXPECTED_PAIR_ORIENTATIONS, IS_BISULFITE_SEQUENCED);
}

代码示例来源:origin: com.github.broadinstitute/picard

@Override protected void setup(final SAMFileHeader header, final File samFile) {
  IOUtil.assertFileIsWritable(OUTPUT);
  if (header.getSequenceDictionary().isEmpty()) {
    log.warn(INPUT.getAbsoluteFile() + " has no sequence dictionary.  If any reads " +
        "in the file are aligned, then alignment summary metrics collection will fail.");
  }
  final boolean doRefMetrics = REFERENCE_SEQUENCE != null;
  collector = new AlignmentSummaryMetricsCollector(METRIC_ACCUMULATION_LEVEL, header.getReadGroups(), doRefMetrics,
      ADAPTER_SEQUENCE, MAX_INSERT_SIZE, EXPECTED_PAIR_ORIENTATIONS, IS_BISULFITE_SEQUENCED);
}

代码示例来源:origin: com.github.samtools/htsjdk

private void warnIfReferenceIsTooLargeForBinField(final SAMRecord rec) {
  final SAMSequenceRecord sequence = rec.getHeader() != null ? rec.getHeader().getSequence(rec.getReferenceName()) : null;
  if (!isReferenceSizeWarningShowed
      && sequence != null
      && SAMUtils.isReferenceSequenceCompatibleWithBAI(sequence)
      && rec.getValidationStringency() != ValidationStringency.SILENT) {
    LOG.warn("Reference length is too large for BAM bin field. Values in the bin field could be incorrect.");
    isReferenceSizeWarningShowed = true;
  }
}

代码示例来源:origin: PapenfussLab/gridss

private void warnIfReferenceIsTooLargeForBinField(final SAMRecord rec) {
  final SAMSequenceRecord sequence = rec.getHeader() != null ? rec.getHeader().getSequence(rec.getReferenceName()) : null;
  if (!isReferenceSizeWarningShowed
      && sequence != null
      && SAMUtils.isReferenceSequenceCompatibleWithBAI(sequence)
      && rec.getValidationStringency() != ValidationStringency.SILENT) {
    LOG.warn("Reference length is too large for BAM bin field. Values in the bin field could be incorrect.");
    isReferenceSizeWarningShowed = true;
  }
}

相关文章