Mercurial > repos > iuc > multigps
comparison multigps.py @ 4:0bec3b2df784 draft
Uploaded
| author | iuc |
|---|---|
| date | Mon, 03 Apr 2017 14:07:14 -0400 |
| parents | 91127c200437 |
| children |
comparison
equal
deleted
inserted
replaced
| 3:d78ff3764fe5 | 4:0bec3b2df784 |
|---|---|
| 23 parser.add_argument('--fixedpb', dest='fixedpb', type=int, default=None, help='Fixed per-base limit') | 23 parser.add_argument('--fixedpb', dest='fixedpb', type=int, default=None, help='Fixed per-base limit') |
| 24 parser.add_argument('--fixedscaling', dest='fixedscaling', type=float, default=None, help='Multiply control counts by total tag count ratio and then by this factor') | 24 parser.add_argument('--fixedscaling', dest='fixedscaling', type=float, default=None, help='Multiply control counts by total tag count ratio and then by this factor') |
| 25 parser.add_argument('--format', dest='format', default=None, help='Input expt file data format') | 25 parser.add_argument('--format', dest='format', default=None, help='Input expt file data format') |
| 26 parser.add_argument('--gaussmodelsmoothing', dest='gaussmodelsmoothing', default=None, help='Use Gaussian model smoothing') | 26 parser.add_argument('--gaussmodelsmoothing', dest='gaussmodelsmoothing', default=None, help='Use Gaussian model smoothing') |
| 27 parser.add_argument('--gausssmoothparam', dest='gausssmoothparam', type=int, default=None, help='Smoothing factor') | 27 parser.add_argument('--gausssmoothparam', dest='gausssmoothparam', type=int, default=None, help='Smoothing factor') |
| 28 parser.add_argument('--input_item', dest='input_items', action='append', nargs=7, default=None, help="Input files, attributes and options") | 28 parser.add_argument('--input_item', dest='input_items', action='append', nargs=8, default=None, help="Input files, attributes and options") |
| 29 parser.add_argument('--jointinmodel', dest='jointinmodel', default=None, help='Allow joint events in model updates') | 29 parser.add_argument('--jointinmodel', dest='jointinmodel', default=None, help='Allow joint events in model updates') |
| 30 parser.add_argument('--mappability', dest='mappability', type=float, default=None, help='Fraction of the genome that is mappable for these experiments') | 30 parser.add_argument('--mappability', dest='mappability', type=float, default=None, help='Fraction of the genome that is mappable for these experiments') |
| 31 parser.add_argument('--maxtrainingrounds', dest='maxtrainingrounds', type=int, default=None, help='Maximum number of training rounds for updating binding event read distributions') | 31 parser.add_argument('--maxtrainingrounds', dest='maxtrainingrounds', type=int, default=None, help='Maximum number of training rounds for updating binding event read distributions') |
| 32 parser.add_argument('--medianscale', dest='medianscale', default=None, help='Use the median signal/control ratio as the scaling factor') | 32 parser.add_argument('--medianscale', dest='medianscale', default=None, help='Use the median signal/control ratio as the scaling factor') |
| 33 parser.add_argument('--meme1proc', dest='meme1proc', default=None, help='Do not run the parallel version of meme') | 33 parser.add_argument('--meme1proc', dest='meme1proc', default=None, help='Do not run the parallel version of meme') |
| 64 parser.add_argument('--threads', dest='threads', type=int, default=4, help='The number of threads to run') | 64 parser.add_argument('--threads', dest='threads', type=int, default=4, help='The number of threads to run') |
| 65 args = parser.parse_args() | 65 args = parser.parse_args() |
| 66 | 66 |
| 67 | 67 |
| 68 def generate_design_file(input_items): | 68 def generate_design_file(input_items): |
| 69 control_file_names = [] | |
| 69 design_file = open(DESIGN_FILE, 'w') | 70 design_file = open(DESIGN_FILE, 'w') |
| 70 for item in input_items: | 71 for item in input_items: |
| 71 file_name, label, file_format, condition_name, replicate_name, experiment_type, fixed_read_count = item | 72 experiment_file_name, control_file_name, label, file_format, condition_name, replicate_name, experiment_type, fixed_read_count = item |
| 73 if control_file_name not in ['None', None, '']: | |
| 74 control_file_names.append(control_file_name) | |
| 72 file_format = file_format.upper() | 75 file_format = file_format.upper() |
| 73 items = [file_name, label, file_format, condition_name] | 76 items = [experiment_file_name, label, file_format, condition_name] |
| 74 if replicate_name not in ['None', None, '']: | 77 if replicate_name not in ['None', None, '']: |
| 75 items.append(replicate_name) | 78 items.append(replicate_name) |
| 76 if experiment_type not in ['None', None, '']: | 79 if experiment_type not in ['None', None, '']: |
| 77 items.append(experiment_type) | 80 items.append(experiment_type) |
| 78 if fixed_read_count not in ['None', None, '']: | 81 if fixed_read_count not in ['None', None, '']: |
| 79 items.append(fixed_read_count) | 82 items.append(fixed_read_count) |
| 80 design_file.write('%s\n' % '\t'.join(items)) | 83 design_file.write('%s\n' % '\t'.join(items)) |
| 81 design_file.close() | 84 design_file.close() |
| 85 return control_file_names | |
| 82 | 86 |
| 83 | 87 |
| 84 def get_file_with_extension(dir, ext): | 88 def get_file_with_extension(dir, ext): |
| 85 file_list = [f for f in os.listdir(dir) if f.endswith(ext)] | 89 file_list = [f for f in os.listdir(dir) if f.endswith(ext)] |
| 86 if len(file_list) == 1: | 90 if len(file_list) == 1: |
| 139 if args.meme1proc is not None: | 143 if args.meme1proc is not None: |
| 140 # Do not run the parallel version of meme. | 144 # Do not run the parallel version of meme. |
| 141 cmd += ' --meme1proc' | 145 cmd += ' --meme1proc' |
| 142 # Experiment. | 146 # Experiment. |
| 143 if args.input_items is not None: | 147 if args.input_items is not None: |
| 144 generate_design_file(args.input_items) | 148 control_file_names = generate_design_file(args.input_items) |
| 145 cmd += ' --design %s' % DESIGN_FILE | 149 cmd += ' --design %s' % DESIGN_FILE |
| 150 if len(control_file_names) > 0: | |
| 151 cmd += ' --ctrl %s' % ','.join(control_file_names) | |
| 146 else: | 152 else: |
| 147 if args.expt is not None: | 153 if args.expt is not None: |
| 148 cmd += ' --expt %s' % args.expt | 154 cmd += ' --expt %s' % args.expt |
| 149 if args.format is not None: | 155 if args.format is not None: |
| 150 cmd += ' --format %s' % args.format | 156 cmd += ' --format %s' % args.format |
