diff --git a/src/components/variant/VariantJBrowseLink.js b/src/components/variant/VariantJBrowseLink.js index 6a1351225..cee8a2e10 100644 --- a/src/components/variant/VariantJBrowseLink.js +++ b/src/components/variant/VariantJBrowseLink.js @@ -20,7 +20,7 @@ const calculateHighlight = (location, type) => { } }; - +const LINK_BUFFER = 1.2; const buildTrackList = (taxonid) => { const tracks = []; @@ -36,20 +36,25 @@ const buildAssembly = (taxonid) => { return getSpecies(taxonid).jBrowseName.replace(' ', '_'); } +const buildLoc = (location) => { + const start = location.start || 0; + const end = location.end || 0 + const linkLength = end - start; + if (linkLength === 0 ) { return; } + let bufferedMin = Math.round(start - (linkLength * LINK_BUFFER / 2.5)); + bufferedMin = bufferedMin < 0 ? 0 : bufferedMin; + const bufferedMax = Math.round(end + (linkLength * LINK_BUFFER )); + return location.chromosome + ':' + bufferedMin + '..' + bufferedMax ; +} const VariantJBrowseLink = ({children, location, type, geneSymbol, geneLocation, taxonid}) => { return ( location ?