void BaseFile::CopyReadAt(uint32_t readIndex, SMRTSequence &read) { assert(holeNumbers.size() > readIndex); read.HoleNumber(holeNumbers[readIndex]); if (holeXY.size() > 0) { assert(holeXY.size() > readIndex); read.HoleXY(holeXY[readIndex].xy[0], holeXY[readIndex].xy[1]); } DSLength startPos = readStartPositions[readIndex]; DNALength readLength = readLengths[readIndex]; read.length = readLength; read.Allocate(readLength); if (baseCalls.size() > 0) { assert(baseCalls.size() >= readLength + startPos); CopyArray(baseCalls, startPos, readLength, read.seq); } if (qualityValues.size() > 0) { assert(qualityValues.size() >= readLength + startPos); CopyArray(qualityValues, startPos, readLength, read.qual.data); } if (basWidthInFrames.size() > 0) { assert(basWidthInFrames.size() >= readLength + startPos); CopyArray(basWidthInFrames, startPos, readLength, read.widthInFrames); } if (deletionQV.size() > 0) { assert(deletionQV.size() >= readLength + startPos); CopyArray(deletionQV, startPos, readLength, read.deletionQV.data); } if (deletionTag.size() > 0) { assert(deletionTag.size() >= readLength + startPos); CopyArray(deletionTag, startPos, readLength, read.deletionTag); } if (insertionQV.size() > 0) { assert(insertionQV.size() >= readLength + startPos); CopyArray(insertionQV, startPos, readLength, read.insertionQV.data); } if (substitutionQV.size() > 0) { assert(substitutionQV.size() >= readLength + startPos); CopyArray(substitutionQV, startPos, readLength, read.substitutionQV.data); } if (mergeQV.size() > 0) { assert(mergeQV.size() >= readLength + startPos); CopyArray(mergeQV, startPos, readLength, read.mergeQV.data); } if (substitutionTag.size() > 0) { assert(substitutionTag.size() >= readLength + startPos); CopyArray(substitutionTag, startPos, readLength, read.substitutionTag); } if (preBaseFrames.size() > 0) { assert(preBaseFrames.size() >= readLength + startPos); CopyArray(preBaseFrames, startPos, readLength, read.preBaseFrames); } }
void CreateSMRTSequence(SMRTSequence& smrt, Nucleotide* seq, int holeNumber, int start, int end) { int size = end - start; smrt.seq = new Nucleotide[size]; memcpy(smrt.seq, seq, size * sizeof(Nucleotide)); smrt.length = size; smrt.deleteOnExit = false; smrt.HoleNumber(holeNumber); smrt.SubreadStart(start); smrt.SubreadEnd(end); std::stringstream ss; }
bool HDFPulseWriter::WriteOneZmw(const SMRTSequence& seq, const std::vector<RegionAnnotation>& regions) { if (not this->WriteOneZmw(seq)) { return false; } if (HasRegions()) { if (regions.size() == 0) { std::vector<RegionAnnotation> fake = { RegionAnnotation(seq.HoleNumber(), HQRegion, 0, 0, 0)}; return regionsWriter_->Write(fake); } else { return regionsWriter_->Write(regions); } } return true; }
void MakeVirtualRead(SMRTSequence & smrtRead, const vector<SMRTSequence> & subreads) { assert(subreads.size() > 0); DNALength hqStart = 0, hqEnd = 0; for(auto subread: subreads) { hqStart = min(DNALength(subread.SubreadStart()), hqStart); hqEnd = max(DNALength(subread.SubreadEnd()), hqEnd); } smrtRead.Free(); smrtRead.Allocate(hqEnd); memset(smrtRead.seq, 'N', sizeof(char) * hqEnd); smrtRead.lowQualityPrefix = hqStart; smrtRead.lowQualitySuffix = smrtRead.length - hqEnd; smrtRead.highQualityRegionScore = subreads[0].highQualityRegionScore; smrtRead.HoleNumber(subreads[0].HoleNumber()); stringstream ss; ss << SMRTTitle(subreads[0].GetTitle()).MovieName() << "/" << subreads[0].HoleNumber(); smrtRead.CopyTitle(ss.str()); for (auto subread: subreads) { memcpy(&smrtRead.seq[subread.SubreadStart()], &subread.seq[0], sizeof(char) * subread.length); } }