How to access FinnGen GWAS data using the Open Targets Genetics Portal API

We recently released version 5 of the Open Targets Genetics Portal. As part of the release, we integrated the latest data freeze from FinnGen (R5).

You can explore the FinnGen data on the web interface, or keep reading for examples of using our GraphQL API to query data from FinnGen.

Querying FinnGen data in OT Genetics

To find FinnGen GWAS results through the API, you need to provide the FinnGen study ID in our format — FINNGEN_R5_ + FinnGen endpoint ID.

For example, the Type 2 diabetes E4_DM2 endpoint in FinnGen corresponds to a Genetics Portal study ID of FINNGEN_R5_E4_DM2.

Sample scripts

@ahercules has provided some sample queries you can test, using the FINNGEN_R5_FG_hypertension study.

Getting a Manhattan plot

Run the script in the API Playground.

query exampleFinnGenStudyQuery {
  manhattan(studyId: "FINNGEN_R5_FG_HYPERTENSION") {
    associations {
      variant {
        id
        rsId
        chromosome
        position
        nearestCodingGene {
          id
          symbol
        }
        nearestCodingGeneDistance
      }
      pval
      credibleSetSize
      ldSetSize
      oddsRatio
      oddsRatioCILower
      oddsRatioCIUpper
      beta
      betaCILower
      betaCIUpper
      direction
      bestGenes {
        score
        gene {
          id
          symbol
        }
      }
      bestColocGenes {
        score
        gene {
          id
          symbol
        }
      }
      bestLocus2Genes {
        score
        gene {
          id
          symbol
        }
      }
    }
  }
}

Gene prioritisation using Locus-to-Gene (L2G) data

Run the script in the API Playground.

query genePrioritisationUsingL2G {
  studyLocus2GeneTable(studyId: "FINNGEN_R5_FG_HYPERTENSION", variantId: "15_90885291_CT_C") {
    rows {
      gene {
        symbol
        id
      }
      yProbaModel
      yProbaDistance
      yProbaInteraction
      yProbaMolecularQTL
      yProbaPathogenicity
      hasColoc
      distanceToLocus
    }
  }
}

Gene prioritisation using colocalisation analysis

Run the script in the API Playground.

query genePrioritisationUsingColocalisationAnalysis {
  qtlColocalisation(studyId: "FINNGEN_R5_FG_HYPERTENSION", variantId: "15_74821981_T_C") {
    indexVariant {
      id
      rsId
      chromosome
      position
      refAllele
      altAllele
    }
    gene {
      id
      symbol
      chromosome
      start
      end
      bioType
    }
    phenotypeId
    tissue {
      id
      name
    }
    qtlStudyName
    beta
    h3
    h4
    log2h4h3
  }
}

Have you used the Genetics Portal API? Let us know your top tips!

1 Like

Any ideas why the FINNGEN_R5_FG_HYPERTENSION example manhattan() query leads to zero associations?

Here is how playground looks like:

I am not able to get any results, when I query GraphQL API with any FINNGEN study ids. Any help is appreciated…

Gokcen.

1 Like

Oh, I just noticed that the API URL also changed (http://genetics-api.opentargets.iohttps://api.genetics.opentargets.org/) and the old URL points to the older instance where FINNGEN results are not included.

OK, good to figure this out :slight_smile:

Hi @gokceneraslan! :wave:

Welcome to the Open Targets Community! :tada:

Can you please tell us where you found the previous API URL http://genetics-api.opentargets.io ? We may have forgotten to update a link and just want to make sure that all links point to the correct URL.

Thank you! :slight_smile:

Cheers,

Andrew

1 Like

Hi @ahercules ,

Thanks :slight_smile: I have a Python OTG GraphQL wrapper (opentargets-genetics-python/genetics.py at master · gokceneraslan/opentargets-genetics-python · GitHub) and the old API endpoint was simply written in one of the scripts there. So it’s totally on me :slight_smile: Now, I am working on an update to use the latest OTG GraphQL API.

PS: Wouldn’t it be more convenient to simply redirect the old API endpoint to the new one for those who are using the API from scripts like me?

Cheers,
Gokcen.

1 Like