Ejemplo n.º 1
0
 def makecompletegraph(self):
     """
     """
     OrganismGraph.makecompletegraph(self)
     for u,v in self.weights.keys():
         if not self._edge_binary_entropies.has_key((u,v)):
             self._edge_binary_entropies[(u,v)] = (1.0,1.0)
Ejemplo n.º 2
0
    def __init__(self,tcode_5p_windowsize=201,tcode_3p_windowsize=201):
        """
		Initialize a AlignedStartCodonGraph
        """
        OrganismGraph.__init__(self)
        self._tcode5pscore = {}
        self._tcode3pscore = {}
        self._TCODE_5P_WINDOWSIZE = tcode_5p_windowsize
        self._TCODE_3P_WINDOWSIZE = tcode_3p_windowsize
Ejemplo n.º 3
0
 def __init__(self,max_node_count=None,min_pssm_score=None,aligned_site_aa_offset=None):
     """
     Initialize a AlignedPssmObjectGraph 
     """
     OrganismGraph.__init__(self)
     self._node_pssm = {}
     self._node_object = {}
     self.MIN_PSSM_SCORE = min_pssm_score
     self.MAX_NODE_COUNT = max_node_count
     self.ALIGNED_SITE_AA_OFFSET = aligned_site_aa_offset
Ejemplo n.º 4
0
 def __init__(self):
     """
     Initialize a GeneTreeGraph 
     """
     # Initialize as an OrganismGraph
     OrganismGraph.__init__(self)
     # self.weights contains identityscores
     # add similar dicts for aa_identity, bitscore_ratios and nt_identity
     self._aa_identity_percentages = {}
     self._bitscore_ratios         = {} 
     self._nt_identity_percentages = {}
Ejemplo n.º 5
0
 def __init__(self):
     """
     Initialize a GeneTreeGraph 
     """
     # Initialize as an OrganismGraph
     OrganismGraph.__init__(self)
     # self.weights contains identityscores
     # add similar dicts for aa_identity, bitscore_ratios and nt_identity
     self._aa_identity_percentages = {}
     self._bitscore_ratios = {}
     self._nt_identity_percentages = {}
Ejemplo n.º 6
0
    def __init__(self):
        """
		Initialize a PacbpCollectionGraph
        """
        # Initialize as an OrganismGraph
        OrganismGraph.__init__(self)
        # set extra attributes
        self._node_object = {}
        self._node_pssm = {}

        # needed for backwards compatibilty with PacbpCollectionGraph, CodingBlockGraph
        self.pacbps = {}
        self._omsr = {}
Ejemplo n.º 7
0
 def pairwisecrosscombinations_organism(self,order_by=None):
     """
     Get unique cross combinations of organisms in the graph, ordered on request
 
     @rtype:  list
     @return: list of all unique combinations of two organisms
 
     @attention: returns ORDERED list of ORDERED tuples of organism combinations
     @attention: orderability overwrites OrganismGraph.pairwisecrosscombinations_organism
     @attention: use order_by='identity' to obtain identity ordering except alphabetical
     """
     if order_by == 'identity':
         combinations = []
         for a in self.organism_set():
             for b in self.organism_set():
                 if a == b: continue
                 combi = [a,b]
                 combi.sort()
                 if combi == [a,b]:
                     wt = self.weights[(a,b)]
                     combinations.append( ( wt, tuple(combi) ) )
         # return the ordered (by wt) list of unique combinations
         combinations.sort()
         combinations.reverse()
         return [ combi for (wt,combi) in combinations ]
     else:
         # return basal (alphabetical) ordered pairs of organisms
         return OrganismGraph.pairwisecrosscombinations_organism(self)
Ejemplo n.º 8
0
 def pairwisecrosscombinations_organism(self, order_by=None):
     """
     Get unique cross combinations of organisms in the graph, ordered on request
 
     @rtype:  list
     @return: list of all unique combinations of two organisms
 
     @attention: returns ORDERED list of ORDERED tuples of organism combinations
     @attention: orderability overwrites OrganismGraph.pairwisecrosscombinations_organism
     @attention: use order_by='identity' to obtain identity ordering except alphabetical
     """
     if order_by == 'identity':
         combinations = []
         for a in self.organism_set():
             for b in self.organism_set():
                 if a == b: continue
                 combi = [a, b]
                 combi.sort()
                 if combi == [a, b]:
                     wt = self.weights[(a, b)]
                     combinations.append((wt, tuple(combi)))
         # return the ordered (by wt) list of unique combinations
         combinations.sort()
         combinations.reverse()
         return [combi for (wt, combi) in combinations]
     else:
         # return basal (alphabetical) ordered pairs of organisms
         return OrganismGraph.pairwisecrosscombinations_organism(self)
Ejemplo n.º 9
0
    def __init__(self):
        """
        Initialize a PssmObjectCollectionGraph; objects on orfs on pacbporfs (splice sites, start sites, stop sites)
        """
        OrganismGraph.__init__(self)
        self._node_pssm     = {}
        self._node_object   = {}
        self.MIN_PSSM_SCORE = None
        # list to store aligned sites graphs
        self.alignedsites = []
        # dictionary keeping track of considered range
        self._organism_consideredrange = {}

        # Attributes storing information for thresholds of 
        # how this collection was generated
        self.ALIGNED_SITE_AA_OFFSET = None
        self.MIN_PSSM_SCORE = None
Ejemplo n.º 10
0
    def __init__(self,cbg,tcode_5p_windowsize=201,tcode_3p_windowsize=201):
        """
        Initialize a AlignedStopCodonGraph
        """
        OrganismGraph.__init__(self)
        # attribute for storing the CBG itself
        self._codingblockgraph = cbg 
        # attributes for TCODE data
        self._tcode5pscore = {}
        self._tcode3pscore = {}
        self._TCODE_5P_WINDOWSIZE = tcode_5p_windowsize
        self._TCODE_3P_WINDOWSIZE = tcode_3p_windowsize

        # is_optimal_xxx thresholds
        self._optimal_min_tcode      = ALIGNEDSTOPCODONGRAPH_OPTIMALITY_MIN_TCODE
        self._optimal_max_tcode      = ALIGNEDSTOPCODONGRAPH_OPTIMALITY_MAX_TCODE
        self._optimal_min_weight     = ALIGNEDSTOPCODONGRAPH_OPTIMALITY_MIN_WEIGHT
        self._optimal_max_weight     = ALIGNEDSTOPCODONGRAPH_OPTIMALITY_MAX_WEIGHT 
        self._optimal_min_gtgweakest = ALIGNEDSTOPCODONGRAPH_OPTIMALITY_MIN_GTGWEAKEST
        self._optimal_max_gtgweakest = ALIGNEDSTOPCODONGRAPH_OPTIMALITY_MAX_GTGWEAKEST

        # run function codingblock_collectionharvesting.align_stop_codons
        # to fully initialize the object
        self = codingblock_collectionharvesting.align_stop_codons(cbg,self)
Ejemplo n.º 11
0
    def __init__(self, cbg, tcode_5p_windowsize=201, tcode_3p_windowsize=201):
        """
        Initialize a AlignedStopCodonGraph
        """
        OrganismGraph.__init__(self)
        # attribute for storing the CBG itself
        self._codingblockgraph = cbg
        # attributes for TCODE data
        self._tcode5pscore = {}
        self._tcode3pscore = {}
        self._TCODE_5P_WINDOWSIZE = tcode_5p_windowsize
        self._TCODE_3P_WINDOWSIZE = tcode_3p_windowsize

        # is_optimal_xxx thresholds
        self._optimal_min_tcode = ALIGNEDSTOPCODONGRAPH_OPTIMALITY_MIN_TCODE
        self._optimal_max_tcode = ALIGNEDSTOPCODONGRAPH_OPTIMALITY_MAX_TCODE
        self._optimal_min_weight = ALIGNEDSTOPCODONGRAPH_OPTIMALITY_MIN_WEIGHT
        self._optimal_max_weight = ALIGNEDSTOPCODONGRAPH_OPTIMALITY_MAX_WEIGHT
        self._optimal_min_gtgweakest = ALIGNEDSTOPCODONGRAPH_OPTIMALITY_MIN_GTGWEAKEST
        self._optimal_max_gtgweakest = ALIGNEDSTOPCODONGRAPH_OPTIMALITY_MAX_GTGWEAKEST

        # run function codingblock_collectionharvesting.align_stop_codons
        # to fully initialize the object
        self = codingblock_collectionharvesting.align_stop_codons(cbg, self)
Ejemplo n.º 12
0
 def add_edge(self, u, v, wt=1, entropy=1.0):
     """
     """
     OrganismGraph.add_edge(self,u,v,wt=wt)
     self._edge_binary_entropies[(u,v)] = (entropy,entropy)
     self._edge_binary_entropies[(v,u)] = (entropy,entropy)