Skip to content

Commit

Permalink
Merge branch 'hotfix/1.13.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
David Jones committed Mar 15, 2018
2 parents 635c7e2 + 3f789df commit 6bba096
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 55 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGES

## 1.13.2

* Futher fixes for `sentinel` calls.
* * Correct versin of REQUIRED_MIN_LIBZ as we are looking for greater than.

## 1.13.1

* Ensure all `sentinel` calls return non-zero exit code.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CAVEMAN_VERSION=1.13.1
CAVEMAN_VERSION=1.13.2
TEST_REF?=""
#Compiler
CC?=gcc
Expand Down
2 changes: 1 addition & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

SOURCE_HTSLIB="https://github.com/samtools/htslib/releases/download/1.3.2/htslib-1.3.2.tar.bz2"

REQUIRED_MIN_LIBZ="1.2.3.5"
REQUIRED_MIN_LIBZ="1.2.3.4"

function version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }

Expand Down
2 changes: 1 addition & 1 deletion src/alg_bean.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ alg_bean_t *alg_bean_read_file(FILE *file){
bean->lane = lanes_list;
bean->lane_size = List_count(lanes_list);
}else{
sentinel("Unrecognised id passed: %s.",text_id,1);
sentinel("Unrecognised id passed: %s.",text_id);
}
}

Expand Down
10 changes: 6 additions & 4 deletions src/algos.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,22 +708,24 @@ int algos_estep_read_position(alg_bean_t *alg,long double ********prob_arr, char
}
//read_pos_t struct has copy number and ref base is a usable base.
if(pos->ref_base_idx >= 0 && pos->norm_cn > 0 && pos->tum_cn > 0){
int chk = 0;
//Adding to the counts at this position.
if(pos_t->normal == 1){
if(pos_t->strand == 1){
genotype_add_base_to_count(pos->norm_rev_cvg,toupper(seq_nt16_str[pos_t->called_base]));
chk = genotype_add_base_to_count(pos->norm_rev_cvg,toupper(seq_nt16_str[pos_t->called_base]));
}else{
genotype_add_base_to_count(pos->norm_fwd_cvg,toupper(seq_nt16_str[pos_t->called_base]));
chk = genotype_add_base_to_count(pos->norm_fwd_cvg,toupper(seq_nt16_str[pos_t->called_base]));
}
pos->total_cvg_norm++;
}else if(pos_t->normal == 0){
if(pos_t->strand == 1){
genotype_add_base_to_count(pos->tum_rev_cvg,toupper(seq_nt16_str[pos_t->called_base]));
chk = genotype_add_base_to_count(pos->tum_rev_cvg,toupper(seq_nt16_str[pos_t->called_base]));
}else{
genotype_add_base_to_count(pos->tum_fwd_cvg,toupper(seq_nt16_str[pos_t->called_base]));
chk = genotype_add_base_to_count(pos->tum_fwd_cvg,toupper(seq_nt16_str[pos_t->called_base]));
}
pos->total_cvg_tum++;
}
check(chk==0,"Error adding genotype to base count.");
//Get the index for things we'll use during analysis
int rpos_i,mq_i,bq_i,callbase_i;
int ok = algos_get_read_specific_indices(alg,pos_t,&rpos_i,&mq_i,&bq_i,&callbase_i);
Expand Down
2 changes: 1 addition & 1 deletion src/cn_access.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ int8_t cn_access_get_copy_number_for_location(char *file_loc,char *chr,uint32_t
}
}
}else{
sentinel("Somehow copy number for location %s:%d was not available.",chr,pos,1);
sentinel("Somehow copy number for location %s:%d was not available.",chr,pos);
}
return cn;
error:
Expand Down
5 changes: 2 additions & 3 deletions src/config_file_access.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ int config_file_access_read_config_file(FILE *file, char *tum_bam_file, char *no
char *chk = getcwd(cur_wd,size);
check(chk!=NULL,"Error retrieving CWD when reading config file.");
if(strcmp(cur_wd,value)!=0){
sentinel("Your current working directory '%s' is not the same as the directory you setup CaVEMan: '%s'. Please change to that directory and try again.",
cur_wd,value,1);
sentinel("Your current working directory '%s' is not the same as the directory you setup CaVEMan: '%s'. Please change to that directory and try again.",cur_wd,value);
}
}else if(strcmp(MUT_TUM,key)==0){
strcpy(tum_bam_file,value);
Expand Down Expand Up @@ -118,7 +117,7 @@ int config_file_access_read_config_file(FILE *file, char *tum_bam_file, char *no
}else if(strcmp(TUM_CN_KEY,key)==0){
strcpy(tum_cn,value);
}else{
sentinel("Unrecognised key in config file '%s'.",key,1);
sentinel("Unrecognised key in config file '%s'.",key);
}
}

Expand Down
37 changes: 19 additions & 18 deletions src/estep.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void estep_print_usage (int exit_code){
exit(exit_code);
}

void estep_setup_options(int argc, char *argv[]){
int estep_setup_options(int argc, char *argv[]){
const struct option long_opts[] =
{
{"config-file", required_argument, 0, 'f'},
Expand Down Expand Up @@ -200,7 +200,7 @@ void estep_setup_options(int argc, char *argv[]){

case 'M':
if(sscanf(optarg, "%i", &cn) != 1){
sentinel("Error parsing -M argument '%s'. Should be an integer > 0",optarg,1);
sentinel("Error parsing -M argument '%s'. Should be an integer > 0",optarg);
}
cn_access_set_max_cn(cn);
break;
Expand All @@ -215,79 +215,79 @@ void estep_setup_options(int argc, char *argv[]){

case 'n':
if(sscanf(optarg, "%i", &normal_copy_number) != 1){
sentinel("Error parsing -n argument '%s'. Should be an integer > 0",optarg,1);
sentinel("Error parsing -n argument '%s'. Should be an integer > 0",optarg);
}
break;

case 't':
if(sscanf(optarg, "%i", &tumour_copy_number) != 1){
sentinel("Error parsing -t argument '%s'. Should be an integer > 0",optarg,1);
sentinel("Error parsing -t argument '%s'. Should be an integer > 0",optarg);
}
break;

case 'i':
if(sscanf(optarg, "%i", &idx) != 1){
sentinel("Error parsing -i argument '%s'. Should be an integer > 0",optarg,1);
sentinel("Error parsing -i argument '%s'. Should be an integer > 0",optarg);
}
break;

case 'm':
if(sscanf(optarg, "%i", &min_bq) != 1){
sentinel("Error parsing -m argument '%s'. Should be an integer >= 0",optarg,1);
sentinel("Error parsing -m argument '%s'. Should be an integer >= 0",optarg);
}
break;

case 'k':
if(sscanf(optarg, "%f", &norm_contam) != 1){
sentinel("Error parsing -k argument '%s'. Should be a float >= 0.0.",optarg,1);
sentinel("Error parsing -k argument '%s'. Should be a float >= 0.0.",optarg);
}
break;

case 'd':
if(sscanf(optarg, "%f", &prior_snp_prob) != 1){
sentinel("Error parsing -d argument '%s'. Should be a float > 0.0.",optarg,1);
sentinel("Error parsing -d argument '%s'. Should be a float > 0.0.",optarg);
}
break;

case 'c':
if(sscanf(optarg, "%f", &prior_mut_prob) != 1){
sentinel("Error parsing -c argument '%s'. Should be a float > 0.0.",optarg,1);
sentinel("Error parsing -c argument '%s'. Should be a float > 0.0.",optarg);
}
break;

case 'b':
if(sscanf(optarg, "%f", &ref_bias) != 1){
sentinel("Error parsing -b argument '%s'. Should be a float >= 0.0.",optarg,1);
sentinel("Error parsing -b argument '%s'. Should be a float >= 0.0.",optarg);
}
break;

case 'p':
if(sscanf(optarg, "%f", &min_mut_prob) != 1){
sentinel("Error parsing -p argument '%s'. Should be a float >= 0.0.",optarg,1);
sentinel("Error parsing -p argument '%s'. Should be a float >= 0.0.",optarg);
}
break;

case 'q':
if(sscanf(optarg, "%f", &min_snp_prob) != 1){
sentinel("Error parsing -q argument '%s'. Should be a float >= 0.0.",optarg,1);
sentinel("Error parsing -q argument '%s'. Should be a float >= 0.0.",optarg);
}
break;

case 'x':
if(sscanf(optarg, "%i", &min_tum_cvg) != 1){
sentinel("Error parsing -x argument '%s'. Should be an integer > 0",optarg,1);
sentinel("Error parsing -x argument '%s'. Should be an integer > 0",optarg);
}
break;

case 'y':
if(sscanf(optarg, "%i", &min_norm_cvg) != 1){
sentinel("Error parsing -y argument '%s'. Should be an integer > 0",optarg,1);
sentinel("Error parsing -y argument '%s'. Should be an integer > 0",optarg);
}
break;

case 'a':
if(sscanf(optarg, "%i", &split_size) != 1){
sentinel("Error parsing -a argument '%s'. Should be an integer >= 0",optarg,1);
sentinel("Error parsing -a argument '%s'. Should be an integer >= 0",optarg);
}
break;

Expand Down Expand Up @@ -341,15 +341,16 @@ void estep_setup_options(int argc, char *argv[]){

set_max_tum_cvg(estep_max_tumour_coverage);

return;
return 0;

error:
estep_print_usage (1);
return;
return -1;
}

int estep_main(int argc, char *argv[]){
estep_setup_options(argc, argv);
int is_err = estep_setup_options(argc, argv);
check(is_err==0, "Error parsing options");

long double ********prob_arr = NULL;
alg_bean_t *alg = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/generateCavemanVCFUnmatchedNormalPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ List *gen_panel_get_list_of_samples_and_locs(){
bamchar = strtok(bam_file_locs,",");
LIST_FOREACH(samples, first, next, cur){
if(bamchar == NULL){
sentinel("List of sample names and bam locations are not equal in length.",1);
sentinel("List of sample names and bam locations are not equal in length.");
}
((sample_bam *)cur->value)->bam_file = malloc(sizeof(char) * (strlen(bamchar) + 1));
check_mem(((sample_bam *)cur->value)->bam_file);
Expand Down
17 changes: 10 additions & 7 deletions src/genotype.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ List *genotype_hard_copy_genotype_t_list(List *new_list, List *old){
return new_list;
}

void genotype_add_base_to_count(genotype_t *geno, const char base){
int genotype_add_base_to_count(genotype_t *geno, const char base){
assert(geno != NULL);
switch(base){
case 'A':
Expand All @@ -70,12 +70,12 @@ void genotype_add_base_to_count(genotype_t *geno, const char base){
break;

default:
sentinel("Incorrect base passed to add: %c",base,1);
sentinel("Incorrect base passed to add: %c",base);
break;
};
return;
return 0;
error:
return;
return -1;
}

void genotype_set_base_count(genotype_t *geno, const char base, int count){
Expand Down Expand Up @@ -226,14 +226,16 @@ List *genotype_calculate_genotypes(int copy_num, char *ref_base){
//Create 2 copies, one will be reference, the next will be mutant base.
genotype_t *gen1 = genotype_copy_genotype(gen);
genotype_t *gen2 = genotype_copy_genotype(gen1);
genotype_add_base_to_count(gen2,ref_base[0]);
int chk = genotype_add_base_to_count(gen2,ref_base[0]);
check(chk==0,"Error adding base to genotype count.");
List_push(tmp,gen2);
int j=0;
for(j=0; j<4; j++){
int base_count = genotype_get_base_count(gen1,bases[j]);
check(base_count >= 0, "Error fetching base count for base: %c with genotype: %s.",bases[j],genotype_get_genotype_t_as_string(gen1));
if(base_count>=1 && ref_base[0] != bases[j]){
genotype_add_base_to_count(gen1,bases[j]);
chk = genotype_add_base_to_count(gen1,bases[j]);
check(chk==0,"Error adding base to genotype count.");
List_push(tmp,gen1);
}
}
Expand All @@ -247,7 +249,8 @@ List *genotype_calculate_genotypes(int copy_num, char *ref_base){
for(j=0; j<4; j++){
genotype_t *gen = genotype_init_genotype();
check(gen != NULL, "Error generating genotype.");
genotype_add_base_to_count(gen,bases[j]);
int chk = genotype_add_base_to_count(gen,bases[j]);
check(chk==0,"Error adding base to genotype count.");
List_push(genos,gen);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/genotype.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ List *genotype_calculate_genotypes(int copy_num, char *ref_base);
char *genotype_get_genotype_t_as_string(genotype_t *geno);
long double genotype_get_var_base_proportion(genotype_t *gen, char ref_base, int copy_num);
char genotype_get_var_base(genotype_t *geno, char ref_base);
void genotype_add_base_to_count(genotype_t *geno, char base);
int genotype_add_base_to_count(genotype_t *geno, char base);
int genotype_get_base_count(genotype_t *geno, char base);
void genotype_set_base_count(genotype_t *geno, char base, int count);
int genotype_get_total_base_count(genotype_t *geno);
Expand Down
2 changes: 1 addition & 1 deletion src/ignore_reg_access.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ int ignore_reg_access_get_ign_reg_for_chr(char *ign_file,char *chr, int entry_co
}
}else{
free(chr_nom);
sentinel("Incorrect line read from ignore file %s.",rd,1);
sentinel("Incorrect line read from ignore file %s.",rd);
}
free(chr_nom);
}
Expand Down
15 changes: 8 additions & 7 deletions src/mstep.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void mstep_print_usage (int exit_code){
exit(exit_code);
}

void mstep_setup_options(int argc, char *argv[]){
int mstep_setup_options(int argc, char *argv[]){
const struct option long_opts[] =
{
{"config-file", required_argument, 0, 'f'},
Expand Down Expand Up @@ -106,19 +106,19 @@ void mstep_setup_options(int argc, char *argv[]){

case 'i':
if(sscanf(optarg, "%i", &idx) != 1){
sentinel("Error parsing -i argument '%s'. Should be an integer > 0",optarg,1);
sentinel("Error parsing -i argument '%s'. Should be an integer > 0",optarg);
}
break;

case 'm':
if(sscanf(optarg, "%i", &min_bq) != 1){
sentinel("Error parsing -m argument '%s'. Should be an integer >= 0",optarg,1);
sentinel("Error parsing -m argument '%s'. Should be an integer >= 0",optarg);
}
break;

case 'a':
if(sscanf(optarg, "%i", &split_size) != 1){
sentinel("Error parsing -a argument '%s'. Should be an integer > 0",optarg,1);
sentinel("Error parsing -a argument '%s'. Should be an integer > 0",optarg);
}
break;

Expand All @@ -144,15 +144,16 @@ void mstep_setup_options(int argc, char *argv[]){
mstep_print_usage(1);
}

return;
return 0;

error:
mstep_print_usage (1);
return;
return -1;
}

int mstep_main(int argc, char *argv[]){
mstep_setup_options(argc,argv);
int is_err = mstep_setup_options(argc,argv);
check(is_err==0, "Error parsing options.");

char *fa_file = NULL;
uint64_t ********arr_check = NULL;
Expand Down
Loading

0 comments on commit 6bba096

Please sign in to comment.