コード例 #1
0
 /**
  * Alternative to other one with similar name
  *
  * @param directory directory containing SDF
  * @param indexFile index file
  * @param loadNames should we load names
  * @param loadFullNames should we load full names
  * @param region region to restrict to
  * @throws IOException IO exception occurs
  */
 CompressedMemorySequencesReader2(
     File directory,
     IndexFile indexFile,
     boolean loadNames,
     boolean loadFullNames,
     LongRange region)
     throws IOException {
   mIndexFile = indexFile;
   mRegion = SequencesReaderFactory.resolveRange(indexFile, region);
   mStart = mRegion.getStart();
   mEnd = mRegion.getEnd();
   mNumberSequences = mEnd - mStart;
   mData =
       DataInMemory.loadDelayQuality(
           directory,
           indexFile,
           DataFileIndex.loadSequenceDataFileIndex(indexFile.dataIndexVersion(), directory),
           mStart,
           mEnd);
   if (mNumberSequences > Integer.MAX_VALUE) {
     throw new IllegalArgumentException(
         "Too many sequences in region: " + region + ", maximum is: " + Integer.MAX_VALUE);
   }
   mDirectory = directory;
   if (loadNames && mIndexFile.hasNames()) {
     loadNames();
     loadNameSuffixes(loadFullNames, mIndexFile.hasSequenceNameSuffixes());
   }
   final StringBuilder sb = new StringBuilder("CMSR2 statistics");
   sb.append(LS);
   this.infoString(sb);
   Diagnostic.userLog(sb.toString());
 }
コード例 #2
0
 /**
  * Load the names if they haven't already been loaded.
  *
  * @throws IOException if an I/O related error occurs
  */
 private void loadNames() throws IOException {
   mNames = new PrereadNames(mDirectory, mRegion, false);
   if (mIndexFile.getVersion() >= IndexFile.SEPARATE_CHECKSUM_VERSION
       && mRegion.getStart() == 0
       && mRegion.getEnd() == mIndexFile.getNumberSequences()) {
     if (mNames.calcChecksum() != mIndexFile.getNameChecksum()) {
       throw new CorruptSdfException(
           "Sequence names failed checksum - SDF may be corrupt: \"" + mDirectory + "\"");
     } else {
       Diagnostic.developerLog("Sequence names passed checksum");
     }
   }
 }
コード例 #3
0
 private void loadNameSuffixes(boolean attemptLoad, boolean suffixExists) throws IOException {
   mNameSuffixes =
       attemptLoad && suffixExists
           ? new PrereadNames(mDirectory, mRegion, true)
           : new EmptyStringPrereadNames(mEnd - mStart);
   if (attemptLoad && suffixExists) {
     if (mRegion.getStart() == 0 && mRegion.getEnd() == mIndexFile.getNumberSequences()) {
       if (mNameSuffixes.calcChecksum() != mIndexFile.getNameSuffixChecksum()) {
         throw new CorruptSdfException(
             "Sequence name suffixes failed checksum - SDF may be corrupt: \""
                 + mDirectory
                 + "\"");
       } else {
         Diagnostic.developerLog("Sequence name suffixes passed checksum");
       }
     }
   }
 }