Skip to content

Commit

Permalink
feat: adding support for gnomAD 4.1 (#493)
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe authored Jul 14, 2024
1 parent b8fcf52 commit 3ec4373
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 9 deletions.
42 changes: 35 additions & 7 deletions src/server/actix_server/annos_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,33 @@ async fn handle(
data.annos[genome_release][anno_db]
.as_ref()
.map(|db| {
fetch_pos_protobuf::<crate::pbs::gnomad::gnomad2::Record>(
db,
anno_db.cf_name(),
query.start_pos(),
query.stop_pos(),
)
let db_version = data.db_infos[genome_release][anno_db]
.as_ref()
.expect("must have db info here")
.db_version
.as_ref()
.expect("gnomAD must have db version");

if db_version.starts_with("2.") {
fetch_pos_protobuf::<crate::pbs::gnomad::gnomad2::Record>(
db,
anno_db.cf_name(),
query.start_pos(),
query.stop_pos(),
)
} else if db_version.starts_with("4.") {
fetch_pos_protobuf::<crate::pbs::gnomad::gnomad4::Record>(
db,
anno_db.cf_name(),
query.start_pos(),
query.stop_pos(),
)
} else {
Err(CustomError::new(anyhow::anyhow!(
"don't know how to handle gnomAD version {}",
db_version
)))
}
})
.transpose()?
.map(|v| annotations.insert(anno_db, v));
Expand Down Expand Up @@ -201,9 +222,16 @@ async fn handle(
query.start_pos(),
query.stop_pos(),
)
} else if db_version.starts_with("4.") {
fetch_pos_protobuf::<crate::pbs::gnomad::gnomad4::Record>(
db,
anno_db.cf_name(),
query.start_pos(),
query.stop_pos(),
)
} else {
Err(CustomError::new(anyhow::anyhow!(
"don't know how to tread gnomAD version {}",
"don't know how to handle gnomAD version {}",
db_version
)))
}
Expand Down
4 changes: 2 additions & 2 deletions src/server/actix_server/annos_variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ async fn handle(
)
} else {
Err(CustomError::new(anyhow::anyhow!(
"don't know how to tread gnomAD version {}",
"don't know how to handle gnomAD version {}",
db_version
)))
}
Expand Down Expand Up @@ -212,7 +212,7 @@ async fn handle(
)
} else {
Err(CustomError::new(anyhow::anyhow!(
"don't know how to tread gnomAD version {}",
"don't know how to handle gnomAD version {}",
db_version
)))
}
Expand Down

0 comments on commit 3ec4373

Please sign in to comment.