def __init__(self, maf, ancestor, ancestor_fasta, phylo, outDir="ragout_out", scale="large", outLog="ragout_log", is_overwrite=True, is_debug=True, is_resolve_repeats=False, is_solid_scaffolds=False): self.maf = maf self.ancestor = ancestor self.ancestor_seqs = read_fasta_dict(ancestor_fasta) self.scale = scale self.debug = is_debug self.outDir = "_".join([outDir, ancestor]) self.backend = SyntenyBackend.backends["maf"] self.overwrite = is_overwrite self.logger = enable_logging("_".join([outLog, ancestor]), is_debug) self.debugger = DebugConfig.get_instance() self.is_solid_scaffolds = is_solid_scaffolds self.is_resolve_repeats = is_resolve_repeats self.synteny_blocks = config.vals["blocks"][self.scale] if not os.path.isdir(self.outDir): os.mkdir(self.outDir) self._set_debugging() self._check_extern_modules() self._get_phylogeny_and_naming_ref(phylo) self._make_recipe(phylo) self._make_permutaion_files() self._make_run_stages() self._make_stage_perms() pass
""" This module infers missing adjacencies by recovering perfect matching """ from collections import namedtuple import logging import os from copy import copy import networkx as nx from ragout.shared.debug import DebugConfig logger = logging.getLogger() debugger = DebugConfig.get_instance() Adjacency = namedtuple("Adjacency", ["block", "distance", "supporting_genomes", "infinity"]) class AdjacencyInferer(object): def __init__(self, breakpoint_graph, phylogeny, ancestral = False): self.main_graph = breakpoint_graph self.phylogeny = phylogeny self.ancestral = ancestral def infer_adjacencies(self, debug=False, filename="adjacencies.txt"): """ Infers missing adjacencies by recovering perfect matching """ logger.info("Inferring missing adjacencies")