simon-anders / htseq

HTSeq is a Python library to facilitate processing and analysis of data from high-throughput sequencing (HTS) experiments.
https://htseq.readthedocs.io/en/release_0.11.1/
GNU General Public License v3.0
122 stars 77 forks source link

[feat,GenomicIntervalDeque,CigarOperation] #80

Closed shouldsee closed 4 years ago

shouldsee commented 5 years ago

Dear Devs, I recently found this library provides a very nice way to parse CIGAR, and wrote a snippet to implement a representation of a transcript. I am wondering whether any similar functionality exists? Or is GenomicInterval the most beloved class to use?

class GenomicIntervalDeque(collections.deque):
    '''
    An ordered iterable of HTSeq.GenomicInterval(), intended to represent a transcript.

    property:
        cigarstring: inherited from an alignment if applicable
        iv: merge contained intervals to a big GenomicInterval()

    method:
        defaults inherited from collections.deque 
        fromCigar: init from parsing a cigar string 
        fromAlignment: init from parsing pysam.AlignedSegment().cigarstring
        countMissWithModel: assuming self is a read, count mismatch against a model
        countMissWithRead: assuming self is a model, ccount mismatch against a read
        (deprecated) compatibleWithModel: assuming self is a read, check compatibility against a model
        (deprecated) compatibleWithRead: assuming self is a model, check compatibility against a read

    '''

I guess it's good to tie this to CigarOperation() class, but I can't seem to find good document on how to initialise it or manipulate it except this page. Is there anything more comprehensive? I found HTSeq.parse_cigar() quite helpful but again I found it poorly documented... And I did not see anything like HTSeq.write_cigar.

BTW, I am developing on Python2.

PS: None of the class seems to allow simple shifting of coordinate e.g. GenomicInterval(), GenomicArray() .

Kind regards Feng

iosonofabio commented 4 years ago

Good point, I added more documentation on the constructor in that section of the docs. Closing.