-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed the links and geneontology/go-site#2430
- Loading branch information
1 parent
b695a0e
commit ee47ea9
Showing
4 changed files
with
76 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import type { Annotation } from "@/features/annotations/models/annotation"; | ||
import { ENVIRONMENT } from "../data/constants"; | ||
import type { Gene } from "@/features/genes/models/gene"; | ||
|
||
export const getHGNC = (longId: string): string | null => { | ||
|
||
const pattern = /HGNC=(\d+)/; | ||
const matches = longId.match(pattern); | ||
|
||
if (matches && matches.length > 1) { | ||
return `HGNC:${matches[1]}`; | ||
} | ||
|
||
return null; | ||
|
||
} | ||
|
||
export const getUniprotLink = (gene: string) => { | ||
if (!gene) return ENVIRONMENT.uniprotUrl; | ||
|
||
const geneId = gene.split(':'); | ||
return geneId.length > 1 ? `${ENVIRONMENT.uniprotUrl}${geneId[1]}` : ENVIRONMENT.uniprotUrl; | ||
}; | ||
|
||
export const getFamilyLink = (element: Annotation) => { | ||
if (!element.pantherFamily || !element.longId) return ENVIRONMENT.pantherFamilyUrl; | ||
|
||
return `${ENVIRONMENT.pantherFamilyUrl}book=${encodeURIComponent(element.pantherFamily)}&seq=${encodeURIComponent(element.longId)}`; | ||
}; | ||
|
||
export const getUCSCBrowserLink = (annotation: Annotation | Gene) => { | ||
if (!annotation.coordinatesChrNum || !annotation.coordinatesStart || !annotation.coordinatesEnd) return ENVIRONMENT.ucscUrl; | ||
|
||
return `${ENVIRONMENT.ucscUrl}${annotation.coordinatesChrNum}:${annotation.coordinatesStart}-${annotation.coordinatesEnd}`; | ||
}; | ||
|
||
export const getAGRLink = (hgncId: string) => { | ||
if (!hgncId) return ENVIRONMENT.agrPrefixUrl; | ||
|
||
return ENVIRONMENT.agrPrefixUrl + hgncId; | ||
} | ||
|
||
export const getHGNCLink = (hgncId: string) => { | ||
if (!hgncId) return ENVIRONMENT.hgncPrefixUrl; | ||
|
||
return ENVIRONMENT.hgncPrefixUrl + hgncId; | ||
} | ||
|
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