-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
153 additions
and
33 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
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
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,68 @@ | ||
/** | ||
* Queries for strucvars information powered by TanStack Query. | ||
*/ | ||
import { QueryClient, useQuery } from '@tanstack/vue-query' | ||
import { MaybeRefOrGetter, toValue } from 'vue' | ||
|
||
import { strucvarsClinvarQueryOptions } from '../../ext/annonars-api/src/lib/@tanstack/vue-query.gen' | ||
import { ClinvarExtractedVariationType } from '../../ext/annonars-api/src/lib' | ||
|
||
/** | ||
* Query for overlapping ClinVar structural variants. | ||
* | ||
* @param genome_release The genome release to use. | ||
* @param chromosome The chromosome to use. | ||
* @param start The start position to use (1-based). | ||
* @param stop The stop position to use (1-based). | ||
* @param variation_types The variation types to use; optional. | ||
* @param min_overlap The minimum overlap to use; optional. | ||
* @param page_no The page number to use; optional. | ||
* @param page_size The page size to use; optional. | ||
* @returns The query result. | ||
*/ | ||
export const useAnnonarsStrucvarsClinvarQuery = ( | ||
{ | ||
genome_release, | ||
chromosome, | ||
start, | ||
stop, | ||
variation_types, | ||
min_overlap, | ||
page_no, | ||
page_size | ||
}: { | ||
genome_release: MaybeRefOrGetter<string | undefined> | ||
chromosome: MaybeRefOrGetter<string | undefined> | ||
start: MaybeRefOrGetter<number | undefined> | ||
stop: MaybeRefOrGetter<number | undefined> | ||
variation_types?: MaybeRefOrGetter<Array<ClinvarExtractedVariationType> | undefined> | ||
min_overlap?: MaybeRefOrGetter<number | undefined> | ||
page_no?: MaybeRefOrGetter<number | undefined> | ||
page_size?: MaybeRefOrGetter<number | undefined> | ||
}, | ||
queryClient?: QueryClient | ||
) => | ||
useQuery( | ||
{ | ||
...strucvarsClinvarQueryOptions({ | ||
// @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011 | ||
query: () => ({ | ||
genome_release: toValue(genome_release), | ||
chromosome: toValue(chromosome), | ||
start: toValue(start), | ||
stop: toValue(stop), | ||
variation_types: toValue(variation_types ?? (() => undefined)) === undefined ? undefined : toValue(variation_types)?.join(","), | ||
min_overlap: toValue(min_overlap ?? (() => undefined)), | ||
page_no: toValue(page_no ?? (() => undefined)), | ||
page_size: toValue(page_size ?? (() => undefined)) | ||
}) | ||
}), | ||
staleTime: Infinity, // static data so no need to refetch | ||
enabled: () => | ||
!!toValue(genome_release) && | ||
!!toValue(chromosome) && | ||
!!toValue(start) && | ||
!!toValue(stop) | ||
}, | ||
queryClient | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* Queries for seqvars information powered by TanStack Query. | ||
*/ | ||
import { QueryClient, useQuery } from '@tanstack/vue-query' | ||
import { MaybeRefOrGetter, toValue } from 'vue' | ||
|
||
import { strucvarsCsqOptions } from '../../ext/mehari-api/src/lib/@tanstack/vue-query.gen' | ||
import { StrucvarsSvType } from '../../ext/mehari-api/src/lib' | ||
|
||
/** | ||
* Query for the consequence of a seqvar. | ||
* | ||
* @param genome_release The genome release to use. | ||
* @param chromosome The chromosome to use. | ||
* @param position The position to use. | ||
* @param reference The reference to use. | ||
* @param alternative The alternative to use. | ||
* @param hgnc_id The HGNC ID to use; optional. | ||
* @returns The query result. | ||
*/ | ||
export const useMehariStrucvarsCsqQuery = ( | ||
{ | ||
genome_release, | ||
chromosome, | ||
start, | ||
stop, | ||
sv_type, | ||
}: { | ||
genome_release: MaybeRefOrGetter<string | undefined> | ||
chromosome: MaybeRefOrGetter<string | undefined> | ||
start: MaybeRefOrGetter<number | undefined> | ||
stop?: MaybeRefOrGetter<number | undefined> | ||
sv_type: MaybeRefOrGetter<StrucvarsSvType | undefined> | ||
}, | ||
queryClient?: QueryClient | ||
) => | ||
useQuery( | ||
{ | ||
...strucvarsCsqOptions({ | ||
// @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011 | ||
query: () => ({ | ||
genome_release: toValue(genome_release), | ||
chromosome: toValue(chromosome), | ||
start: toValue(start), | ||
stop: toValue(stop ?? (() => undefined)), | ||
sv_type: toValue(sv_type) | ||
}) | ||
}), | ||
staleTime: Infinity, // static data so no need to refetch | ||
enabled: () => | ||
!!toValue(genome_release) && | ||
!!toValue(chromosome) && | ||
!!toValue(start) && | ||
!!toValue(sv_type) | ||
}, | ||
queryClient | ||
) |
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