| 16 | FASTPLONG_PY_VERSION = "0.0.1" |
| 17 | |
| 18 | def parseCommand(): |
| 19 | usage = "A python script to use fastplong to preprocess all FASTQ files within a folder" |
| 20 | parser = OptionParser(usage = usage, version = FASTPLONG_PY_VERSION) |
| 21 | parser.add_option("-i", "--input_dir", dest = "input_dir", default = ".", |
| 22 | help = "the folder contains the FASTQ files to be preprocessed, by default is current dir (.)") |
| 23 | parser.add_option("-o", "--out_dir", dest = "out_dir", default = None, |
| 24 | help = "the folder to store the clean FASTQ. If not specified, then there will be no output files.") |
| 25 | parser.add_option("-r", "--report_dir", dest = "report_dir", default = None, |
| 26 | help = "the folder to store QC reports. If not specified, use out_dir if out_dir is specified, otherwise use input_dir.") |
| 27 | parser.add_option("-c", "--command", dest = "command", default = None, |
| 28 | help = "the path to fastplong command, if not specified, then it will use 'fastplong' in PATH") |
| 29 | parser.add_option("-a", "--args", dest = "args", default = None, |
| 30 | help = "the arguments that will be passed to fastplong. Enclose in quotation marks. Like --args='-f 3 -t 3' ") |
| 31 | parser.add_option("-p", "--parallel", dest = "parallel", default = None, type = "int", |
| 32 | help = "the number of fastplong processes can be run in parallel, if not specified, then it will be CPU_Core/4") |
| 33 | return parser.parse_args() |
| 34 | |
| 35 | def matchFlag(filename, flag): |
| 36 | if flag.endswith('.') or flag.endswith('_') or flag.endswith('-'): |