diff --git a/src/server/actix_server/annos_range.rs b/src/server/actix_server/annos_range.rs index 74d46973..9d2708f6 100644 --- a/src/server/actix_server/annos_range.rs +++ b/src/server/actix_server/annos_range.rs @@ -167,12 +167,33 @@ async fn handle( data.annos[genome_release][anno_db] .as_ref() .map(|db| { - fetch_pos_protobuf::( - 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::( + db, + anno_db.cf_name(), + query.start_pos(), + query.stop_pos(), + ) + } else if db_version.starts_with("4.") { + fetch_pos_protobuf::( + 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)); @@ -201,9 +222,16 @@ async fn handle( query.start_pos(), query.stop_pos(), ) + } else if db_version.starts_with("4.") { + fetch_pos_protobuf::( + 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 ))) } diff --git a/src/server/actix_server/annos_variant.rs b/src/server/actix_server/annos_variant.rs index c632371e..0a5ec6c8 100644 --- a/src/server/actix_server/annos_variant.rs +++ b/src/server/actix_server/annos_variant.rs @@ -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 ))) } @@ -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 ))) }