def _run_sibelia(fasta_files, block_size, out_dir): logger.info("Running Sibelia with block size " + str(block_size)) if not utils.which(SIBELIA_EXEC): raise BackendException("Sibelia is not installed") devnull = open(os.devnull, "w") cmdline = [SIBELIA_EXEC, "-s", "fine", "-m", str(block_size), "-o", out_dir] cmdline.extend(fasta_files) subprocess.check_call(cmdline, stdout=devnull) os.remove(os.path.join(out_dir, "d3_blocks_diagram.html")) shutil.rmtree(os.path.join(out_dir, "circos")) return os.path.join(out_dir, "genomes_permutations.txt")
def check_binary(): """ Checks if the native binary is available and runnable """ binary = which(OVERLAP_EXEC) if not binary: logger.error("\"%s\" native module not found", OVERLAP_EXEC) return False try: devnull = open(os.devnull, "w") subprocess.check_call([OVERLAP_EXEC, "--help"], stderr=devnull) except subprocess.CalledProcessError as e: logger.error("Some error inside native module: %s", str(e)) return False return True
def _run_sibelia(fasta_files, block_size, out_dir): logger.info("Running Sibelia with block size %d", block_size) if not utils.which(SIBELIA_EXEC): raise BackendException("Sibelia is not installed") stagefile = os.path.join(out_dir, "stagefile.txt") _make_stagefile(config.vals["sibelia"], stagefile) devnull = open(os.devnull, "w") cmdline = [SIBELIA_EXEC, "--nopostprocess", "--stagefile", stagefile, "--minblocksize", str(block_size), "--outdir", out_dir] cmdline.extend(fasta_files) subprocess.check_call(cmdline, stdout=devnull) os.remove(stagefile) os.remove(os.path.join(out_dir, "d3_blocks_diagram.html")) shutil.rmtree(os.path.join(out_dir, "circos"))
def _run_sibelia(fasta_files, block_size, out_dir): logger.info("Running Sibelia with block size " + str(block_size)) if not utils.which(SIBELIA_EXEC): raise BackendException("Sibelia is not installed") stagefile = os.path.join(out_dir, "stagefile.txt") _make_stagefile(config.vals["sibelia"], stagefile) devnull = open(os.devnull, "w") cmdline = [SIBELIA_EXEC, "--nopostprocess", "--stagefile", stagefile, "--minblocksize", str(block_size), "--outdir", out_dir] cmdline.extend(fasta_files) subprocess.check_call(cmdline, stdout=devnull) os.remove(stagefile) os.remove(os.path.join(out_dir, "d3_blocks_diagram.html")) shutil.rmtree(os.path.join(out_dir, "circos"))
def check_binary(): """ Checks if the native binary is available and runnable """ binary = which(OVERLAP_EXEC) if not binary: logger.error("\"{0}\" native module not found".format(OVERLAP_EXEC)) return False try: devnull = open(os.devnull, "w") subprocess.check_call([OVERLAP_EXEC, "--help"], stderr=devnull) except subprocess.CalledProcessError as e: logger.error("Some error inside native {0} module: {1}" .format(OVERLAP_EXEC, e)) return False return True
def _run_sibelia(fasta_files, block_size, out_dir): logger.info("Running Sibelia with block size " + str(block_size)) if not utils.which(SIBELIA_EXEC): raise BackendException("Sibelia is not installed") devnull = open(os.devnull, "w") cmdline = [ SIBELIA_EXEC, "-s", "fine", "-m", str(block_size), "-o", out_dir ] cmdline.extend(fasta_files) subprocess.check_call(cmdline, stdout=devnull) os.remove(os.path.join(out_dir, "d3_blocks_diagram.html")) shutil.rmtree(os.path.join(out_dir, "circos")) return os.path.join(out_dir, "genomes_permutations.txt")
def check_binary(): """ Checks if native binary is available and runnable """ binary = which(M2S_EXEC) if not binary: logger.error("\"{0}\" native module not found".format(M2S_EXEC)) return False try: devnull = open(os.devnull, "w") subprocess.check_call([M2S_EXEC, "-h"], stderr=devnull) except subprocess.CalledProcessError as e: logger.error("Some error inside native {0} module: {1}".format( M2S_EXEC, e)) return False return True
subprocess.check_call(cmdline, stdout=open(target_fasta, "w")) self.target_fasta = target_fasta logger.info("Converting HAL to MAF") out_maf = os.path.join(workdir, "alignment.maf") ref_genome = recipe["target"] #Tricky notation, huh? export_genomes = ",".join(recipe["genomes"]) cmdline = [HAL2MAF, recipe["hal"], out_maf, "--noAncestors", "--numProc", str(self.threads), "--refGenome", ref_genome, "--targetGenomes", export_genomes] logger.debug(" ".join(cmdline)) subprocess.check_call(cmdline, stdout=open(os.devnull, "w")) logger.info("Extracting synteny blocks from MAF") if not m2s.make_synteny(out_maf, workdir, self.blocks): raise BackendException("Something went wrong with maf2synteny") for block_size in self.blocks: block_dir = os.path.join(workdir, str(block_size)) coords_file = os.path.join(block_dir, "blocks_coords.txt") files[block_size] = os.path.abspath(coords_file) if not os.path.exists(coords_file): raise BackendException("Something bad happened!") return files if utils.which(HAL2MAF) and utils.which(HAL2FASTA) and utils.which(HAL_STATS): SyntenyBackend.register_backend("hal", HalBackend())
def _check_installation(): return bool(utils.which(SIBELIA_EXEC))