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'
self.chr=chr
self.size=self.stop-self.start+1
def __str__(self):
return f"id={self.id}, position on the original genome={self.chr}:{self.start}-{self.stop}, size={self.size}, features={self.features}"
class Feature:

nina.marthe_ird.fr
committed
def __init__(self,id,type,chr,start,stop,annot,childs,parent,seg_list,strand,complete):
self.id=id
self.type=type
self.chr=chr
NMarthe
committed
self.strand=strand

nina.marthe_ird.fr
committed
self.pos_start=0 # position on the first segment, setup later
self.pos_stop=0 # position on the last segment, setup later
self.annot=annot
self.childs=childs # liste of child features (exons, cds, etc)
self.parent=parent

nina.marthe_ird.fr
committed
self.segments_list_source=seg_list # list of oriented segments on which the feature is (>s1/<s1, depending on the path of the gene in the graph)
self.segments_list_target=[] # list of lists, as there can be several occurences of a feature on a given target genome
self.sequence=""

nina.marthe_ird.fr
committed
self.complete=complete # boolean, is the feature initialised with all the info or not
def __str__(self):
if self.parent=="":
return f"id={self.id}, type={self.type}, segments={self.segments_list_source}, position on the original genome={self.chr}:{self.start}-{self.stop}, childs={self.childs}, annotation={self.annot}"
else:
return f"id={self.id}, type={self.type}, segments={self.segments_list_source}, position on the original genome={self.chr}:{self.start}-{self.stop}, parent={self.parent}, childs={self.childs}, annotation={self.annot}"