def create_gmap_reference(reference_dir, reference_path, reference_name, parameters=None): 'It creates the reference fpath' cmd = ['gmap_build', '-B', get_external_bin_dir(), '-D', reference_dir, '-d', reference_name] if parameters and 'kmer' in parameters: cmd.extend(['-k', str(parameters['kmer'])]) cmd.append(reference_path) call(cmd,raise_on_error=True) fpath = '%s.coords' % reference_name if os.path.exists(fpath): os.remove(fpath)
def _modify_gmap_makefile(makefile): 'It modifies the gmap makefile to use proper binaries' fhand = NamedTemporaryFile(delete=False) bin_dir = get_external_bin_dir() for line in open(makefile): if line.startswith('FA_COORDS'): line = 'FA_COORDS = %s/fa_coords\n' % bin_dir if line.startswith('MD_COORDS'): line = 'MD_COORDS = %s/md_coords\n' % bin_dir if line.startswith('GMAP_PROCESS'): line = 'GMAP_PROCESS = %s/gmap_process\n' % bin_dir if line.startswith('GMAPINDEX'): line = 'GMAPINDEX = %s/gmapindex\n' % bin_dir if line.startswith('PMAPINDEX'): line = 'PMAPINDEX = %s/pmapindex\n' % bin_dir fhand.write(line) fhand.flush() shutil.move(fhand.name, makefile)