Skip to content

Commit

Permalink
- Removed legacy unsupported options from the help to avoid users
Browse files Browse the repository at this point in the history
  from crashing the application.
- Fixed a bug in the Smith-Waterman aligner which clamped the
  reported alignment score in the tags to 0 or 254. The MAPQ
  score was correct.
  • Loading branch information
cegonse committed Apr 25, 2017
1 parent a0fc4ac commit 69b9e62
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 24 deletions.
3 changes: 2 additions & 1 deletion lib/bioinfo-libs/aligners/bwt/bwt_bs.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,9 @@ interval_t* __bwt_map_inexact_read_bs_new(fastq_read_t *read,
size_t len = end_read - start_read + 1;
size_t len_calc = len;

//Only a entire read can be mapped, if not the read will be included in an anchor
// Only a entire read can be mapped, if not the read will be included in an anchor
bool mapp = true;

if (len < total_read_len) {
mapp = false;
}
Expand Down
28 changes: 14 additions & 14 deletions src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,18 +330,18 @@ void** argtable_options_new(void) {
argtable[2] = arg_int0("l", "log-level", NULL, "Log debug level");
argtable[3] = arg_lit0(NULL, "report-all", "Report all alignments");
argtable[4] = arg_file0("o", "outdir", NULL, "Output directory");
argtable[5] = arg_int0(NULL, "gpu-threads", NULL, "(OBSOLETE) Number of GPU Threads");
argtable[5] = arg_int0(NULL, " ", NULL, " ");
argtable[6] = arg_int0(NULL, "cpu-threads", NULL, "Number of CPU Threads");
argtable[7] = arg_int0("r", "index-ratio", NULL, "BWT index compression ratio");
argtable[8] = arg_int0(NULL, "cal-seeker-errors", NULL, "(OBSOLETE) Number of errors in CAL Seeker");
argtable[8] = arg_int0(NULL, " ", NULL, " ");
argtable[9] = arg_int0(NULL, "min-cal-size", NULL, "Minimum CAL size");
argtable[10] = arg_int0(NULL, "max-distance-seeds", NULL, "Maximum distance between seeds");
argtable[11] = arg_int0(NULL, "read-batch-size", NULL, "Batch Size");
argtable[12] = arg_int0(NULL, "write-batch-size", NULL, "Write Size");
argtable[13] = arg_int0(NULL, "num-cal-seekers", NULL, "(OBSOLETE) Number of CAL Seekers");
argtable[14] = arg_int0(NULL, "extra-seed-left-padding", NULL, "(OBSOLETE) Nucleotides padding of left min seed");
argtable[15] = arg_int0(NULL, "extra-seed-right-padding", NULL, "(OBSOLETE) Nucleotides padding of right min seed");
argtable[16] = arg_file0(NULL, "transcriptome-file", NULL, "(OBSOLETE) Transcriptome file to help search splice junctions");
argtable[13] = arg_int0(NULL, " ", NULL, " ");
argtable[14] = arg_int0(NULL, " ", NULL, " ");
argtable[15] = arg_int0(NULL, " ", NULL, " ");
argtable[16] = arg_file0(NULL, " ", NULL, " ");
argtable[17] = arg_int0(NULL, "seed-size", NULL, "Number of nucleotides in a seed");
argtable[18] = arg_int0(NULL, "min-seed-size", NULL, "Minimum number of nucleotides in a seed");
argtable[19] = arg_int0(NULL, "cal-flank-size", NULL, "Flank length for CALs");
Expand All @@ -350,23 +350,23 @@ void** argtable_options_new(void) {
argtable[22] = arg_dbl0(NULL, "sw-gap-open", NULL, "Gap open penalty for Smith-Waterman algorithm");
argtable[23] = arg_dbl0(NULL, "sw-gap-extend", NULL, "Gap extend penalty for Smith-Waterman algorithm");
argtable[24] = arg_dbl0(NULL, "sw-min-score", NULL, "Minimum score for valid mappings");
argtable[25] = arg_int0(NULL, "max-intron-size", NULL, "(OBSOLETE) Maximum intron size");
argtable[26] = arg_int0(NULL, "min-intron-size", NULL, "(OBSOLETE) Minimum intron size");
argtable[25] = arg_int0(NULL, " ", NULL, " ");
argtable[26] = arg_int0(NULL, " ", NULL, " ");
argtable[27] = arg_lit0("t", "time", "Timming mode active");
argtable[28] = arg_lit0("s", "stats", "Statistics mode active");
argtable[29] = arg_lit0("h", "help", "Help option");
argtable[30] = arg_str0(NULL, "prefix", NULL, "File prefix name");
argtable[31] = arg_file0("g", "ref-genome", NULL, "Reference genome");
argtable[32] = arg_file0("j", "fq2,fastq2", NULL, "(OBSOLETE) Reads file input #2 (for paired mode)");
argtable[33] = arg_int0(NULL, "paired-mode", NULL, "(OBSOLETE) Pair mode: 0 = single-end, 1 = paired-end, 2 = mate-pair [Default 0]");
argtable[34] = arg_int0(NULL, "paired-min-distance", NULL, "(OBSOLETE) Minimum distance between pairs");
argtable[35] = arg_int0(NULL, "paired-max-distance", NULL, "(OBSOLETE) Maximum distance between pairs");
argtable[32] = arg_file0(" ", " ", NULL, " ");
argtable[33] = arg_int0(NULL, " ", NULL, " ");
argtable[34] = arg_int0(NULL, " ", NULL, " ");
argtable[35] = arg_int0(NULL, " ", NULL, " ");
argtable[36] = arg_int0(NULL, "report-n-best", NULL, "Report the <n> best alignments");
argtable[37] = arg_int0(NULL, "report-n-hits", NULL, "Report <n> hits");
argtable[38] = arg_int0(NULL, "num-seeds", NULL, "Number of seeds per read");
argtable[39] = arg_int0(NULL, "min-num-seeds", NULL, "Minimum number of seeds to create a CAL (if -1, the maxixum will be taken)");
argtable[40] = arg_lit0(NULL, "gpu-enable", "(OBSOLETE) Enable GPU Process");
argtable[41] = arg_lit0(NULL, "report-only-paired", "(OBSOLETE) Report only the paired reads");
argtable[40] = arg_lit0(NULL, " ", " ");
argtable[41] = arg_lit0(NULL, " ", " ");
argtable[42] = arg_int0(NULL, "filter-read-mappings", NULL, "Reads that map in more than <n> locations are discarded");
argtable[43] = arg_int0(NULL, "filter-seed-mappings", NULL, "Seeds that map in more than <n> locations are discarded");
argtable[44] = arg_lit0(NULL, "report-best", "Report all alignments with best score");
Expand Down
13 changes: 4 additions & 9 deletions src/sw_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,13 +620,8 @@ void apply_sw_bs_4nt(sw_server_input_t* input, batch_t *batch) {

alignment_t *alignment;
array_list_t *alignment_list;

// Kept for legacy reasons, using the tag object list now
// Should be refactored in the future
char *optional_fields = NULL;
int optional_fields_length = 100;

array_list_t **mapping_lists;

size_t num_targets;
size_t *targets;

Expand Down Expand Up @@ -706,14 +701,14 @@ void apply_sw_bs_4nt(sw_server_input_t* input, batch_t *batch) {
strdup(new_cigar_code_string(cigar_code)),
cigar_code_get_num_ops(cigar_code),
norm_score * 254, 1, (num_cals > 1),
optional_fields_length, optional_fields, alignment);
0, NULL, alignment);

// set optional fields
// Set optional fields
bam_tag_t* as_tag = bam_tag_init(AS_TAG_NAME, BAM_TAG_TYPE_INT, 0, 0);
bam_tag_t* nh_tag = bam_tag_init(NH_TAG_NAME, BAM_TAG_TYPE_INT, 0, 0);
bam_tag_t* nm_tag = bam_tag_init(NM_TAG_NAME, BAM_TAG_TYPE_INT, 0, 0);

bam_int_t AS = (bam_int_t) norm_score * 100;
bam_int_t AS = (bam_int_t) (norm_score * 100.0);
bam_int_t NH = num_cals;
bam_int_t NM = cigar_code->distance;

Expand Down

0 comments on commit 69b9e62

Please sign in to comment.