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

Clarify log scaled site quality metrics #1624

Merged
merged 2 commits into from
Sep 16, 2024
Merged

Conversation

elissa-alarmani
Copy link
Collaborator

Resolves #1615

Regarding the site quality metrics histogram, for the metrics ["AS_VarDP", "QUALapprox", "AS_QUALapprox"], here we add the 'log' label to the x-axis and update the displayed value as the calculated log value.

Copy link
Contributor

@ch-kr ch-kr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for adding! I added a couple basic questions.

also quick note: I'm not the best placed to review this code -- perhaps @rileyhgrant or @phildarnowsky could also take a look?

browser/src/VariantPage/VariantSiteQualityMetrics.tsx Outdated Show resolved Hide resolved
@@ -625,11 +628,29 @@ const SiteQualityMetricsHistogram = ({
}: SiteQualityMetricsHistogramProps) => {
const isLogScale = metric === 'SiteQuality' || metric === 'AS_QUALapprox' || metric === 'DP'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SiteQuality, AS_QUALapprox, and DP aren't currently log scaled on the variant pages as far as I can tell (https://gnomad.broadinstitute.org/variant/1-55051215-G-GA?dataset=gnomad_r4) -- should they be?
image

Copy link
Collaborator Author

@elissa-alarmani elissa-alarmani Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just updated that for the labeling to include the isLogScale values, one question does the graph look correctly scaled?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! what do you mean for correctly scaled?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that the graphs are already log scaled and just needed the labeling additions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah thanks for clarifying. it seems like the graphs aren't actually log scaled. for that variant (1-55051215-G-GA), the browser is showing this for the exomes:
image
the value for AS_QUALapprox in the v4.1 exomes release HT is 262031, and that value is not log transformed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2024-09-13 at 10 58 16 AM

Using the same variant and view provided this what we have right now after adding the "log()" around the values, would it be better to evaluate or leave it like that with the log labeling?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused -- the plot doesn't seem to be log scaled in that second screenshot. The x-axis in the first screenshot (untransformed plot) has the same range as the second log-transformed screenshot, which shouldn't be the case.

Also, log10(262031) is 5.418, and it looks like that value is now being labeled at the correct location in the second screenshot with the vertical line and arrow. However, in the untransformed plot, 262031 seems to be near the middle of the distribution, and it should stay at the same spot once the rest of the data are transformed (but it is currently far off to the left).

let me know if this doesn't make sense or if I've completely missed something

browser/src/VariantPage/VariantSiteQualityMetrics.tsx Outdated Show resolved Hide resolved
@phildarnowsky
Copy link
Contributor

@ch-kr please note I use @phildarnowsky-broad for work code

Copy link
Contributor

@phildarnowsky-broad phildarnowsky-broad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some suggestions for refactoring, please let me know if you want to discuss any in more detail.

browser/src/VariantPage/VariantSiteQualityMetrics.tsx Outdated Show resolved Hide resolved
browser/src/VariantPage/VariantSiteQualityMetrics.tsx Outdated Show resolved Hide resolved
browser/src/VariantPage/VariantSiteQualityMetrics.tsx Outdated Show resolved Hide resolved
browser/src/VariantPage/VariantSiteQualityMetrics.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@ch-kr ch-kr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't comment on the actual code, but the latest plots shared via slack LGTM!

Copy link
Contributor

@phildarnowsky-broad phildarnowsky-broad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code's looking good, there is just one place where I suggest adding a comment to clarify something.

Also I'd suggest, before you merge this in, to rebase it all down into one commit, to keep the intermediate half-formed versions of the code out of the commit history.

update to use log base 10

update log labels for metric table

update jest snapshot

clean up function formatMetricValue

refactor exome and genome legend text

follow up testing draft

add just snapshot testing for now

fix linting

Rename existing getFlagsForContext

Expose exome- and genome-specific flags in API

Move regional flags (par, lcr, segdup) from exome/genome flags to variant flags in API

Incorporate exome/genome flags into frontend

finalizing snapshot

apply log labeling and value scaling only to AS_VarDP

add comment regarding use of isLogScale
@elissa-alarmani elissa-alarmani merged commit e02ad65 into main Sep 16, 2024
5 checks passed
@elissa-alarmani elissa-alarmani deleted the ea-loglabel-240906 branch September 16, 2024 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Note that x-axis is log-scaled for certain site quality metrics
4 participants