def process_nxmate_reads(dataset_data, dst, log): try: import lucigen_nxmate new_dataset_data = list() for reads_library in dataset_data: new_reads_library = dict(reads_library) if new_reads_library['type'] == 'nxmate': raw_left_reads = new_reads_library['left reads'] raw_right_reads = new_reads_library['right reads'] new_reads_library['left reads'] = [] new_reads_library['right reads'] = [] new_reads_library['single reads'] = [] for id, left_reads_fpath in enumerate(raw_left_reads): right_reads_fpath = raw_right_reads[id] processed_left_reads_fpath, processed_right_reads_fpath, single_reads_fpath = \ lucigen_nxmate.process_reads(left_reads_fpath, right_reads_fpath, dst, log) new_reads_library['left reads'].append( processed_left_reads_fpath) new_reads_library['right reads'].append( processed_right_reads_fpath) new_reads_library['single reads'].append( single_reads_fpath) new_reads_library['type'] = 'mate-pairs' new_reads_library['orientation'] = 'fr' new_dataset_data.append(new_reads_library) return new_dataset_data except ImportError: error( "Can't process Lucigen NxMate reads! lucigen_nxmate.py is missing!", log)
def process_nxmate_reads(dataset_data, dst, log): try: import lucigen_nxmate new_dataset_data = list() for reads_library in dataset_data: new_reads_library = dict(reads_library) if new_reads_library['type'] == 'nxmate': raw_left_reads = new_reads_library['left reads'] raw_right_reads = new_reads_library['right reads'] new_reads_library['left reads'] = [] new_reads_library['right reads'] = [] new_reads_library['single reads'] = [] for id, left_reads_fpath in enumerate(raw_left_reads): right_reads_fpath = raw_right_reads[id] processed_left_reads_fpath, processed_right_reads_fpath, single_reads_fpath = \ lucigen_nxmate.process_reads(left_reads_fpath, right_reads_fpath, dst, log) new_reads_library['left reads'].append(processed_left_reads_fpath) new_reads_library['right reads'].append(processed_right_reads_fpath) new_reads_library['single reads'].append(single_reads_fpath) new_reads_library['type'] = 'mate-pairs' new_reads_library['orientation'] = 'fr' new_dataset_data.append(new_reads_library) return new_dataset_data except ImportError: error("Can't process Lucigen NxMate reads! lucigen_nxmate.py is missing!", log)
def main(): args = parse_args() # create logger log = logging.getLogger("Preprocess Lucigen NxMate reads") log.setLevel(logging.DEBUG) console = logging.StreamHandler(sys.stdout) console.setFormatter(logging.Formatter("%(message)s")) console.setLevel(logging.DEBUG) log.addHandler(console) try: with open(args.args_filename) as f: lines = f.readlines() for infile1, infile2 in zip(lines[0::2], lines[1::2]): lucigen_nxmate.process_reads(infile1, infile2, args.dst, log, args.threads) except ImportError: support.error( "can't process Lucigen NxMate reads! lucigen_nxmate.py is missing!", log)