Tim's suggestion suffix file name with .64
This commit is contained in:
parent
a471f1918b
commit
bdc953cad9
10
bwape.c
10
bwape.c
|
|
@ -766,8 +766,11 @@ int bwa_sai2sam_pe(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
extern char *bwa_rg_line, *bwa_rg_id;
|
extern char *bwa_rg_line, *bwa_rg_id;
|
||||||
extern int bwa_set_rg(const char *s);
|
extern int bwa_set_rg(const char *s);
|
||||||
|
extern char *bwa_infer_prefix(const char *hint);
|
||||||
int c;
|
int c;
|
||||||
pe_opt_t *popt;
|
pe_opt_t *popt;
|
||||||
|
char *prefix;
|
||||||
|
|
||||||
popt = bwa_init_pe_opt();
|
popt = bwa_init_pe_opt();
|
||||||
while ((c = getopt(argc, argv, "a:o:sPn:N:c:f:Ar:")) >= 0) {
|
while ((c = getopt(argc, argv, "a:o:sPn:N:c:f:Ar:")) >= 0) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
|
@ -809,8 +812,13 @@ int bwa_sai2sam_pe(int argc, char *argv[])
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
bwa_sai2sam_pe_core(argv[optind], argv + optind + 1, argv + optind+3, popt);
|
if ((prefix = bwa_infer_prefix(argv[optind])) == 0) {
|
||||||
|
fprintf(stderr, "[%s] fail to locate the index\n", __func__);
|
||||||
free(bwa_rg_line); free(bwa_rg_id);
|
free(bwa_rg_line); free(bwa_rg_id);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
bwa_sai2sam_pe_core(prefix, argv + optind + 1, argv + optind+3, popt);
|
||||||
|
free(bwa_rg_line); free(bwa_rg_id); free(prefix);
|
||||||
free(popt);
|
free(popt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
9
bwase.c
9
bwase.c
|
|
@ -650,7 +650,9 @@ void bwa_sai2sam_se_core(const char *prefix, const char *fn_sa, const char *fn_f
|
||||||
|
|
||||||
int bwa_sai2sam_se(int argc, char *argv[])
|
int bwa_sai2sam_se(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
extern char *bwa_infer_prefix(const char *hint);
|
||||||
int c, n_occ = 3;
|
int c, n_occ = 3;
|
||||||
|
char *prefix;
|
||||||
while ((c = getopt(argc, argv, "hn:f:r:")) >= 0) {
|
while ((c = getopt(argc, argv, "hn:f:r:")) >= 0) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'h': break;
|
case 'h': break;
|
||||||
|
|
@ -670,7 +672,12 @@ int bwa_sai2sam_se(int argc, char *argv[])
|
||||||
fprintf(stderr, "Usage: bwa samse [-n max_occ] [-f out.sam] [-r RG_line] <prefix> <in.sai> <in.fq>\n");
|
fprintf(stderr, "Usage: bwa samse [-n max_occ] [-f out.sam] [-r RG_line] <prefix> <in.sai> <in.fq>\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
bwa_sai2sam_se_core(argv[optind], argv[optind+1], argv[optind+2], n_occ);
|
if ((prefix = bwa_infer_prefix(argv[optind])) == 0) {
|
||||||
|
fprintf(stderr, "[%s] fail to locate the index\n", __func__);
|
||||||
|
free(bwa_rg_line); free(bwa_rg_id);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
bwa_sai2sam_se_core(prefix, argv[optind+1], argv[optind+2], n_occ);
|
||||||
free(bwa_rg_line); free(bwa_rg_id);
|
free(bwa_rg_line); free(bwa_rg_id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
32
bwtaln.c
32
bwtaln.c
|
|
@ -219,10 +219,35 @@ void bwa_aln_core(const char *prefix, const char *fn_fa, const gap_opt_t *opt)
|
||||||
bwa_seq_close(ks);
|
bwa_seq_close(ks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *bwa_infer_prefix(const char *hint)
|
||||||
|
{
|
||||||
|
char *prefix;
|
||||||
|
int l_hint;
|
||||||
|
FILE *fp;
|
||||||
|
l_hint = strlen(hint);
|
||||||
|
prefix = malloc(l_hint + 3 + 4 + 1);
|
||||||
|
strcpy(prefix, hint);
|
||||||
|
strcpy(prefix + l_hint, ".bwt");
|
||||||
|
if ((fp = fopen(prefix, "rb")) != 0) {
|
||||||
|
prefix[l_hint] = 0;
|
||||||
|
return prefix;
|
||||||
|
} else {
|
||||||
|
strcpy(prefix + l_hint, ".64.bwt");
|
||||||
|
if ((fp = fopen(prefix, "rb")) == 0) {
|
||||||
|
free(prefix);
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
prefix[l_hint + 3] = 0;
|
||||||
|
return prefix;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int bwa_aln(int argc, char *argv[])
|
int bwa_aln(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int c, opte = -1;
|
int c, opte = -1;
|
||||||
gap_opt_t *opt;
|
gap_opt_t *opt;
|
||||||
|
char *prefix;
|
||||||
|
|
||||||
opt = gap_init_opt();
|
opt = gap_init_opt();
|
||||||
while ((c = getopt(argc, argv, "n:o:e:i:d:l:k:cLR:m:t:NM:O:E:q:f:b012IYB:")) >= 0) {
|
while ((c = getopt(argc, argv, "n:o:e:i:d:l:k:cLR:m:t:NM:O:E:q:f:b012IYB:")) >= 0) {
|
||||||
|
|
@ -303,10 +328,15 @@ int bwa_aln(int argc, char *argv[])
|
||||||
k = l;
|
k = l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bwa_aln_core(argv[optind], argv[optind+1], opt);
|
if ((prefix = bwa_infer_prefix(argv[optind])) == 0) {
|
||||||
|
fprintf(stderr, "[%s] fail to locate the index\n", __func__);
|
||||||
free(opt);
|
free(opt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
bwa_aln_core(prefix, argv[optind+1], opt);
|
||||||
|
free(opt); free(prefix);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* rgoya: Temporary clone of aln_path2cigar to accomodate for bwa_cigar_t,
|
/* rgoya: Temporary clone of aln_path2cigar to accomodate for bwa_cigar_t,
|
||||||
__cigar_op and __cigar_len while keeping stdaln stand alone */
|
__cigar_op and __cigar_len while keeping stdaln stand alone */
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,11 @@ int bwa_index(int argc, char *argv[])
|
||||||
fprintf(stderr, " according to the length of the genome.\n\n");
|
fprintf(stderr, " according to the length of the genome.\n\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (prefix == 0) prefix = strdup(argv[optind]);
|
if (prefix == 0) {
|
||||||
|
prefix = malloc(strlen(argv[optind]) + 4);
|
||||||
|
strcpy(prefix, argv[optind]);
|
||||||
|
strcat(prefix, ".64");
|
||||||
|
}
|
||||||
str = (char*)calloc(strlen(prefix) + 10, 1);
|
str = (char*)calloc(strlen(prefix) + 10, 1);
|
||||||
str2 = (char*)calloc(strlen(prefix) + 10, 1);
|
str2 = (char*)calloc(strlen(prefix) + 10, 1);
|
||||||
str3 = (char*)calloc(strlen(prefix) + 10, 1);
|
str3 = (char*)calloc(strlen(prefix) + 10, 1);
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,10 @@
|
||||||
|
|
||||||
int bwa_bwtsw2(int argc, char *argv[])
|
int bwa_bwtsw2(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
extern char *bwa_infer_prefix(const char *hint);
|
||||||
bsw2opt_t *opt;
|
bsw2opt_t *opt;
|
||||||
bwt_t *target;
|
bwt_t *target;
|
||||||
char buf[1024];
|
char buf[1024], *prefix;
|
||||||
bntseq_t *bns;
|
bntseq_t *bns;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
|
|
@ -72,9 +73,13 @@ int bwa_bwtsw2(int argc, char *argv[])
|
||||||
opt->t *= opt->a;
|
opt->t *= opt->a;
|
||||||
opt->coef *= opt->a;
|
opt->coef *= opt->a;
|
||||||
|
|
||||||
strcpy(buf, argv[optind]); target = bwt_restore_bwt(strcat(buf, ".bwt"));
|
if ((prefix = bwa_infer_prefix(argv[optind])) == 0) {
|
||||||
strcpy(buf, argv[optind]); bwt_restore_sa(strcat(buf, ".sa"), target);
|
fprintf(stderr, "[%s] fail to locate the index\n", __func__);
|
||||||
bns = bns_restore(argv[optind]);
|
return 0;
|
||||||
|
}
|
||||||
|
strcpy(buf, prefix); target = bwt_restore_bwt(strcat(buf, ".bwt"));
|
||||||
|
strcpy(buf, prefix); bwt_restore_sa(strcat(buf, ".sa"), target);
|
||||||
|
bns = bns_restore(prefix);
|
||||||
|
|
||||||
bsw2_aln(opt, bns, target, argv[optind+1], optind+2 < argc? argv[optind+2] : 0);
|
bsw2_aln(opt, bns, target, argv[optind+1], optind+2 < argc? argv[optind+2] : 0);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue