Skip to content

Commit

Permalink
bamstats: fix run id column name in basecaller summary output file
Browse files Browse the repository at this point in the history
  • Loading branch information
julibeg committed Jun 12, 2024
1 parent 82e2d9e commit e17ded4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v0.18.2]
### Fixed
- 'run_id' instead of 'basecaller' as column name in bamstats basecaller summary output header line.

## [v0.18.1]
### Fixed
- 'run_id' instead of 'basecaller' as column name in basecaller summary output header line.
Expand Down
8 changes: 4 additions & 4 deletions src/bamstats/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ static inline void write_stats(size_t *stats, const char* chr, const char* sampl
}
}

static inline void write_counter(const char* fname, kh_counter_t *counter, const char* sample, const char* bam_fname) {
static inline void write_counter(const char* fname, kh_counter_t *counter, const char* sample, const char* bam_fname, const char* column_name) {
FILE* stats_fp = fopen(fname, "w");
fprintf(stats_fp, "filename\t");
if (sample != NULL) fprintf(stats_fp, "sample_name\t");
fprintf(stats_fp, "run_id\tcount\n");
fprintf(stats_fp, "%s\tcount\n", column_name);
for (khiter_t k = 0; k < kh_end(counter); ++k) {
if (kh_exist(counter, k)) {
fprintf(stats_fp, "%s\t", bam_fname);
Expand Down Expand Up @@ -232,11 +232,11 @@ int main(int argc, char *argv[]) {

// write runids summary
if (args.runids != NULL) {
write_counter(args.runids, run_ids, args.sample, args.bam[0]);
write_counter(args.runids, run_ids, args.sample, args.bam[0], "run_id");
}
// write basecallers summary
if (args.basecallers != NULL) {
write_counter(args.basecallers, basecallers, args.sample, args.bam[0]);
write_counter(args.basecallers, basecallers, args.sample, args.bam[0], "basecaller");
}

destroy_length_stats(length_stats);
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

const char *argp_program_version = "0.18.1";
const char *argp_program_version = "0.18.2";

0 comments on commit e17ded4

Please sign in to comment.