private SortingCollection<String> makeSortingCollection() { final String name = getClass().getSimpleName(); final File tmpDir = IOUtil.createTempDir(name, null); tmpDir.deleteOnExit(); // 256 byte for one name, and 1/10 part of all memory for this, rough estimate long maxNamesInRam = Runtime.getRuntime().maxMemory() / 256 / 10; return SortingCollection.newInstance( String.class, new StringCodec(), String::compareTo, (int) Math.min(maxNamesInRam, Integer.MAX_VALUE), tmpDir ); }
private SortingCollection<String> makeSortingCollection() { final String name = getClass().getSimpleName(); final File tmpDir = IOUtil.createTempDir(name, null); tmpDir.deleteOnExit(); // 256 byte for one name, and 1/10 part of all memory for this, rough estimate long maxNamesInRam = Runtime.getRuntime().maxMemory() / 256 / 10; return SortingCollection.newInstance( String.class, new StringCodec(), String::compareTo, (int) Math.min(maxNamesInRam, Integer.MAX_VALUE), tmpDir ); }
RevertSamSorter( final boolean outputByReadGroup, final Map<String, SAMFileHeader> headerMap, final SAMFileHeader singleOutHeader, final int maxRecordsInRam) { this.outputByReadGroup = outputByReadGroup; if (outputByReadGroup) { for (final Map.Entry<String, SAMFileHeader> entry : headerMap.entrySet()) { final String readGroupId = entry.getKey(); final SAMFileHeader outHeader = entry.getValue(); final SortingCollection<SAMRecord> sorter = SortingCollection.newInstance(SAMRecord.class, new BAMRecordCodec(outHeader), new SAMRecordQueryNameComparator(), maxRecordsInRam); sorterMap.put(readGroupId, sorter); } singleSorter = null; } else { singleSorter = SortingCollection.newInstance(SAMRecord.class, new BAMRecordCodec(singleOutHeader), new SAMRecordQueryNameComparator(), maxRecordsInRam); } }
RevertSamSorter( final boolean outputByReadGroup, final Map<String, SAMFileHeader> headerMap, final SAMFileHeader singleOutHeader, final int maxRecordsInRam) { this.outputByReadGroup = outputByReadGroup; if (outputByReadGroup) { for (final Map.Entry<String, SAMFileHeader> entry : headerMap.entrySet()) { final String readGroupId = entry.getKey(); final SAMFileHeader outHeader = entry.getValue(); final SortingCollection<SAMRecord> sorter = SortingCollection.newInstance(SAMRecord.class, new BAMRecordCodec(outHeader), new SAMRecordQueryNameComparator(), maxRecordsInRam); sorterMap.put(readGroupId, sorter); } singleSorter = null; } else { singleSorter = SortingCollection.newInstance(SAMRecord.class, new BAMRecordCodec(singleOutHeader), new SAMRecordQueryNameComparator(), maxRecordsInRam); } }
} else { log.info("Sorting input into queryname order."); final SortingCollection<SAMRecord> sorter = SortingCollection.newInstance(SAMRecord.class, new BAMRecordCodec(header), new SAMRecordQueryNameComparator(),
if (TAG_DUPLICATE_SET_MEMBERS) { final RepresentativeReadIndexerCodec representativeIndexCodec = new RepresentativeReadIndexerCodec(); this.representativeReadIndicesForDuplicates = SortingCollection.newInstance(RepresentativeReadIndexer.class, representativeIndexCodec, Comparator.comparing(read -> read.readIndexInFile),
if (TAG_DUPLICATE_SET_MEMBERS) { final RepresentativeReadIndexerCodec representativeIndexCodec = new RepresentativeReadIndexerCodec(); this.representativeReadIndicesForDuplicates = SortingCollection.newInstance(RepresentativeReadIndexer.class, representativeIndexCodec, Comparator.comparing(read -> read.readIndexInFile),
/** * Must be called before addAlignment. Header cannot be null. */ public void setHeader(final SAMFileHeader header) { if (null == header) { throw new IllegalArgumentException("A non-null SAMFileHeader is required for a writer"); } this.header = header; if (sortOrder == null) { sortOrder = SAMFileHeader.SortOrder.unsorted; } header.setSortOrder(sortOrder); writeHeader(header); if (presorted) { if (sortOrder.equals(SAMFileHeader.SortOrder.unsorted)) { presorted = false; } else { sortOrderChecker = new SAMSortOrderChecker(sortOrder); } } else if (!sortOrder.equals(SAMFileHeader.SortOrder.unsorted)) { alignmentSorter = SortingCollection.newInstance(SAMRecord.class, new BAMRecordCodec(header), sortOrder.getComparatorInstance(), maxRecordsInRam, tmpDir); } }
/** * Must be called before addAlignment. */ public void setHeader(final SAMFileHeader header) { this.header = header; if (sortOrder == null) { sortOrder = SAMFileHeader.SortOrder.unsorted; } header.setSortOrder(sortOrder); final StringWriter headerTextBuffer = new StringWriter(); new SAMTextHeaderCodec().encode(headerTextBuffer, header); final String headerText = headerTextBuffer.toString(); writeHeader(headerText); if (presorted) { if (sortOrder.equals(SAMFileHeader.SortOrder.unsorted)) { presorted = false; } else { sortOrderChecker = new SAMSortOrderChecker(sortOrder); } } else if (!sortOrder.equals(SAMFileHeader.SortOrder.unsorted)) { alignmentSorter = SortingCollection.newInstance(SAMRecord.class, new BAMRecordCodec(header), makeComparator(), maxRecordsInRam, tmpDir); } }
/** * Must be called before addAlignment. Header cannot be null. */ public void setHeader(final SAMFileHeader header) { if (null == header) { throw new IllegalArgumentException("A non-null SAMFileHeader is required for a writer"); } this.header = header; if (sortOrder == null) { sortOrder = SAMFileHeader.SortOrder.unsorted; } header.setSortOrder(sortOrder); writeHeader(header); if (presorted) { if (sortOrder.equals(SAMFileHeader.SortOrder.unsorted)) { presorted = false; } else { sortOrderChecker = new SAMSortOrderChecker(sortOrder); } } else if (!sortOrder.equals(SAMFileHeader.SortOrder.unsorted)) { alignmentSorter = SortingCollection.newInstance(SAMRecord.class, new BAMRecordCodec(header), sortOrder.getComparatorInstance(), maxRecordsInRam, tmpDir); } }
private SortingCollection<String> makeSortingCollection(final int maxRecordsInRam) { return SortingCollection.newInstance(String.class, new StringCodec(), new StringComparator(), maxRecordsInRam, tmpDir()); }
final SortingCollection<SAMRecord> alignmentSorter = SortingCollection.newInstance(SAMRecord.class, new BAMRecordCodec(header), new SAMRecordQueryNameComparator(), MAX_RECORDS_IN_RAM);
final SortingCollection<SAMRecord> alignmentSorter = SortingCollection.newInstance(SAMRecord.class, new BAMRecordCodec(header), new SAMRecordQueryNameComparator(), MAX_RECORDS_IN_RAM);
final SortingCollection<SAMRecord> alignmentSorter = SortingCollection.newInstance(SAMRecord.class, new BAMRecordCodec(header), this.comparator, maxRecordsInRam, tmpDir);
final SortingCollection<SAMRecord> alignmentSorter = SortingCollection.newInstance(SAMRecord.class, new BAMRecordCodec(header), this.comparator, maxRecordsInRam, tmpDir);
SortingCollection.newInstance( VariantContext.class, new VCFRecordCodec(outputHeader, VALIDATION_STRINGENCY != ValidationStringency.STRICT),
SortingCollection.newInstance( VariantContext.class, new VCFRecordCodec(outputHeader, VALIDATION_STRINGENCY != ValidationStringency.STRICT),
VCFHeader header = reader.getFileHeader(); try (CloseableIterator<VariantContext> rit = reader.iterator()) { collection = SortingCollection.newInstance( VariantContext.class, new VCFRecordCodec(header),
final SortingCollection<SAMRecord> sorter = SortingCollection.newInstance(SAMRecord.class, new BAMRecordCodec(outHeader), new SAMRecordQueryNameComparator(), MAX_RECORDS_IN_RAM); final ProgressLogger revertingProgress = new ProgressLogger(log, 1000000, " reverted OQs");
final SortingCollection<SAMRecord> sorter = SortingCollection.newInstance(SAMRecord.class, new BAMRecordCodec(outHeader), new SAMRecordQueryNameComparator(), MAX_RECORDS_IN_RAM); final ProgressLogger revertingProgress = new ProgressLogger(log, 1000000, " reverted OQs");