private void write(final FastqWriter[] writers, final FastqRecord[] records) { for (int i = 0; i < writers.length; ++i) { writers[i].write(records[i]); } }
private void write(final FastqWriter[] writers, final FastqRecord[] records) { for (int i = 0; i < writers.length; ++i) { writers[i].write(records[i]); } }
@Override protected void synchronouslyWrite(final FastqRecord item) { this.writer.write(item); } @Override protected void synchronouslyClose() { this.writer.close(); }
@Override protected void synchronouslyClose() { this.writer.close(); } }
@Override protected void synchronouslyWrite(final FastqRecord item) { this.writer.write(item); } @Override protected void synchronouslyClose() { this.writer.close(); }
@Override protected void synchronouslyClose() { this.writer.close(); } }
@Override protected void synchronouslyWrite(final FastqRecord item) { this.writer.write(item); } @Override protected void synchronouslyClose() { this.writer.close(); }
@Override protected void synchronouslyClose() { this.writer.close(); } }
private void writeTagRecords(final SAMRecord read, final Integer mateNumber, final List<FastqWriter> tagWriters) { if (SEQUENCE_TAG_GROUP.isEmpty()) { return; } final String seqHeader = mateNumber == null ? read.getReadName() : read.getReadName() + "/" + mateNumber; for (int i = 0; i < SEQUENCE_TAG_GROUP.size(); i++) { final String tmpTagSep = SPLIT_SEPARATOR_TAGS.get(i); final String[] sequenceTagsToWrite = SPLIT_SEQUENCE_TAGS.get(i); final String newSequence = String.join(tmpTagSep, Arrays.stream(sequenceTagsToWrite) .map(tag -> assertTagExists(read, tag)) .collect(Collectors.toList())); final String tmpQualSep = StringUtils.repeat(TAG_SPLIT_QUAL, tmpTagSep.length()); final String[] qualityTagsToWrite = SPLIT_QUALITY_TAGS.get(i); final String newQual = QUALITY_TAG_GROUP.isEmpty() ? StringUtils.repeat(TAG_SPLIT_QUAL, newSequence.length()) : String.join(tmpQualSep, Arrays.stream(qualityTagsToWrite) .map(tag -> assertTagExists(read, tag)) .collect(Collectors.toList())); FastqWriter writer = tagWriters.get(i); writer.write(new FastqRecord(seqHeader, newSequence, "", newQual)); } }
private void closeAll() { final Set<FastqWriter> fastqWriters = new HashSet<>(); fastqWriters.add(firstOfPair); fastqWriters.add(unpaired); // Make sure this is a no-op if the second writer was never fetched. if (secondOfPair.isInitialized()) { fastqWriters.add(secondOfPair.get()); } for (final FastqWriter fastqWriter : fastqWriters) { fastqWriter.close(); } } }
private void writeTagRecords(final SAMRecord read, final Integer mateNumber, final List<FastqWriter> tagWriters) { if (SEQUENCE_TAG_GROUP.isEmpty()) { return; } final String seqHeader = mateNumber == null ? read.getReadName() : read.getReadName() + "/" + mateNumber; for (int i = 0; i < SEQUENCE_TAG_GROUP.size(); i++) { final String tmpTagSep = SPLIT_SEPARATOR_TAGS.get(i); final String[] sequenceTagsToWrite = SPLIT_SEQUENCE_TAGS.get(i); final String newSequence = String.join(tmpTagSep, Arrays.stream(sequenceTagsToWrite) .map(tag -> assertTagExists(read, tag)) .collect(Collectors.toList())); final String tmpQualSep = StringUtils.repeat(TAG_SPLIT_QUAL, tmpTagSep.length()); final String[] qualityTagsToWrite = SPLIT_QUALITY_TAGS.get(i); final String newQual = QUALITY_TAG_GROUP.isEmpty() ? StringUtils.repeat(TAG_SPLIT_QUAL, newSequence.length()) : String.join(tmpQualSep, Arrays.stream(qualityTagsToWrite) .map(tag -> assertTagExists(read, tag)) .collect(Collectors.toList())); FastqWriter writer = tagWriters.get(i); writer.write(new FastqRecord(seqHeader, newSequence, "", newQual)); } }
private void closeAll() { final Set<FastqWriter> fastqWriters = new HashSet<>(); fastqWriters.add(firstOfPair); fastqWriters.add(unpaired); // Make sure this is a no-op if the second writer was never fetched. if (secondOfPair.isInitialized()) { fastqWriters.add(secondOfPair.get()); } for (final FastqWriter fastqWriter : fastqWriters) { fastqWriter.close(); } } }
writer.write(new FastqRecord(seqHeader, readString, "", baseQualities));
additionalWriters.values().forEach(additionalWriterSet::addAll); for (final FastqWriter fastqWriter : additionalWriterSet) { fastqWriter.close();
writer.write(new FastqRecord(seqHeader, readString, "", baseQualities));
additionalWriters.values().forEach(additionalWriterSet::addAll); for (final FastqWriter fastqWriter : additionalWriterSet) { fastqWriter.close();
protected int createSupplementaryAlignmentFastq(File input, File fq, boolean isRecursive) throws IOException { int recordsWritten = 0; try (SamReader reader = readerFactory.open(input)) { try (AsyncBufferedIterator<SAMRecord> bufferedIt = new AsyncBufferedIterator<>(reader.iterator(), input.getName())) { try (FastqWriter writer = new AsyncFastqWriter(new NonFlushingBasicFastqWriter(fq), AsyncFastqWriter.DEFAULT_QUEUE_SIZE)) { SplitReadFastqExtractionIterator fastqit = new SplitReadFastqExtractionIterator( bufferedIt, isRecursive, minSoftClipLength, minSoftClipQuality, !isRecursive && isProcessSecondaryAlignments(), isRealignExistingSplitReads(), isRealignEntireRecord(), eidgen); while (fastqit.hasNext()) { writer.write(fastqit.next()); recordsWritten++; } } } } return recordsWritten; } public boolean isRealignExistingSplitReads() {