将fmt和kmer合并到建索引的过程中

This commit is contained in:
zzh 2024-04-02 07:49:38 +08:00
parent 20e072f6af
commit 123aceb6a6
2 changed files with 13 additions and 3 deletions

View File

@ -230,7 +230,7 @@ int bwa_bwt2bytesa(int argc, char *argv[]) // the "bwt2bytesa" command
int bwa_bwt2fmt(int argc, char *argv[]) // create fmt index
{
bwt_t *bwt;
char buf[1024];
//char buf[1024];
if (optind + 1 > argc) {
fprintf(stderr, "Usage: fastbwa bwt2fmt <in.bwt> <out.fmt>\n");
return 1;
@ -369,14 +369,22 @@ int bwa_idx_build(const char *fa, const char *prefix, int algo_type, int block_s
bwt_dump_sa(str3, bwt);
bwt_destroy(bwt);
if (bwa_verbose >= 3) fprintf(stderr, "%.2f sec\n", (float)(clock() - t) / CLOCKS_PER_SEC);
{
{
t = clock();
// build FMT-Index
FMTIndex *fmt;
strcpy(str, prefix); strcat(str, ".fmt");
fmt = create_fmt_from_bwt(bwt);
dump_fmt(str, fmt);
// create Kmer-Hash
fmt_create_kmer_index(fmt);
strcpy(str, prefix); strcat(str, ".kmer");
fmt_dump_kmer_idx(str, &fmt->kmer_hash);
if (bwa_verbose >= 3) fprintf(stderr, "%.2f sec\n", (float)(clock() - t) / CLOCKS_PER_SEC);
// create byte sa
bwt_cal_byte_sa(bwt, 4);
strcpy(str, prefix); strcat(str, ".bytesa");
bwt_dump_byte_sa(str, bwt);
}
}
free(str3); free(str2); free(str);

2
main.c
View File

@ -80,6 +80,8 @@ static int usage()
fprintf(stderr, " bwtupdate update .bwt to the new format\n");
fprintf(stderr, " bwt2sa generate SA from BWT and Occ\n");
fprintf(stderr, " bwt2bytesa generate SA(using byte array) from BWT and Occ\n");
fprintf(stderr, " bwt2fmt generate FMT-Index from BWT\n");
fprintf(stderr, " buildkmer generate kmer index from FMT\n");
fprintf(stderr, "\n");
fprintf(stderr,
"Note: To use BWA, you need to first index the genome with `bwa index'.\n"