diff --git a/CHANGELOG.md b/CHANGELOG.md index aa29e76..67afcfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,9 @@ 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.6] +### Changed +- Ill advised parsing of RG ID field has been extended to additionally allow for protocol_run_id style (uuid) Run IDs, as well as standalone acquisition_id (sha1) Run IDs ## [v0.18.5] ### Changed diff --git a/src/common.c b/src/common.c index f4a87de..4aa88e6 100644 --- a/src/common.c +++ b/src/common.c @@ -253,7 +253,9 @@ void destroy_rg_info(readgroup* rg) { // __ // // where: -// - runid is a 40 character string +// - runid is either (see CW-4704): +// - a 40 character string representing an acquisition_id sha +// - a 36 character string representing a protocol_run_id uuid // - basecalling_model is a string maybe containing `_`, and containing one or more `@` // - mod_caller is optional part of this starting with `_` after the first `@` // - barcode_arrangement is a optional(!) string with an unknown format, but hopefully no `@` @@ -284,7 +286,9 @@ readgroup* create_rg_info(char* rg) { return rg_info; } delim[0] = '\0'; - if (strlen(rg_info->runid) != 40) { + // ensure runid is long enough to be an acquisition sha or protocol uuid + int runid_l = strlen(rg_info->runid); + if (runid_l != 36 && runid_l != 40) { // free the mutated copy, and reset free(rg_info->readgroup); rg_info->readgroup = strdup(rg); diff --git a/src/version.h b/src/version.h index ae09532..61555cf 100644 --- a/src/version.h +++ b/src/version.h @@ -1,2 +1,2 @@ -const char *argp_program_version = "0.18.5"; +const char *argp_program_version = "0.18.6"; diff --git a/test/rg_parse.c b/test/rg_parse.c index 4d69b75..5cc7c8b 100644 --- a/test/rg_parse.c +++ b/test/rg_parse.c @@ -26,25 +26,34 @@ int compare(char* str1, char* str2) { int main() { - char *runid = "ef1af1ab8967cb20ca30dbeca93fd66592bf4619"; + char *runid_acquisition = "ef1af1ab8967cb20ca30dbeca93fd66592bf4619"; + char *runid_protocol = "c886531d-28f5-41f6-b948-948e8cb78e5e"; char *basecall_model = "basecall_model_name@v1.2.3"; char *mod_model_name = "basecall_model_name@v1.2.3_5mCG_5hmCG@v1"; char *barcode = "barcode01"; char *suffix = "-1A2B3C4D"; TestCase cases[] = { - {runid, basecall_model, mod_model_name, barcode, suffix}, - {runid, basecall_model, mod_model_name, barcode, NULL}, - {runid, basecall_model, mod_model_name, NULL, suffix}, - {runid, basecall_model, mod_model_name, NULL, NULL}, - {runid, basecall_model, NULL, barcode, suffix}, - {runid, basecall_model, NULL, barcode, NULL}, - {runid, basecall_model, NULL, NULL, suffix}, - {runid, basecall_model, NULL, NULL, NULL}, + {runid_acquisition, basecall_model, mod_model_name, barcode, suffix}, + {runid_acquisition, basecall_model, mod_model_name, barcode, NULL}, + {runid_acquisition, basecall_model, mod_model_name, NULL, suffix}, + {runid_acquisition, basecall_model, mod_model_name, NULL, NULL}, + {runid_acquisition, basecall_model, NULL, barcode, suffix}, + {runid_acquisition, basecall_model, NULL, barcode, NULL}, + {runid_acquisition, basecall_model, NULL, NULL, suffix}, + {runid_acquisition, basecall_model, NULL, NULL, NULL}, + {runid_protocol, basecall_model, mod_model_name, barcode, suffix}, + {runid_protocol, basecall_model, mod_model_name, barcode, NULL}, + {runid_protocol, basecall_model, mod_model_name, NULL, suffix}, + {runid_protocol, basecall_model, mod_model_name, NULL, NULL}, + {runid_protocol, basecall_model, NULL, barcode, suffix}, + {runid_protocol, basecall_model, NULL, barcode, NULL}, + {runid_protocol, basecall_model, NULL, NULL, suffix}, + {runid_protocol, basecall_model, NULL, NULL, NULL}, }; int fails = 0; - for (int i = 0; i < 8; i++) { + for (int i = 0; i < sizeof(cases)/sizeof(TestCase); i++) { char* read_group = calloc(400, sizeof(char)); read_group = strcpy(read_group, cases[i].runid);