SplitReadAll_lite.c: don't segfault when we run SplitReadAll_lite with an incorrect number of arguments.
Also display a help text instead.
--- a/SplitReadAll_lite.c
+++ b/SplitReadAll_lite.c
@@ -30,6 +30,40 @@ int main(int argc, char** argv) {
int distance;
int readlen;
+
+ // Print help and exit if we don't get 14 parameters from the command line.
+ if (argc != 15) {
+ printf("\n%s\n\n"
+ " <split_reference> The reference sequence for mapping of the split reads.\n"
+ " <whole_reference> The reference sequence for the mapping of the whole\n"
+ " reads. It is usually the same as the previous one.\n"
+ " <target definition> The bed file for the regions to be captured. This is\n"
+ " not necessary unless read depth is used.\n"
+ " <read_len> The read length for the whole reads.\n"
+ " <whole_read edit_distance> Edit distance for the whole reads. 6%% of the\n"
+ " read length is recommended.\n"
+ " <split_read edit_distance> Edit distance for the split reads. It is usually\n"
+ " half of the whole read edit_distance.\n"
+ " <lower_insert_size> The lower limit for the span size. The read length is\n"
+ " recommended.\n"
+ " <upper_insert_size> The upper limit for the span size. It is recommended\n"
+ " as 500 but can be adjusted more accuratly for better\n"
+ " results.\n"
+ " <max_size discordant_mappings>\n"
+ " The upper bound for detecting deletions. Recommended\n"
+ " setting is 10000000.\n"
+ " <fasta_ref_index> The .fai file for the reference sequence.\n"
+ " <input_FASTQ> FASTQ file for the whole reads.\n"
+ " <output_match> The output filename for the mapped whole reads.\n"
+ " <output_unmapped> The output filename for the unmapped whole reads.\n"
+ " <prefix_split_mapping> The prefix for the output files from the split\n"
+ " mappings.\n\n",
+ argv[0]);
+
+ exit(1);
+ }
+
+
cmd = (char *)malloc(sizeof(char)*1000);
ref = (char *)malloc(sizeof(char)*1000);
seq = (char *)malloc(sizeof(char)*1000);