-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some API documentation for endusers
Here we start adding docs covering the basics of using our GraphQL API, including how to fetch all variant frequencies for a gene.
- Loading branch information
1 parent
5f82af5
commit ee78ad0
Showing
21 changed files
with
2,598 additions
and
1,833 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import React from 'react' | ||
|
||
import { CodeBlock, SectionTitle, StyledParagraph } from './downloadsPageStyles' | ||
|
||
import styled from 'styled-components' | ||
|
||
import { ExternalLink, Tabs } from '@gnomad/ui' | ||
import exampleRawQuery from './exampleRawGraphQLQuery' | ||
import examplePythonQuery from './examplePythonGraphQLQuery' | ||
import exampleJSQuery from './exampleJSGraphQLQuery' | ||
|
||
const GraphQLCodeBlock = styled(CodeBlock)` | ||
white-space: pre-wrap; | ||
&::before { | ||
content: none; | ||
} | ||
` | ||
|
||
const GraphQLDocs = () => ( | ||
<> | ||
<SectionTitle id="api">gnomAD API</SectionTitle> | ||
<StyledParagraph> | ||
The gnomAD browser gets its data through a{' '} | ||
{/* @ts-expect-error TS(2786) FIXME: 'ExternalLink' cannot be used as a JSX component. */} | ||
<ExternalLink href="https://graphql.org">GraphQL</ExternalLink> API which is open to the | ||
public. Access to the API is rate-limited to 10 requests per 60-second period. | ||
</StyledParagraph> | ||
<StyledParagraph> | ||
The API can be queried programatically by making an HTTP request to{' '} | ||
<a href="/api">https://gnomad.broadinstitute.org/api</a>. Please see the GraphQL documentation | ||
for details on how to{' '} | ||
{/* @ts-expect-error TS(2786) FIXME: 'ExternalLink' cannot be used as a JSX component. */} | ||
<ExternalLink href="https://graphql.org/learn/queries/"> | ||
construct a query | ||
</ExternalLink> and{' '} | ||
{/* @ts-expect-error TS(2786) FIXME: 'ExternalLink' cannot be used as a JSX component. */} | ||
<ExternalLink href="https://graphql.org/learn/serving-over-http/#http-methods-headers-and-body"> | ||
format it to send it over HTTP | ||
</ExternalLink> | ||
. | ||
</StyledParagraph> | ||
<StyledParagraph> | ||
You can also use the API interactively by visiting <a href="/api">the same address</a> in your | ||
browser, which is useful for experimenting with queries. That interface also allows you to | ||
explore the API schema interactively. | ||
</StyledParagraph> | ||
<StyledParagraph> | ||
The following is an annotated GraphQL query, with some small example programs for a subset of | ||
that query in Python and JavaScript. This query gets similar data to the CSV export of all | ||
variants for gene <a href="/gene/ENSG00000012048?dataset=gnomad_r4">BRCA1</a>. | ||
</StyledParagraph> | ||
{/* @ts-expect-error TS(2741) FIXME: Property 'onChange' is missing in type '{ tabs: { ... Remove this comment to see the full error message */} | ||
<Tabs | ||
tabs={[ | ||
{ | ||
id: 'rawQuery', | ||
label: 'Raw Query', | ||
render: () => <GraphQLCodeBlock>{exampleRawQuery}</GraphQLCodeBlock>, | ||
}, | ||
{ | ||
id: 'pythonQuery', | ||
label: 'Python', | ||
render: () => <GraphQLCodeBlock>{examplePythonQuery}</GraphQLCodeBlock>, | ||
}, | ||
{ | ||
id: 'jsQuery', | ||
label: 'JavaScript', | ||
render: () => <GraphQLCodeBlock>{exampleJSQuery}</GraphQLCodeBlock>, | ||
}, | ||
]} | ||
/> | ||
</> | ||
) | ||
|
||
export default GraphQLDocs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.