-
Notifications
You must be signed in to change notification settings - Fork 6
docs(lapis): improve landing page, describe lineage queries #1702
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
Open
chaoran-chen
wants to merge
2
commits into
main
Choose a base branch
from
improve-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
55 changes: 55 additions & 0 deletions
55
lapis-docs/src/content/docs/concepts/customizable-fasta-headers.mdx
This file contains hidden or 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,55 @@ | ||
| --- | ||
| title: Customizable FASTA headers | ||
| description: Customize the header line of FASTA records returned by sequence endpoints | ||
| --- | ||
|
|
||
| When requesting sequences as FASTA, you can customize the header line of each record by setting the | ||
| `fastaHeaderTemplate` request property. | ||
| The parameter is ignored if the data format is not FASTA. | ||
|
|
||
| The template allows placeholders in curly braces: | ||
|
|
||
| - `{<metadataField>}` — replaced with the value of the metadata field for that sequence (e.g. `{country}`). | ||
| The instance's primary key field (configured by the maintainer) can be used as a placeholder in the same way. | ||
| - `{.segment}` — replaced with the segment name. Only valid on nucleotide sequence endpoints. | ||
| - `{.gene}` — replaced with the gene name. Only valid on amino acid sequence endpoints. | ||
|
|
||
| If a metadata value is `null`, the placeholder is replaced with an empty string. | ||
|
|
||
| If `fastaHeaderTemplate` is not set, LAPIS uses a default that includes the primary key (and the gene name | ||
| for amino acid sequences, and the segment name for multi-segmented nucleotide sequences). | ||
|
|
||
| The template contains characters (`{`, `}`, `|`) that are not URL-safe. | ||
| When sending the request as a GET, the value of `fastaHeaderTemplate` must be URL-encoded. | ||
| In JavaScript, this can be done with the | ||
| [encodeURIComponent()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) | ||
| function. POST requests can carry the template unencoded in the JSON body. | ||
|
|
||
| ## Examples | ||
|
|
||
| Assuming the instance's primary key field is named `accession`, include it together with a separator and two | ||
| metadata fields. As a POST request, the template can be sent unencoded: | ||
|
|
||
| ```http | ||
| POST /sample/alignedNucleotideSequences | ||
|
|
||
| { | ||
| "fastaHeaderTemplate": "{accession}|{country}|{date}" | ||
| } | ||
| ``` | ||
|
|
||
| The same query as a GET request, with the template URL-encoded: | ||
|
|
||
| ``` | ||
| GET /sample/alignedNucleotideSequences?fastaHeaderTemplate=%7Baccession%7D%7C%7Bcountry%7D%7C%7Bdate%7D | ||
| ``` | ||
|
|
||
| For amino acid sequences, include the gene name (useful when requesting multiple genes in one call): | ||
|
|
||
| ```http | ||
| POST /sample/alignedAminoAcidSequences | ||
|
|
||
| { | ||
| "fastaHeaderTemplate": "{accession}|{.gene}" | ||
| } | ||
| ``` | ||
This file contains hidden or 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,48 @@ | ||
| --- | ||
| title: Lineage queries | ||
| description: Filtering lineage fields and their descendants | ||
| --- | ||
|
|
||
| import { OnlyIf } from '../../../components/OnlyIf.tsx'; | ||
| import { getConfig, hasLineageFields } from '../../../config.ts'; | ||
| import { Code } from '@astrojs/starlight/components'; | ||
|
|
||
| export const lineageField = 'lineageField'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We usually tried to write the actual field names into the example, since we assume that the docs page runs next to an actual LAPIS instance. We could search the config for a lineage field and only use this hardcoded value as fallback |
||
|
|
||
| {/* prettier-ignore */} | ||
| <OnlyIf condition={!hasLineageFields(getConfig())}> | ||
| :::note | ||
| This LAPIS instance does not provide lineage queries. | ||
| ::: | ||
| </OnlyIf> | ||
|
|
||
| A lineage field stores values that form a hierarchy. | ||
| For example, if `B.1.1` is a sub-lineage of `B.1`, then a query for `B.1*` can include records assigned to `B.1`, | ||
| `B.1.1`, `B.1.1.7`, and other descendants. | ||
|
|
||
| ## Exact Matches | ||
|
|
||
| Without a wildcard, lineage filters match only the exact lineage value: | ||
|
|
||
| <Code lang='http' code={`GET /sample/aggregated?${lineageField}=B.1.1`} /> | ||
|
|
||
| This returns records whose lineage field value is exactly `B.1.1`. | ||
|
|
||
| ## Including Descendants | ||
|
|
||
| To include sub-lineages, add `*` at the end of the lineage: | ||
|
|
||
| <Code lang='http' code={`GET /sample/aggregated?${lineageField}=B.1.1*`} /> | ||
|
|
||
| `B.1.1*` and `B.1.1.*` are equivalent. | ||
| Both match `B.1.1` itself and descendants such as `B.1.1.7`. | ||
|
|
||
| ## Advanced Queries | ||
|
|
||
| Lineage-indexed fields can also be used in [advanced queries](../concepts/advanced-query): | ||
|
|
||
| <Code lang='http' code={`GET /sample/aggregated?advancedQuery=${lineageField}=B.1.1*`} /> | ||
|
|
||
| In POST requests, use the same expression as the `advancedQuery` value: | ||
|
|
||
| <Code lang='json' code={JSON.stringify({ advancedQuery: `${lineageField}=B.1.1*` }, null, 4)} /> | ||
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,15 +1,50 @@ | ||
| --- | ||
| title: Welcome to LAPIS | ||
| description: Get started with LAPIS | ||
| description: Lightweight API for Sequences — query genomic data over HTTP | ||
| template: splash | ||
| hero: | ||
| tagline: Instance for SARS-CoV-2 | ||
| tagline: A fast, lightweight API for querying genomic sequence data | ||
| actions: | ||
| - text: Introduction | ||
| - text: Get started | ||
| link: getting-started/introduction | ||
| icon: right-arrow | ||
| variant: primary | ||
| - text: LAPIS on GitHub | ||
| - text: Source code on GitHub | ||
| link: https://github.com/GenSpectrum/LAPIS | ||
| icon: external | ||
| variant: minimal | ||
| --- | ||
|
|
||
| ## What is LAPIS? | ||
|
|
||
| LAPIS (**Lightweight API for Sequences**) is an open-source HTTP API for querying large | ||
| collections of pathogen genome sequences. It is built for researchers, public health | ||
| analysts and developers who need to filter, aggregate or download genomic data | ||
| programmatically. | ||
|
|
||
| Under the hood, LAPIS delegates storage and fast filter execution to | ||
| [**SILO**](https://github.com/GenSpectrum/LAPIS-SILO), a purpose-built sequence database. | ||
|
|
||
| ## Known instances | ||
|
|
||
| LAPIS is deployed in a number of production systems: | ||
|
|
||
| - **[CoV-Spectrum](https://cov-spectrum.org) and [GenSpectrum](https://genspectrum.org)** are interactive dashboards for | ||
| analyzing virus variants and mutations, backed by a LAPIS instance over INSDC and Pathoplexus data. | ||
| - **[Loculus](https://loculus.org)** is an open-source software for managing and sharing microbial genome data that uses | ||
| LAPIS and SILO as its query engine. Production Loculus deployments include | ||
| [Pathoplexus](https://pathoplexus.org), an initiative to facilitate sharing of | ||
| genetic sequencing data for human viruses of public health importance. | ||
| - **[W-ASAP](https://db.wasap.genspectrum.org/)** uses a LAPIS instance for wastewater sequencing data, supporting queries over mutation abundances | ||
| from Swiss wastewater samples. | ||
|
|
||
| If you are operating a public LAPIS instance and want it to be listed here, please open an issue on | ||
| [GitHub](https://github.com/GenSpectrum/LAPIS). | ||
|
|
||
| ## Citation | ||
|
|
||
| If you use LAPIS in your work, please cite: | ||
|
|
||
| > Chen, C., Taepper, A., Engelniederhammer, F., Kellerer, J., Roemer, C. & Stadler, T. "LAPIS is a fast web API for | ||
| > massive open virus sequencing data" BMC Bioinformatics (2023); doi: | ||
| > [10.1186/s12859-023-05364-3](https://doi.org/10.1186/s12859-023-05364-3) |
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
LAPIS returns an error in this case.