def get_arguments():
parser = argparse.ArgumentParser(description='FASTQ filter tool',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('input_fastq', type=str,
help='FASTQ file of reads to be filtered (can be gzipped)')
parser.add_argument('--min_length', type=int, default=0,
help='Exclude reads shorter than this length (in bp)')
parser.add_argument('--min_mean_qual', type=float, default=0.0,
help='Exclude reads with a mean qscore less than this value')
parser.add_argument('--min_qual_window', type=float, default=0.0,
help='Exclude reads where their mean qscore in a sliding window drops '
'below this value')
parser.add_argument('--window_size', type=int, default=50,
help='The size of the sliding window used for --min_qual_window')
parser.add_argument('--target_bases', type=int, default=None,
help='If set, exclude the worst reads (as judged by their minimum qscore '
'in a sliding window) such that only this many bases remain')
args = parser.parse_args()
args.input_fastq = os.path.abspath(args.input_fastq)
if not os.path.isfile(args.input_fastq):
sys.exit('Error: could not find ' + args.input_fastq)
if args.min_length == 0 and args.min_mean_qual == 0.0 and args.min_qual_window == 0.0 and \
args.target_bases is None:
sys.exit('Error: no filters were used so this tool refuses to run (because the output\n'
' FASTQ would be identical to the input FASTQ). Please use one of the\n'
' following filters: --min_length, --min_mean_qual, --min_qual_window\n'
' or --target_bases.')
return args
评论列表
文章目录