From: Alec W. <al...@br...> - 2013-12-10 13:49:55
|
Hi Mathias, I'm surprised you're having this problem. What you're doing sounds perfectly reasonable to me. One thing I will mention tangentially, although I doubt it has anything to do with the problem, is that you probably want to ensure that the new SAMFileHeader you create has the same read groups, program records, etc., and that the easiest way to do that is to call SAMFileHeader.clone() on the original header, and then modify the new one as appropriate. Anyway, this is what I would try with respect to your problem. Run the program with a debugger. Set a breakpoint in BAMRecordCodec line 135, on the call to getVariableBinaryRepresentation, when you are writing one of the problematic records to the output. Step into this method. mBinaryDataStale should be true, because you modified the Cigar string on the record, so the method should return null. Set a breakpoint in BAMRecordCodec line 161, where it calls getBinaryAttributes. Step into this method. If you haven't accessed any of the attributes, then mAttributesDecoded should be false, and decodeAttributes() will be called. Step into decodeAttributes(). At this point you should see attributes being created and stored on the SAMRecord. Let me know what you find. -Alec On Dec 10, 2013, at 5:57 AM, Mathias Lesche <mat...@bi...> wrote: > Hello, > > > I hope this is the correct mailing list because I'm using the picard > API. If not I will post it on the help list. > > I'm having a problem with a script that I wrote using the picard API. I > use the latest version 1.04. Basically I want to split a bam file into > two files which works fine. The parameter for the split depends on which > reference the reads aligns to. > The problem I'm having is when I set the sort order of the header to > coordinate. > > new_header.setSortOrder(SAMFileHeader.SortOrder.coordinate); > > Now for SAMrecords which I don't change (the go into file a) the > attributes (SAMRecord.SAMTagAndValue) are still in each SAMrecord. > The SAMRecord.SAMTagAndValue disappear for SAMrecords which I change. I > modify the ReferenceIndex and the Cigar object. > > I already checked the attributes via the 'getAttributes()' of a > SAMrecord and they are listed before I add the SAMrecord to > SAMFileWriter instance. But they are not written back to the file. > > This only happens when I use coordinate as sort order. If I use unsorted > or queryname the attributes are written back. > > Is there any way on how I can trace this further? Because right now I > don't now how to find the error. > > Best > Mathias Lesche > > ------------------------------------------------------------------------------ > Sponsored by Intel(R) XDK > Develop, test and display web and hybrid apps with a single code base. > Download it for free now! > http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk > _______________________________________________ > Samtools-devel mailing list > Sam...@li... > https://lists.sourceforge.net/lists/listinfo/samtools-devel |