Hi Bernd, what do you mean it is changed? Is the wrong value written to the file? Is it changed in the program itself? Are you writing SAM or BAM? Can you provide a minimal program that shows the problem? Second, I guess the function signature should be: template<typename TStream, typename TFormat> int writeOutRecordSet(TStream &fp, String<BamAlignmentRecord> const & recSet, BamIOContext<StringSet<CharString> > & context, TFormat const & tag, ROI & roi) { - StringSet<BamAlignmentRecord> & recSet -> String<BamAlignmentRecord> const & recSet Cheers! Manuel ________________________________________ From: Bernd Jagla [bernd.jagla@pasteur.fr] Sent: Wednesday, May 16, 2012 9:55 AM To: seqan-dev@lists.fu-berlin.de Subject: [Seqan-dev] mapQ overwritten when writing sam/bam? Hi, I am using the sam/bam packages to read and write sam/bam files and I noticed that a value for the mapping quality (column 5) has been changed from 255 to 0... Is this possible? I am using the BamIOContext as in the following example: template<typename TStream, typename TFormat> int writeOutRecordSet(TStream &fp, StringSet<BamAlignmentRecord> recSet, BamIOContext<StringSet<CharString> > & context, TFormat const & tag, ROI & roi) { unsigned maxC = 0; for (unsigned i = 0; i < length(roi.count); i++) { if (maxC < roi.count[i]) maxC = roi.count[i]; } roi.countMax = maxC; for (unsigned i = 0; i < length(recSet); i++) { BamTagsDict tagDict(recSet[i].tags); setTagValue(tagDict, "rl", roi.len); setTagValue(tagDict, "ri", roi.min); setTagValue(tagDict, "rx", roi.max); setTagValue(tagDict, "ry", maxC); setTagValue(tagDict, "rn", length(recSet), 'i'); write2(fp, recSet[i], context, tag); } return maxC; } What do I have to do to keep the value? Thanks a lot for your kind support. Best, Bernd _______________________________________________ seqan-dev mailing list seqan-dev@lists.fu-berlin.de https://lists.fu-berlin.de/listinfo/seqan-dev