Skip to content
Snippets Groups Projects
ClassSegFeat.py 1.82 KiB
Newer Older
class Segment:
    def __init__(self,id,feature,chr,start,stop):
        self.id=id
        self.features=feature # list of the features on this segment. if the feature is on the + strand, it will be named '+feature_id', else '-feature_id'
NMarthe's avatar
NMarthe committed
        # position on the original genome
        self.chr=chr
        self.start=int(start)
        self.stop=int(stop)
        
        self.size=self.stop-self.start+1
        
    def __str__(self):
NMarthe's avatar
NMarthe committed
        return f"id={self.id}, position on the original genome={self.chr}:{self.start}-{self.stop}, size={self.size}, features={self.features}"
    def __init__(self,id,type,chr,start,stop,annot,childs,parent,seg,strand):
NMarthe's avatar
NMarthe committed
        # position on the original genome
        self.chr=chr
        self.start=int(start)
        self.stop=int(stop)
        self.pos_start=0 # position on the first segment
        self.pos_stop=0 # position on the last segment
        self.childs=childs # liste of child features (exons, cds, etc)
        self.segments_list=seg # list of oriented segments on which the feature is (>s1/<s1, depending on the path of the gene in the graph)
NMarthe's avatar
NMarthe committed
            return f"id={self.id}, type={self.type}, segments={self.segments_list}, position on the original genome={self.chr}:{self.start}-{self.stop}, childs={self.childs}, annotation={self.annot}"
NMarthe's avatar
NMarthe committed
            return f"id={self.id}, type={self.type}, segments={self.segments_list}, position on the original genome={self.chr}:{self.start}-{self.stop}, parent={self.parent}, childs={self.childs}, annotation={self.annot}"