benedictpaten / marginAlign

UCSC Nanopore
MIT License
42 stars 13 forks source link

marginsStats #48

Open mmiladi opened 5 years ago

mmiladi commented 5 years ago

Hello,

I am trying to use marginStats to collect alignment stats from minimap2 aligned data of a direct RNA sample, this error is reported:

...
Detected a discrepancy between the absolute read                     sequence and the aligned read sequence. Bases: U A,                     read-position: 107, is reversed: True, absolute read offset: -118,                     length absolute read sequence 924, length aligned read sequence 118,                     length aligned read sequence plus soft clipping 118, read name: 7caac1dc-f0c6-4ee8-9cd4-d52e29d4e9ed,                     cigar string 805H20M1I2M3I3M1I8M1D37M1D31M2D12M1H
Traceback (most recent call last):
  File "./src/margin/marginStats.py", line 111, in <module>
    main()
  File "./src/margin/marginStats.py", line 78, in main
    referenceFastaFile, globalAlignment=not options.localAlignment)
  File "/home/ubuntu/marginAlign/src/margin/utils.py", line 382, in getReadAlignmentStats
    refSequences[sam.getrname(aR.rname)], aR, globalAlignment), samIterator(sam))
  File "/home/ubuntu/marginAlign/src/margin/utils.py", line 382, in <lambda>
    refSequences[sam.getrname(aR.rname)], aR, globalAlignment), samIterator(sam))
  File "/home/ubuntu/marginAlign/src/margin/utils.py", line 308, in __init__
    for aP in AlignedPair.iterator(alignedRead, self.refSeq, self.readSeq):
  File "/home/ubuntu/marginAlign/src/margin/utils.py", line 262, in iterator
    assert len(alignedSegment.query_sequence) <= len(readSeq)
TypeError: object of type 'NoneType' has no len()
mitenjain commented 5 years ago

Are you using a minimap2 with -ax map-ont settings? And did you remove the secondary and supplementary alignments?

marginStats presently works with primary alignments only (and with -ax map-ont setting). If you do use chaining within marginStats it does the cleaning up of the sam file itself.

Hope this is useful.

mmiladi commented 5 years ago

Thanks much for pointing this out. No I had not excluded the secondary alignments as default was -N=5. About the minimap2 I used -x splice -k 14 -uf, wouldn't -x map-ont run a splice-unaware alignment?

If you do use chaining within marginStats it does the cleaning up of the sam file itself.

Is the chaining an option of the marginStats binary?

mitenjain commented 5 years ago

Yes, marginAlign can chain the alignments to the most contiguous alignment per read. Presently, this only works with the splice unaware alignments (-ax map-ont). Chaining and realignment are enabled by default. You can use --noChain and --noRealign to turn one or both of them off independently.

When measuring stats for splice-aware alignments, I instead use a trancriptome reference at this point and use that along with splice unaware alignments.

The ability to compute stats in splice aware alignments is under development atm.