def __init__(self, fq1, adapter3, path_out=None, len_min=15, fq2=None, **kwargs): """Parsing the parameters for reads trimming support both SE and PE reads """ assert isinstance(fq1, str) # process one file args = args_init(kwargs) # default parameters # print(args) args['fq1'] = fq1 args['fq2'] = fq2 args['adapter3'] = adapter3 args['path_out'] = path_out args['len_min'] = len_min ## validate options assert is_path(path_out) if args['cut_to_length'] > 0 and args['cut_to_length'] < len_min: raise Exception( 'illegal length, --trim-to-length %s --len-min %s' % (args['cut_to_length'], len_min)) self.kwargs = args # global
def main(): args = args_init(vars(get_args()), align=True) # save as dictionary # log.info('aaaaa') # args['align_to_te'] = True ## run alignment map_bam_list = Alignment(**args).run()
def main(): logging.info('Demultiplexing: start') args = args_init(vars(get_args()), demx=True, trim=False, align=False, call_peak=False) # save as dictionary Demx(**args).run() logging.info('Delumtiplexing: finish')
def __init__(self, fq1, sample_info, path_out, demx_type='p7', **kwargs): args1 = args_init(kwargs, demx=True, trim=False, align=False, call_peak=False) args2 = { 'fq1': fq1, 'sample_info': sample_info, 'path_out': path_out, 'demx_type': demx_type } self.kwargs = {**args1, **args2} assert is_path(path_out)
def main(): ## prepare arguments args = args_init(vars(get_args()), bam2bw=True) # print(args) if isinstance(args['bam'], str): if isinstance(args['scale'], float): pass else: raise Exception('--bam, --scale, not in the same length') elif isinstance(args['bam'], list): if isinstance(args['scale'], list) and len(args['scale']) == 1: pass elif isinstance(args['scale'], list) and len(args['bam']) == len(args['scale']): pass else: raise Exception('--bam, --scale, not in the same length') else: pass ## functions bam_files = args.pop('bam', None) path_out = args.pop('path_out', None) scale_list = args.pop('scale', None) if len(scale_list) == 1 and len(bam_files) > 1: scale_list = scale_list * len(bam_files) elif len(scale_list) == len(bam_files): pass else: sys.exit('lenght of --scale and -b are not equal') # scale_list = args.pop('scale', None) ## program for bam_file in bam_files: i = bam_files.index(bam_file) scale = scale_list[i] ## strand if args['filterRNAstrand'] == 'both': ## forward strand args['filterRNAstrand'] = 'forward' bam2bw(bam_file, path_out, scale, **args) ## reverse strand args['filterRNAstrand'] = 'reverse' bam2bw(bam_file, path_out, scale, **args) ## reset args['filterRNAstrand'] = 'both' else: bam2bw(bam_file, path_out, scale, **args)
def main(): # args = vars(get_args()) # save as dictionary args = args_init(vars(get_args()), trim=True, align=False, call_peak=False) # save as dictionary fq1_files = args.pop('fq1', None) # remove 'fq1' ## update arguments args_lib = args_default(args['library_type']) args = {**args, **args_lib} log.info('trimming start') ## SE mode if args['fq2'] is None: for fq1 in fq1_files: tmp = Trimmer(fq1=fq1, **args).trimmer() ## PE mode else: fq2_files = args.pop('fq2', None) # remove 'fq2' for fq1, fq2 in zip(fq1_files, fq2_files): tmp = Trimmer(fq1=fq1, fq2=fq2, **args).trimmer() log.info('trimming finish')
def main(): args = args_init(vars(get_args()), align=True) if args['design'] is None: # require -c1, -t1, -g if args['c1'] is None or args['t1'] is None: log.error('require --design, or -c1, -t1') else: if not supportedGenome(args['genome']): log.error('genome not supported: {}'.foramt(args['genome'])) run(args) else: design = DesignReader(args['design']) # save to file design.to_json() # search dict d = design.to_dict() for k in d: log.info(k) dict_k = d[k] args['c1'], args['c2'] = dict_k['control'] args['t1'], args['t2'] = dict_k['treatment'] args['c2'] = args['c2'] if len(args['c2']) > 0 else None args['t2'] = args['t2'] if len(args['t2']) > 0 else None args['C'] = dict_k['control_name'] args['T'] = dict_k['treatment_name'] args['genome'] = dict_k['genome'] args['path_out'] = dict_k['path_out'] args['spikein'] = dict_k['spikein'] ## supported if not supportedGenome(args['genome']): log.info('genome not supported: {}'.format(args['genome'])) continue run(args)