Package net.sf.picard.util

Examples of net.sf.picard.util.ProgressLogger


  }

  public void validateSamRecords(final Iterable<SAMRecord> samRecords,
      final SAMFileHeader header) {
    SAMRecordIterator iter = (SAMRecordIterator) samRecords.iterator();
    final ProgressLogger progress = new ProgressLogger(log, 10000000,
        "Validated Read");
    try {
      while (iter.hasNext()) {
        SAMRecord record = iter.next();

        final long recordNumber = progress.getCount() + 1;
        final Collection<SAMValidationError> errors = record.isValid();
        if (errors != null) {
          for (final SAMValidationError error : errors) {
            error.setRecordNumber(recordNumber);
            addError(error);
          }
        }

        validateMateFields(record, recordNumber);
        validateSortOrder(record, recordNumber);
        validateReadGroup(record, header);
        final boolean cigarIsValid = validateCigar(record, recordNumber);
        if (cigarIsValid) {
          validateNmTag(record, recordNumber);
        }
        validateSecondaryBaseCalls(record, recordNumber);
        validateTags(record, recordNumber);
        if (sequenceDictionaryEmptyAndNoWarningEmitted
            && !record.getReadUnmappedFlag()) {
          addError(new SAMValidationError(
              Type.MISSING_SEQUENCE_DICTIONARY,
              "Sequence dictionary is empty", null));
          sequenceDictionaryEmptyAndNoWarningEmitted = false;

        }
        progress.record(record);
      }
    } catch (SAMFormatException e) {
      // increment record number because the iterator behind the
      // SAMFileReader
      // reads one record ahead so we will get this failure one record
      // ahead
      final String msg = "SAMFormatException on record "
          + progress.getCount() + 1;
      out.println(msg);
      throw new PicardException(msg, e);
    } catch (FileTruncatedException e) {
      addError(new SAMValidationError(Type.TRUNCATED_FILE,
          "File is truncated", null));
View Full Code Here


        referenceSequenceFile);

    CramHeader cramHeader = iterator.getCramHeader();
    iterator.close();

    ProgressLogger progress = new ProgressLogger(log, 100000,
        "Validated Read");
    SamFileValidator v = new SamFileValidator(new PrintWriter(System.out),
        1);
    List<SAMValidationError.Type> errors = new ArrayList<SAMValidationError.Type>();
    errors.add(Type.MATE_NOT_FOUND);
//    errors.add(Type.MISSING_TAG_NM);
    v.setErrorsToIgnore(errors);
    v.init(referenceSequenceFile, cramHeader.samFileHeader);
    v.validateSamRecords(new SAMIterator.CramFileIterable(
        params.cramFile, referenceSequenceFile),
        cramHeader.samFileHeader);
    log.info("Elapsed seconds: " + progress.getElapsedSeconds());
  }
View Full Code Here

TOP

Related Classes of net.sf.picard.util.ProgressLogger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.