opentargets / issues

Issue tracker for Open Targets Platform and Open Targets Genetics Portal
https://platform.opentargets.org https://genetics.opentargets.org
Apache License 2.0
12 stars 2 forks source link

Creating a Frontend UI for the Pharmacogenomics widget using the PharmGKB data #3113

Closed prashantuniyal02 closed 7 months ago

prashantuniyal02 commented 9 months ago

We want to create a UI for the Pharmacogenomics widget where we can integrate PharmGKB data into the Platform. This ticket is for the development of the UI which will be done by the FE team

Dependencies

Tasks

Acceptance tests

  1. Netlify link and tested in the development deployment
DSuveges commented 9 months ago

I think there are a few bits that needs to be clarified (make the epic more granular):

buniello commented 9 months ago

Draft of Pharmacogenetics widgets below (discussed with Irene and reviewed by Ellie): Built on this Json Schema

1) Widget on target ( "Targetfromsourceid”) profile page Will be placed between the ”Safety” and "Chemical probes” widgets Datatypeid: "clinical_annotation”

Screenshot 2023-10-19 at 15 56 28

2) Widget on drug ("Drugid”) page
Will be placed between the ”Drug warnings” and the “Pharmacovigilance” widgets Datatypeid: "clinical_annotation”

Screenshot 2023-10-19 at 16 03 31

Please note comment from Ellie: we could choose to display just 1A and 2A values for the evidenceLevel field. This will probably enrich the data with drugs that have a Chebi/Chembl mapping as per #3116 Tagging @ireneisdoomed to this as well.

jdhayhurst commented 9 months ago

Hi @opentargets/fe-team. As part of ETL we will add one more field, the ChEMBL id, which is the main drug identifier used in the platform. If we exposed the data with this schema through the API, would that give you everything you need to complete the widget? Please let me know if there are any additional requirements.

jdhayhurst commented 8 months ago

@opentargets/fe-team I'm making the necessary API changes and wanted to double check this is what you expect.

For the target profile the api query would look like:

query PharmacogenomicsQuery($ensemblId: String!) {
  target(ensemblId: $ensemblId) {
    id
    pharmacogenomics {
      variantRsId
      genotypeId
      variantFunctionalConsequenceId
      drugId
      phenotypeText
      pgxCategory
      evidenceLevel
      studyId
      literature
    }
  }
}

The response would look like:

{
  "data": {
    "target": {
      "id": "ENSG00000001626",
      "pharmacogenomics": [
        {
          "variantRsId": "rs193922525",
          "genotypeId": "7_117664770_G_A,A",
          "variantFunctionalConsequenceId": "SO_0001583",
          "drugId": "CHEMBL2010601",
          "phenotypeText": "Cystic Fibrosis",
          "pgxCategory": "efficacy",
          "evidenceLevel": "1A",
          "studyId": "1183960790",
          "literature": [
            "25266159",
            "22293084"
          ]
        },
        {
          "variantRsId": "rs121908757",
          "genotypeId": "7_117587799_A_C,C",
          "variantFunctionalConsequenceId": "SO_0001583",
          "drugId": "CHEMBL2010601",
          "phenotypeText": "Cystic Fibrosis",
          "pgxCategory": "efficacy",
          "evidenceLevel": "1A",
          "studyId": "1183960766",
          "literature": [
            "28947035",
            "25266159",
            "26474553",
            "22293084"
          ]
        },
       ...

For the drug profile the query would be:

query pharmacogenomicsQuery($chemblId: String!) {
  drug(chemblId: $chemblId) {
    id
    pharmacogenomics {
      targetFromSourceId
      variantRsId
      genotypeId
      variantFunctionalConsequenceId
      phenotypeText
      pgxCategory
      evidenceLevel
      studyId
      literature
    }
  }
}

And the response like:

{
  "data": {
    "drug": {
      "id": "CHEMBL2010601",
      "pharmacogenomics": [
        {
          "targetFromSourceId": "ENSG00000001626",
          "variantRsId": "rs193922525",
          "genotypeId": "7_117664770_G_A,A",
          "variantFunctionalConsequenceId": "SO_0001583",
          "phenotypeText": "Cystic Fibrosis",
          "pgxCategory": "efficacy",
          "evidenceLevel": "1A",
          "studyId": "1183960790",
          "literature": [
            "25266159",
            "22293084"
          ]
        },
        {
          "targetFromSourceId": "ENSG00000001626",
          "variantRsId": "rs121908757",
          "genotypeId": "7_117587799_A_C,C",
          "variantFunctionalConsequenceId": "SO_0001583",
          "phenotypeText": "Cystic Fibrosis",
          "pgxCategory": "efficacy",
          "evidenceLevel": "1A",
          "studyId": "1183960766",
          "literature": [
            "28947035",
            "25266159",
            "26474553",
            "22293084"
          ]
        },
        ...

I've truncated the above responses because the query returns everything. If you need pagination or counts or anything else, please let me know. @opentargets/data-team - I assume returning everything is going to be ok i.e. the response size will not be enormous for any given target/drug?

carcruz commented 8 months ago

Thanks @jdhayhurst everything looks great!

LucaFumis commented 8 months ago

(edited message) Thanks @jdhayhurst. Looking at the mockups for the widgets, it seems some columns require extra info, for example tooltips and links.

Example for widget on Target page: GenotypeId: needs also a description for tooltip Variant consequence: needs variant info for tooltip, not sure which field Drugs: needs drug name and id for the link Adverse outcome: phenotypeText + phenotypeFromSourceId for the link? tooltip: genotypeAnnotationText ? Adverse Outcome Category: possibly pgxCategory ?

On Drug page: almost all fields are the same, except Gene: targetFromSourceId, but would also need target name/symbol?

jdhayhurst commented 8 months ago

Hi @LucaFumis, thanks for looking though it. The full schema is here https://github.com/opentargets/issues/issues/3127#issuecomment-1775078317. All those fields are available, and I think they cover everything in the widget (it looks like I missed some fields from my graphql queries above - apologies for that). Can you let me and the @opentargets/data-team know if all fields you need are there. In your comment, I think you're referring to the json-schema, which is a json-schema describing the data that we can use for validation, but the schema you probably need is the graphql schema. The graphql schema is simply as follows:

type Pharmacogenomics {
  drugId: String
  drugFromSourceId: String
  datasourceId: String
  datasourceVersion: String
  datatypeId: String
  drugFromSource: String
  evidenceLevel: String
  genotype: String
  genotypeAnnotationText: String
  genotypeId: String
  literature: [String!]
  pgxCategory: String
  phenotypeFromSourceId: String
  phenotypeText: String
  studyId: String
  targetFromSourceId: String
  variantFunctionalConsequenceId: String
  variantRsId: String
  isDirectTarget: Boolean!
}

To be clear, I've added this Pharmacogenomics object to the target and drug objects, so all of these fields are accessible. None of them expand into custom objects, i.e. the genotype is a simply a string. If this is a requirement for any field (I don't think it is), please let me know.

So, for example, on the target page, under "Genotype ID", it's my understanding that we need provide the values from pharmacogenomics.genotypeId. The tooltip is just a hard-coded description with a link ("here") to somewhere that doesn't appear to be specified (@buniello?).

I hope that helps! Please let me know if you need anything else

ireneisdoomed commented 8 months ago

Thank you @LucaFumis and @jdhayhurst for looking into it!

Some comments on top of @buniello 's specifications: Target and drug widgets

Target widget

Drug widget

The rest of the fields are as pointed out in the widget prototype. Please chip in @opentargets/data-team @d0choa if you have any comments

jdhayhurst commented 8 months ago

Also phenotypeFromSourceId is nullable, which is used to construct the "Adverse Outcome" hyperlink

jdhayhurst commented 8 months ago

Here's the API as it stands (added Drug, Target and SequenceOntologyTerm objects):

type Pharmacogenomics {
  datasourceId: String
  datasourceVersion: String
  datatypeId: String
  drugId: String
  drugFromSource: String
  evidenceLevel: String
  genotype: String
  genotypeAnnotationText: String
  genotypeId: String
  literature: [String!]
  pgxCategory: String
  phenotypeFromSourceId: String
  phenotypeText: String
  studyId: String
  targetFromSourceId: String
  variantFunctionalConsequenceId: String
  variantRsId: String
  isDirectTarget: Boolean!
  variantFunctionalConsequence: SequenceOntologyTerm
  drug: Drug
  target: Target
}

If there's anything needs changing, just let me know 😉

LucaFumis commented 8 months ago

Thank you @ireneisdoomed and @jdhayhurst for the feedback and input. I probably won't be working on it, but let me know in case anything needed...

carcruz commented 8 months ago

@chinmehta is working on the UI now. By now, we will be using sample data, and as soon as the data is in dev, we change it.

chinmehta commented 8 months ago

@prashantuniyal02 @jdhayhurst Missing fields from mockup/api

Target and drug

jdhayhurst commented 8 months ago

Thanks @chinmehta! We might need some clarification from @prashantuniyal02 or @buniello on these last points you've raised. 1) genotypeId → tooltip see here for more details, "here" link is missing - I agree that we need clarification on where the link "here" goes. 2) I may have this wrong, but I don't think "pharmgkb" is a field, instead I think it's the link text. The link URL is constructed from the studyId field. 3) Not sure what how multiple pmids should be displayed, but it looks like all they need is the pmid to construct the link (like in the bibliography widget to europepmc). But if that's exactly what @buniello had in mind for this part?

prashantuniyal02 commented 8 months ago

For point 3, can we adopt the same behaviour as is present in the GEL PanelApp, UniProt literature or UniProt curated variants widget which have a Literature column?

buniello commented 8 months ago

Thank you @jdhayhurst @chinmehta @prashantuniyal02 Replying to James' points:

  1. here link is: https://github.com/apriltuesday/opentargets-pharmgkb/tree/issue-18#variant-coordinate-computation
  2. yes, you are right - text PharmGKB, linking out from the studyid field (as per my widget draft above)
  3. (see Prashant's comment above)
chinmehta commented 8 months ago

Thank you ! Also i noticed "Genotype ID" and "Confidence (Level)" have same static tooltip text. Would it make sense to move tooltip to column header ?

buniello commented 8 months ago

@chinmehta that is a good idea!

buniello commented 8 months ago

Already discussed and benchmarked with @chinmehta - (please let me know if anything is not clear) We would like to harmonise the pharmacogenomics widget to the Clinvar one, by adding:

Screenshot 2023-11-09 at 10 23 11

buniello commented 8 months ago

@chinmehta, as already discussed on slack, please see points below and let me know if everything is clear

Header should spell: Genetic variants that are associated with the response to drugId. Source: [PharmGKB](https://www.pharmgkb.org/). thedrugId` field should expose the drug name.

buniello commented 8 months ago

Latest version of drug and target profile PGx widgets are in the testing phase (external and internal test included).

ireneisdoomed commented 8 months ago

@chinmehta Some comments on the widget on drug and target pages:

image

buniello commented 8 months ago

Good catch @ireneisdoomed! will discuss these with @chinmehta on wednesday

prashantuniyal02 commented 8 months ago

A bug in the widget:


2 points raised by David:

Case in point: /target/ENSG00000167397

image

FYI @buniello