Skip to content

Commit

Permalink
Merge branch 'cw-4704' into 'dev'
Browse files Browse the repository at this point in the history
Support protocol_run_id in RG.ID [CW-4704]

See merge request epi2melabs/fastcat!72
  • Loading branch information
SamStudio8 committed Aug 8, 2024
2 parents 76800b7 + 487400a commit 92fe2a1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,9 @@ void destroy_rg_info(readgroup* rg) {
// <runid>_<basecalling_model>_<barcode_arrangement>
//
// 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 `@`
Expand Down Expand Up @@ -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);
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.5";
const char *argp_program_version = "0.18.6";
29 changes: 19 additions & 10 deletions test/rg_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "[email protected]";
char *mod_model_name = "[email protected]_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);
Expand Down

0 comments on commit 92fe2a1

Please sign in to comment.