-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix: re-enable gnomad output for server #604
Conversation
WalkthroughThe pull request introduces significant updates to the Changes
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
src/server/run/annos_variant.rs (2)
2927-2979
: Consider refactoring duplicate logic into a helper functionThe logic for handling gnomAD versions in both
gnomad_exomes
andgnomad_genomes
is very similar. Consider extracting this logic into a helper function to reduce code duplication and improve maintainability.
2981-3023
: Consider refactoring duplicate logic into a helper functionAs with
gnomad_exomes
, the version handling ingnomad_genomes
can be refactored into a shared helper function to improve code clarity and reduce duplication.
if db_version.starts_with("2.") { | ||
Ok(fetch_var_protobuf::<crate::pbs::gnomad::gnomad2::Record>( | ||
&db.data, | ||
AnnoDb::GnomadGenomes.cf_name(), | ||
query.clone().into_inner().into(), | ||
)? | ||
.map(|record| { | ||
Ok(GnomadRecord::Gnomad2( | ||
record.try_into().map_err(CustomError::new)?, | ||
)) | ||
}) | ||
.transpose()?) | ||
} else if db_version.starts_with("4.") { | ||
Ok(fetch_var_protobuf::<crate::pbs::gnomad::gnomad4::Record>( | ||
&db.data, | ||
AnnoDb::GnomadGenomes.cf_name(), | ||
query.clone().into_inner().into(), | ||
)? | ||
.map(|record| { | ||
Ok(GnomadRecord::Gnomad4( | ||
record.try_into().map_err(CustomError::new)?, | ||
)) | ||
}) | ||
.transpose()?) | ||
} else { | ||
Err(CustomError::new(anyhow::anyhow!( | ||
"don't know how to handle gnomAD version {}", | ||
db_version | ||
))) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing handling for gnomAD Genomes version 3.x
The code does not handle gnomAD Genomes version 3.x in the gnomad_genomes
block. This could lead to runtime errors if db_version
starts with "3."
.
Apply this diff to fix the issue:
if db_version.starts_with("2.") {
// existing code for version 2.x
+ } else if db_version.starts_with("3.") {
+ Ok(fetch_var_protobuf::<crate::pbs::gnomad::gnomad3::Record>(
+ &db.data,
+ AnnoDb::GnomadGenomes.cf_name(),
+ query.clone().into_inner().into(),
+ )?
+ .map(|record| {
+ Ok(GnomadRecord::Gnomad3(
+ record.try_into().map_err(CustomError::new)?,
+ ))
+ })
+ .transpose()?)
} else if db_version.starts_with("4.") {
// existing code for version 4.x
} else {
// existing error handling
}
Committable suggestion skipped: line range outside the PR's diff.
Summary by CodeRabbit
New Features
Bug Fixes