From 972a0e3067e70cbf08b7e3b09337fbcdfbd9274a Mon Sep 17 00:00:00 2001 From: Nikhil Joshi Date: Mon, 23 Feb 2015 16:22:52 -0800 Subject: [PATCH] fixed bug where optional arguments should have been required arguments --- README.md | 8 ++++---- src/trim_paired.c | 30 ++++++++++++++---------------- src/trim_single.c | 19 ++++++++----------- 3 files changed, 26 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 99f8fa0..268063b 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ truncation of sequences with Ns. sickle se -f input_file.fastq -t illumina -o trimmed_output_file.fastq -q 33 -l 40 sickle se -f input_file.fastq -t illumina -o trimmed_output_file.fastq -x -n sickle se -t sanger -g -f input_file.fastq -o trimmed_output_file.fastq.gz - sickle se --fastq-file=input_file.fastq --qual-type=sanger --output-file=trimmed_output_file.fastq + sickle se --fastq-file input_file.fastq --qual-type sanger --output-file trimmed_output_file.fastq ### Sickle Paired End (`sickle pe`) @@ -136,6 +136,6 @@ enable truncation of sequences with Ns. sickle pe -c combo.fastq -t sanger -M combo_trimmed_all.fastq - sickle pe --pe-file1=input_file1.fastq --pe-file2=input_file2.fastq --qual-type=sanger \ - --output-pe1=trimmed_output_file1.fastq --output-pe2=trimmed_output_file2.fastq \ - --output-single=trimmed_singles_file.fastq + sickle pe --pe-file1 input_file1.fastq --pe-file2 input_file2.fastq --qual-type sanger \ + --output-pe1 trimmed_output_file1.fastq --output-pe2 trimmed_output_file2.fastq \ + --output-single trimmed_singles_file.fastq diff --git a/src/trim_paired.c b/src/trim_paired.c index fd3160b..dcf2eb1 100644 --- a/src/trim_paired.c +++ b/src/trim_paired.c @@ -18,20 +18,20 @@ int paired_length_threshold = 20; static struct option paired_long_options[] = { {"qual-type", required_argument, 0, 't'}, - {"pe-file1", optional_argument, 0, 'f'}, - {"pe-file2", optional_argument, 0, 'r'}, - {"pe-combo", optional_argument, 0, 'c'}, - {"output-pe1", optional_argument, 0, 'o'}, - {"output-pe2", optional_argument, 0, 'p'}, - {"output-single", optional_argument, 0, 's'}, - {"output-combo", optional_argument, 0, 'm'}, - {"qual-threshold", optional_argument, 0, 'q'}, - {"length-threshold", optional_argument, 0, 'l'}, - {"no-fiveprime", optional_argument, 0, 'x'}, - {"truncate-n", optional_argument, 0, 'n'}, - {"gzip-output", optional_argument, 0, 'g'}, - {"output-combo-all", optional_argument, 0, 'M'}, - {"quiet", optional_argument, 0, 'z'}, + {"pe-file1", required_argument, 0, 'f'}, + {"pe-file2", required_argument, 0, 'r'}, + {"pe-combo", required_argument, 0, 'c'}, + {"output-pe1", required_argument, 0, 'o'}, + {"output-pe2", required_argument, 0, 'p'}, + {"output-single", required_argument, 0, 's'}, + {"output-combo", required_argument, 0, 'm'}, + {"qual-threshold", required_argument, 0, 'q'}, + {"length-threshold", required_argument, 0, 'l'}, + {"no-fiveprime", no_argument, 0, 'x'}, + {"truncate-n", no_argument, 0, 'n'}, + {"gzip-output", no_argument, 0, 'g'}, + {"output-combo-all", required_argument, 0, 'M'}, + {"quiet", no_argument, 0, 'z'}, {GETOPT_HELP_OPTION_DECL}, {GETOPT_VERSION_OPTION_DECL}, {NULL, 0, NULL, 0} @@ -45,8 +45,6 @@ void paired_usage (int status, char *msg) { fprintf(stderr, "Usage: %s pe [options] -c -t -m -s \n\n\ If you have one file with interleaved reads as input and you want ONLY one interleaved file as output:\n\ Usage: %s pe [options] -c -t -M \n\n", PROGRAM_NAME, PROGRAM_NAME); - fprintf(stderr, "Finally, if you are using the long-style options, make sure to use an equals sign (=) with the option:\n\ -Usage: %s pe [options] --pe-file1= --pe-file2= --qual-type= --output-pe1= --output-pe2= --output-single=\n\n", PROGRAM_NAME); fprintf(stderr, "Options:\n\ Paired-end separated reads\n\ --------------------------\n\ diff --git a/src/trim_single.c b/src/trim_single.c index ce83a01..2f59921 100644 --- a/src/trim_single.c +++ b/src/trim_single.c @@ -19,12 +19,12 @@ static struct option single_long_options[] = { {"fastq-file", required_argument, 0, 'f'}, {"output-file", required_argument, 0, 'o'}, {"qual-type", required_argument, 0, 't'}, - {"qual-threshold", optional_argument, 0, 'q'}, - {"length-threshold", optional_argument, 0, 'l'}, - {"no-fiveprime", optional_argument, 0, 'x'}, - {"discard-n", optional_argument, 0, 'n'}, - {"gzip-output", optional_argument, 0, 'g'}, - {"quiet", optional_argument, 0, 'z'}, + {"qual-threshold", required_argument, 0, 'q'}, + {"length-threshold", required_argument, 0, 'l'}, + {"no-fiveprime", no_argument, 0, 'x'}, + {"discard-n", no_argument, 0, 'n'}, + {"gzip-output", no_argument, 0, 'g'}, + {"quiet", no_argument, 0, 'z'}, {GETOPT_HELP_OPTION_DECL}, {GETOPT_VERSION_OPTION_DECL}, {NULL, 0, NULL, 0} @@ -34,13 +34,10 @@ void single_usage(int status, char *msg) { fprintf(stderr, "\nUsage: %s se [options] -f -t -o \n\ \n\ -If you are using the long-style options, make sure to use an equals sign (=) with the option:\n\ -Usage: sickle se [options] --fastq-file= --qual-type= --output-file=\n\n", PROGRAM_NAME); - -fprintf(stderr, "Options:\n\ +Options:\n\ -f, --fastq-file, Input fastq file (required)\n\ -t, --qual-type, Type of quality values (solexa (CASAVA < 1.3), illumina (CASAVA 1.3 to 1.7), sanger (which is CASAVA >= 1.8)) (required)\n\ --o, --output-file, Output trimmed fastq file (required)\n"); +-o, --output-file, Output trimmed fastq file (required)\n", PROGRAM_NAME); fprintf(stderr, "-q, --qual-threshold, Threshold for trimming based on average quality in a window. Default 20.\n\ -l, --length-threshold, Threshold to keep a read based on length after trimming. Default 20.\n\