-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restructure content and fetch kgs at render
Squashed commit of the following: commit 4e112ab6bb8117e51390741ba8f6ea499fdea3ee Author: Matt Watson <mattwat@gmail.com> Date: Thu Sep 24 16:17:42 2020 -0400 refactor dbGaP-link building functions commit 682b2f3929f50a9d9444156bc2cc7941dc4af9ad Author: Matt Watson <mattwat@gmail.com> Date: Thu Sep 24 16:15:00 2020 -0400 rename dbGaP link utilities commit 4bc03f2012bc46f17fbad2e68cdcfc408ddd646e Author: Matt Watson <mattwat@gmail.com> Date: Thu Sep 24 16:14:36 2020 -0400 add external link component commit 931a599560d918eb971cb2f39ee6af3e6635653a Author: Matt Watson <mattwat@gmail.com> Date: Thu Sep 24 15:52:11 2020 -0400 render result description above its instructions commit da25aa8e7fdabd1e9f0c342782dc929df0cd0283 Author: Matt Watson <mattwat@gmail.com> Date: Thu Sep 24 15:49:01 2020 -0400 fetch kg for result at time of render bump version
- Loading branch information
Showing
5 changed files
with
51 additions
and
37 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,9 @@ | ||
import PropTypes from 'prop-types' | ||
import styled from 'styled-components' | ||
|
||
export const ExternalLink = styled.a.attrs(props => ({ target: '_blank', rel: 'noopener noreferrer', href: props.to }))`` | ||
|
||
ExternalLink.propTypes = { | ||
to: PropTypes.string.isRequired, | ||
} | ||
|
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 |
---|---|---|
@@ -1,15 +1,17 @@ | ||
const DB_GAP_URL = `https://www.ncbi.nlm.nih.gov/projects/gap/cgi-bin/variable.cgi` | ||
|
||
export const dbGapStudyLink = (studyId, variable) => { | ||
// variable always has the form "phv987654321.v12.p23" | ||
// and the "987654321" portion is used in the dbGap link | ||
const matches = variable.match(/phv(\d+)\.v\d+\.p\d+$/) | ||
if (matches) { | ||
const [, variableDigits] = matches | ||
return variableDigits ? `${ DB_GAP_URL }?study_id=${ studyId }&phv=${ variableDigits }` : `${ DB_GAP_URL }?studyId=${ studyId }&phv=${ variable }` | ||
} else { | ||
return null | ||
} | ||
export const dbGapLink = { | ||
variable: (studyId, variable) => { | ||
// variable always has the form "phv987654321.v12.p23" | ||
// and the "987654321" portion is used in the dbGap link | ||
const matches = variable.match(/phv(\d+)\.v\d+\.p\d+$/) | ||
if (matches) { | ||
const [, variableDigits] = matches | ||
return variableDigits ? `${ DB_GAP_URL }?study_id=${ studyId }&phv=${ variableDigits }` : `${ DB_GAP_URL }?studyId=${ studyId }&phv=${ variable }` | ||
} else { | ||
return null | ||
} | ||
}, | ||
study: studyId => `${ DB_GAP_URL }?study_id=${ studyId }`, | ||
} | ||
|
||
export const accessionLink = studyId => `${ DB_GAP_URL }?study_id=${ studyId }` |