ragtag_utilities/ScaffoldGraph.py
def add_agps(self, in_agps, in_weights=None, exclusion_set=None):
        """
        Update the graph given AGP files.
        :param in_agps: A list of AGP files
        :param in_weights: A list of weights for the AGP files
        :param exclusion_set: set of components to skip
        """
        if exclusion_set is None:
            exclusion_set = set()

        if in_weights is None:
            in_weights = [1] * len(in_agps)
        else:
            if len(in_agps) != len(in_weights):
                raise ValueError("Must assign one weight per AGP file, or none at all.")

        # Iterate through the AGP files to update the graph
        for agp, weight in zip(in_agps, in_weights):
            agp = os.path.abspath(agp)
            if agp in self.agps:
                raise ValueError("%s appears more than once." % agp)

            # Add this AGP and its weight to the master list
            self.agps.append(agp)
            self.weights.append(weight)

            for ap in self._get_assembly_points(agp, weight):
                for u, v, w in ap.get_realizations():
                    if u[:-2] not in exclusion_set and v[:-2] not in exclusion_set:
                        u_base, v_base = u[:-2], v[:-2]
                        u_len = self.get_component_len(u_base)
                        self.add_edge(
                            u,
                            v,
                            weight=w,
                            source_fname=ap.source_agp_fname,
                            is_known_gap_size=ap.is_known_gap_size,
                            gap_size=ap.gap_size,
                            gap_type=ap.gap_type,
                            linkage=ap.linkage,
                            linkage_evidence=ap.linkage_evidence,
                            seqs=[u_base, v_base],
                            pos=[u_len, 0]
                        )

        Update the graph given AGP files.
        :param in_agps: A list of AGP files
        :param in_weights: A list of weights for the AGP files
        :param exclusion_set: set of components to skip
        
Update the graph given AGP files.
Update the graph given AGP files .
def add_agps(self, in_agps, in_weights=None, exclusion_set=None):
        if exclusion_set is None:
            exclusion_set = set()
        if in_weights is None:
            in_weights = [1] * len(in_agps)
        else:
            if len(in_agps) != len(in_weights):
                raise ValueError("Must assign one weight per AGP file, or none at all.")
        for agp, weight in zip(in_agps, in_weights):
            agp = os.path.abspath(agp)
            if agp in self.agps:
                raise ValueError("%s appears more than once." % agp)
            self.agps.append(agp)
            self.weights.append(weight)
            for ap in self._get_assembly_points(agp, weight):
                for u, v, w in ap.get_realizations():
                    if u[:-2] not in exclusion_set and v[:-2] not in exclusion_set:
                        u_base, v_base = u[:-2], v[:-2]
                        u_len = self.get_component_len(u_base)
                        self.add_edge(
                            u,
                            v,
                            weight=w,
                            source_fname=ap.source_agp_fname,
                            is_known_gap_size=ap.is_known_gap_size,
                            gap_size=ap.gap_size,
                            gap_type=ap.gap_type,
                            linkage=ap.linkage,
                            linkage_evidence=ap.linkage_evidence,
                            seqs=[u_base, v_base],
                            pos=[u_len, 0]
                        )
def add_agps ( self , in_agps , in_weights = None , exclusion_set = None ) : if exclusion_set is None : exclusion_set = set ( ) if in_weights is None : in_weights = [ 1 ] * len ( in_agps ) else : if len ( in_agps ) != len ( in_weights ) : raise ValueError ( "Must assign one weight per AGP file, or none at all." ) for agp , weight in zip ( in_agps , in_weights ) : agp = os . path . abspath ( agp ) if agp in self . agps : raise ValueError ( "%s appears more than once." % agp ) self . agps . append ( agp ) self . weights . append ( weight ) for ap in self . _get_assembly_points ( agp , weight ) : for u , v , w in ap . get_realizations ( ) : if u [ : - 2 ] not in exclusion_set and v [ : - 2 ] not in exclusion_set : u_base , v_base = u [ : - 2 ] , v [ : - 2 ] u_len = self . get_component_len ( u_base ) self . add_edge ( u , v , weight = w , source_fname = ap . source_agp_fname , is_known_gap_size = ap . is_known_gap_size , gap_size = ap . gap_size , gap_type = ap . gap_type , linkage = ap . linkage , linkage_evidence = ap . linkage_evidence , seqs = [ u_base , v_base ] , pos = [ u_len , 0 ] )
Update the graph given AGP files.
Update the graph given AGP files .
"""
        Update the graph given AGP files.
        :param in_agps: A list of AGP files
        :param in_weights: A list of weights for the AGP files
        :param exclusion_set: set of components to skip
        """ # Iterate through the AGP files to update the graph # Add this AGP and its weight to the master list
self
in_agps
A list of AGP files
A list of AGP files
in_weights
A list of weights for the AGP files
A list of weights for the AGP files
exclusion_set
set of components to skip
set of components to skip