Skip to content

Commit

Permalink
chore: make get_tx return a reference (#651)
Browse files Browse the repository at this point in the history
  • Loading branch information
tedil authored Dec 19, 2024
1 parent 25a71b8 commit 62070b5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/annotate/seqvars/csq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,12 +677,12 @@ impl ConsequencePredictor {
},
consequences,
putative_impact,
gene_symbol: tx.gene_symbol,
gene_id: tx.gene_id,
gene_symbol: tx.gene_symbol.clone(),
gene_id: tx.gene_id.clone(),
feature_type: FeatureType::SoTerm {
term: SoFeature::Transcript,
},
feature_id: tx.id,
feature_id: tx.id.clone(),
feature_biotype,
rank,
hgvs_t,
Expand Down
4 changes: 2 additions & 2 deletions src/annotate/seqvars/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ impl Provider {
/// # Returns
///
/// The `Transcript` for the given accession, or None if the accession was not found.
pub fn get_tx(&self, tx_id: &str) -> Option<Transcript> {
pub fn get_tx(&self, tx_id: &str) -> Option<&Transcript> {
self.tx_map.get(tx_id).and_then(|idx| {
let tx = &self
.tx_seq_db
Expand All @@ -465,7 +465,7 @@ impl Provider {
if let Some(true) = tx.filtered {
None
} else {
Some(tx.clone())
Some(tx)
}
})
}
Expand Down
1 change: 1 addition & 0 deletions src/server/run/actix_server/gene_txs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ fn genes_tx_impl(
transcripts: tx_acs[first..last]
.iter()
.filter_map(|tx_ac| provider.get_tx(tx_ac))
.cloned()
.collect::<Vec<_>>(),
next_page_token: if last < tx_acs.len() {
Some(tx_acs[last].clone())
Expand Down

0 comments on commit 62070b5

Please sign in to comment.