def __init__(self): """ Initialize a CodingBlockGraph """ # Initialize from PacbpCollectionGraph PacbpCollectionGraph.__init__(self) # short name tag for printing self._short_name = "IWPCBG" # some GLOBAL variables that are required in class functions #self.ALTERNATIVE_ALIGNMENT_OVERLAP_RATIO = alternative_alignment_overlap_ratio # 08/04/09 smallest omsr size must be 3 (means 4 AAs overall aligned) # this is defined in settings.codingblockgraph #self.MINIMAL_OVERAL_SPANNING_RANGE_SIZE = minimal_overal_spanning_range_size # attribute needed to set the GeneTreeGraph into #self._GENETREE = None # attributes to cache OMSR and related data structures self._omsr = {} # Overall Minimal Spanning Range self._msr = {} # Minimal Spanning Range self._maxsr = {} # MAXimal Spanning Range
def __init__( self, alternative_alignment_overlap_ratio=ALTERNATIVE_ALIGNMENT_OVERLAP_RATIO ): """ Initialize a LowSimilarityRegionCodingBlockGraph """ # Initialize from PacbpCollectionGraph, NOT from CodingBlockGraph PacbpCollectionGraph.__init__(self) self._node_object = {} # in use for orf objects self.pacbps = {} # optional, not required # N.B. key of pacbps is different as # in CodingBlockGraph. # NOT: (pacb_identifier, node1, node2) # BUT: (node1, node2) # short name tag for printing self._short_name = "lsrCBG" # set special attributes needed self._splicedonorgraph = None self._spliceacceptorgraph = None self._stopcodongraph = None self._startcodongraph = None # dicts for data of VISTA like tracks self._paoc_per_organism = {} # attribute stays EMPTY!! self._pasc_per_organism = {} # attribute stays EMPTY!! # attribute needed to set the GeneTreeGraph into self._GENETREE = None # attribute for cexpanderanalyses data self._cexpander = None # attributes that are needed once added into a genestructure self.IS_FIRST = False self.IS_LAST = False self.IS_IGNORED = False self.IS_SPLITTED = True # this class is always IS_SPLITTED self.IS_5P_SPLITTED = True # this class is always IS_SPLITTED self.IS_3P_SPLITTED = True # this class is always IS_SPLITTED # set LowSimilarityRegion specific attributes self._omsr = {} self._forced_3p_ends = {} self._forced_5p_ends = {}
def has_edge(self,u,v): """ OVERRIDES GraphPlus.has_edge() """ if len(self.nodes) == 2 and ( self.weights.keys() == [(u,v),(v,u)] or self.weights.keys() == [(v,u),(u,v)] ): # hmm.... escape. Weights are okay, nut nodes not. # Temporarily allow this; it can happen in InwardsPointingCodingblockGraphs return True else: return PacbpCollectionGraph.has_edge(self,u,v)
def CodingBlockGraph2PacbpCollectionGraph(cbg): """ Convert CodingBlockGraph 2 PacbpCollectionGraph -> a backwards conversion! @attention: function just converts, error check is not performed here! @type cbg: CodingBlockGraph @param cbg: CodingBlockGraph instance @rtype: PacbpCollectionGraph @return: PacbpCollectionGraph instance """ from graph_pacbpcollection import PacbpCollectionGraph pcg = PacbpCollectionGraph() pcg.nodes = deepcopy(cbg.nodes) pcg.weights = deepcopy(cbg.weights) pcg.pacbps = deepcopy(cbg.pacbps) return pcg
def __init__(self,alternative_alignment_overlap_ratio=ALTERNATIVE_ALIGNMENT_OVERLAP_RATIO): """ Initialize a LowSimilarityRegionCodingBlockGraph """ # Initialize from PacbpCollectionGraph, NOT from CodingBlockGraph PacbpCollectionGraph.__init__(self) self._node_object = {} # in use for orf objects self.pacbps = {} # optional, not required # N.B. key of pacbps is different as # in CodingBlockGraph. # NOT: (pacb_identifier, node1, node2) # BUT: (node1, node2) # short name tag for printing self._short_name = "lsrCBG" # set special attributes needed self._splicedonorgraph = None self._spliceacceptorgraph = None self._stopcodongraph = None self._startcodongraph = None # dicts for data of VISTA like tracks self._paoc_per_organism = {} # attribute stays EMPTY!! self._pasc_per_organism = {} # attribute stays EMPTY!! # attribute needed to set the GeneTreeGraph into self._GENETREE = None # attribute for cexpanderanalyses data self._cexpander = None # attributes that are needed once added into a genestructure self.IS_FIRST = False self.IS_LAST = False self.IS_IGNORED = False self.IS_SPLITTED = True # this class is always IS_SPLITTED self.IS_5P_SPLITTED = True # this class is always IS_SPLITTED self.IS_3P_SPLITTED = True # this class is always IS_SPLITTED # set LowSimilarityRegion specific attributes self._omsr = {} self._forced_3p_ends = {} self._forced_5p_ends = {}
def has_edge(self, u, v): """ OVERRIDES GraphPlus.has_edge() """ if len(self.nodes) == 2 and (self.weights.keys() == [(u, v), (v, u)] or self.weights.keys() == [(v, u), (u, v)]): # hmm.... escape. Weights are okay, nut nodes not. # Temporarily allow this; it can happen in InwardsPointingCodingblockGraphs return True else: return PacbpCollectionGraph.has_edge(self, u, v)