Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: serving clinvar information through REST API #155

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/server/actix_server/annos_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,20 @@ async fn handle(
for anno_db in AnnoDb::iter() {
match anno_db {
AnnoDb::Other => (),
AnnoDb::Clinvar => {
data.annos[genome_release][anno_db]
.as_ref()
.map(|db| {
fetch_pos_protobuf::<crate::clinvar_minimal::pbs::Record>(
db,
anno_db.cf_name(),
query.start_pos(),
query.stop_pos(),
)
})
.transpose()?
.map(|v| annotations.insert(anno_db, v));
}
AnnoDb::Cadd | AnnoDb::Dbnsfp | AnnoDb::Dbscsnv => {
data.annos[genome_release][anno_db]
.as_ref()
Expand Down
13 changes: 13 additions & 0 deletions src/server/actix_server/annos_variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@ async fn handle(
for anno_db in AnnoDb::iter() {
match anno_db {
AnnoDb::Other => (),
AnnoDb::Clinvar => {
data.annos[genome_release][anno_db]
.as_ref()
.map(|db| {
fetch_var_protobuf::<crate::clinvar_minimal::pbs::Record>(
db,
anno_db.cf_name(),
query.clone().into_inner().into(),
)
})
.transpose()?
.map(|v| annotations.insert(anno_db, v));
}
AnnoDb::Cadd | AnnoDb::Dbnsfp | AnnoDb::Dbscsnv => {
data.annos[genome_release][anno_db]
.as_ref()
Expand Down
8 changes: 8 additions & 0 deletions src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ pub enum AnnoDb {
Helixmtdb,
/// UCSC conservation annotations.
UcscConservation,
/// ClinVar with minimal data extracted.
Clinvar,
}

impl AnnoDb {
Expand All @@ -67,6 +69,7 @@ impl AnnoDb {
AnnoDb::GnomadGenomes => "gnomad_nuclear_data",
AnnoDb::Helixmtdb => "helixmtdb_data",
AnnoDb::UcscConservation => "ucsc_conservation",
AnnoDb::Clinvar => "clinvar",
AnnoDb::Other => panic!("cannot get CF name for 'Other'"),
}
}
Expand All @@ -83,6 +86,7 @@ impl AnnoDb {
AnnoDb::GnomadGenomes => Some("gnomad-version"),
AnnoDb::Helixmtdb => None,
AnnoDb::UcscConservation => None,
AnnoDb::Clinvar => None,
AnnoDb::Other => panic!("cannot get meta version name name for 'Other'"),
}
}
Expand Down Expand Up @@ -162,6 +166,9 @@ pub struct Args {
/// Path to genes database.
#[arg(long)]
pub path_genes: Option<String>,
/// ClinVar database(s), one for each release.
#[arg(long)]
pub path_clinvar: Vec<String>,
/// CADD database(s), one for each release.
#[arg(long)]
pub path_cadd: Vec<String>,
Expand Down Expand Up @@ -256,6 +263,7 @@ pub fn run(args_common: &common::cli::Args, args: &Args) -> Result<(), anyhow::E
}
// Argument lists from the command line with the corresponding database enum value.
let paths_db_pairs = vec![
(&args.path_clinvar, AnnoDb::Clinvar),
(&args.path_cadd, AnnoDb::Cadd),
(&args.path_dbnsfp, AnnoDb::Dbnsfp),
(&args.path_dbsnp, AnnoDb::Dbsnp),
Expand Down
10 changes: 8 additions & 2 deletions utils/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ set -euo pipefail
# HTTP_PORT -- port
# default: 8080
#
# PATH_DB_CLINVAR_37 -- path to ClinVar database for GRCh37, defaults to $PATH_DB_BAE/grch37/clinvar/rocksdb
# PATH_DB_CLINVAR_38 -- path to ClinVar database for GRCh37, defaults to $PATH_DB_BAE/grch38/clinvar/rocksdb
# PATH_DB_CADD_37 -- path to CADD database for GRCh37, defaults to $PATH_DB_BASE/grch37/cadd/rocksdb
# PATH_DB_CADD_38 -- path to CADD database for GRCh38, defaults to $PATH_DB_BASE/grch38/cadd/rocksdb
# PATH_DB_DBSNP_37 -- path to dbSNP database for GRCh37, defaults to $PATH_DB_BASE/grch37/dbsnp/rocksdb
Expand All @@ -37,6 +39,8 @@ PATH_DB_BASE=${PATH_HPO_DIR-/data/annonars}
HTTP_HOST=${HTTP_HOST-0.0.0.0}
HTTP_PORT=${HTTP_PORT-8080}

PATH_DB_CLINVAR_37=${PATH_DB_CLINVAR_37-$PATH_DB_BASE/grch37/clinvar/rocksdb}
PATH_DB_CLINVAR_38=${PATH_DB_CLINVAR_38-$PATH_DB_BASE/grch38/clinvar/rocksdb}
PATH_DB_CADD_37=${PATH_DB_CADD_37-$PATH_DB_BASE/grch37/cadd/rocksdb}
PATH_DB_CADD_38=${PATH_DB_CADD_38-$PATH_DB_BASE/grch38/cadd/rocksdb}
PATH_DB_DBSNP_37=${PATH_DB_DBSNP_37-$PATH_DB_BASE/grch37/dbsnp/rocksdb}
Expand Down Expand Up @@ -66,8 +70,10 @@ else
exec \
annonars \
run-server \
$(test -e $PATH_DB_CADD_37 && echo --path-cadd $PATH_DB_CADD_37) \
$(test -e $PATH_DB_CADD_38 && echo --path-cadd $PATH_DB_CADD_38) \
$(test -e $PATH_DB_CLINVAR_37 && echo --path-clinvar $PATH_DB_CLINVAR_37) \
$(test -e $PATH_DB_CLINVAR_38 && echo --path-clinvar $PATH_DB_CLINVAR_38) \
$(test -e $PATH_DB_CLINVAR_37 && echo --path-cadd $PATH_DB_CLINVAR_37) \
$(test -e $PATH_DB_CLINVAR_38 && echo --path-cadd $PATH_DB_CLINVAR_38) \
$(test -e $PATH_DB_DBSNP_37 && echo --path-dbsnp $PATH_DB_DBSNP_37) \
$(test -e $PATH_DB_DBSNP_38 && echo --path-dbsnp $PATH_DB_DBSNP_38) \
$(test -e $PATH_DB_DBNSFP_37 && echo --path-dbnsfp $PATH_DB_DBNSFP_37) \
Expand Down
Loading