From b27c642270f742dbfd1b1d45a33896bcedcee1b6 Mon Sep 17 00:00:00 2001 From: Kim Rutherford Date: Thu, 27 Jun 2024 15:08:28 +1200 Subject: [PATCH] Add RNACentral ID column to gene result table Refs pombase/website#1989 --- src/pombase/api/query.rs | 5 ++++- src/pombase/api/result.rs | 2 ++ src/pombase/data_types.rs | 2 ++ src/pombase/web/data_build.rs | 2 ++ tests/test_query.rs | 3 +++ 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/pombase/api/query.rs b/src/pombase/api/query.rs index bd03e575..46cf7cef 100644 --- a/src/pombase/api/query.rs +++ b/src/pombase/api/query.rs @@ -1071,6 +1071,7 @@ impl Query { let mut reference_uniquenames = HashSet::new(); let mut tmm = None; let mut pdb_ids = HashSet::new(); + let mut rnacentral_id = None; let mut gocam_ids = HashSet::new(); let mut molecular_weight = None; let mut protein_length = None; @@ -1103,6 +1104,7 @@ impl Query { go_function = gene_data.go_function.clone(), "tmm" => tmm = gene_data.tmm.clone(), "pdb_ids" => pdb_ids = gene_data.pdb_ids.clone(), + "rnacentral_id" => rnacentral_id = gene_data.rnacentral_urs_identifier.clone(), "gocam_ids" => gocam_ids = gene_data.gocam_ids.clone(), "molecular_weight" => molecular_weight = gene_data.molecular_weight, @@ -1125,7 +1127,7 @@ impl Query { &gene_uniquename); gene_expression.extend(results_measurements); } else { - eprintln!("warning - no such option field: {}", field_name); + eprintln!("warning - no such field: {}", field_name); } } } @@ -1165,6 +1167,7 @@ impl Query { unspliced_rna_length, reference_uniquenames, pdb_ids, + rnacentral_id, gocam_ids, subsets, gene_expression, diff --git a/src/pombase/api/result.rs b/src/pombase/api/result.rs index 7524f06d..e5da1401 100644 --- a/src/pombase/api/result.rs +++ b/src/pombase/api/result.rs @@ -51,6 +51,8 @@ pub struct ResultRow { pub reference_uniquenames: HashSet, #[serde(skip_serializing_if="HashSet::is_empty", default)] pub pdb_ids: HashSet, + #[serde(skip_serializing_if="Option::is_none")] + pub rnacentral_id: Option, #[serde(skip_serializing_if="HashSet::is_empty", default)] pub gocam_ids: HashSet, #[serde(skip_serializing_if="HashSet::is_empty", default)] diff --git a/src/pombase/data_types.rs b/src/pombase/data_types.rs index bd109cc6..9059d25b 100644 --- a/src/pombase/data_types.rs +++ b/src/pombase/data_types.rs @@ -2229,6 +2229,8 @@ pub struct GeneQueryData { pub subset_termids: HashSet, #[serde(skip_serializing_if="HashSet::is_empty", default)] pub pdb_ids: HashSet, +#[serde(skip_serializing_if="Option::is_none")] + pub rnacentral_urs_identifier: Option, #[serde(skip_serializing_if="HashSet::is_empty", default)] pub gocam_ids: HashSet, } diff --git a/src/pombase/web/data_build.rs b/src/pombase/web/data_build.rs index 5470db80..7fa6f321 100644 --- a/src/pombase/web/data_build.rs +++ b/src/pombase/web/data_build.rs @@ -5126,6 +5126,7 @@ phenotypes, so just the first part of this extension will be used: let pdb_ids = gene_details.pdb_entries.iter() .map(|pdb_entry| pdb_entry.pdb_id.clone()) .collect(); + let rnacentral_urs_identifier = gene_details.rnacentral_urs_identifier.clone(); let gocam_ids = gene_details.gocams.iter().map(|gocam| gocam.gocam_id.clone()).collect(); @@ -5147,6 +5148,7 @@ phenotypes, so just the first part of this extension will be used: unspliced_rna_length, reference_uniquenames, pdb_ids, + rnacentral_urs_identifier, gocam_ids, subset_termids: gene_details.subset_termids.clone(), }; diff --git a/tests/test_query.rs b/tests/test_query.rs index eead4635..27190c45 100644 --- a/tests/test_query.rs +++ b/tests/test_query.rs @@ -181,6 +181,7 @@ async fn test_output_options() { gaf_lines: None, reference_uniquenames: HashSet::new(), pdb_ids: HashSet::new(), + rnacentral_id: None, gocam_ids: HashSet::new(), subsets: HashSet::new(), gene_expression: vec![], @@ -205,6 +206,7 @@ async fn test_output_options() { gaf_lines: None, reference_uniquenames: HashSet::new(), pdb_ids: HashSet::new(), + rnacentral_id: None, gocam_ids: HashSet::new(), subsets: HashSet::new(), gene_expression: vec![], @@ -232,6 +234,7 @@ async fn test_output_options() { gaf_lines: None, reference_uniquenames: HashSet::new(), pdb_ids: HashSet::new(), + rnacentral_id: None, gocam_ids: HashSet::new(), subsets: HashSet::new(), gene_expression: vec![],