Skip to content

Commit

Permalink
Merge pull request #368 from eweitz/fix-tissue-cache-url
Browse files Browse the repository at this point in the history
Fix URL code for tissue cache range fetch
  • Loading branch information
eweitz authored Jan 16, 2024
2 parents eae9d5a + 3611903 commit 7e6fe15
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ A [broader overview](https://speakerdeck.com/eweitz/ideogramjs-chromosome-visual

To link directly to the latest release, copy this snippet:
```
<script src="https://cdn.jsdelivr.net/npm/[email protected].0/dist/js/ideogram.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].1-beta/dist/js/ideogram.min.js"></script>
```

You can also easily use the library locally:
Expand All @@ -41,7 +41,7 @@ import Ideogram from 'ideogram';
# Usage
```html
<head>
<script src="https://cdn.jsdelivr.net/npm/[email protected].0/dist/js/ideogram.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].1-beta/dist/js/ideogram.min.js"></script>
</head>
<body>
<script>
Expand Down
2 changes: 1 addition & 1 deletion dist/js/ideogram.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/ideogram.min.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/*! Ideogram.js, version 1.45.0. Developed by Eric Weitz. https://github.com/eweitz/ideogram. Public domain (CC0 1.0). */
/*! Ideogram.js, version 1.45.1-beta. Developed by Eric Weitz. https://github.com/eweitz/ideogram. Public domain (CC0 1.0). */
2 changes: 1 addition & 1 deletion dist/js/ideogram.min.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ideogram",
"version": "1.45.0",
"version": "1.45.1-beta",
"description": "Chromosome visualization for the web",
"main": "src/js/index.js",
"preferGlobal": true,
Expand Down
2 changes: 2 additions & 0 deletions src/js/init/caches/cache-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ export async function cacheFetch(url) {
}

export async function cacheRangeFetch(url, byteRange) {
url = url.replace('.gz', '');

// +/- 1 to trim newlines
const rangeStart = byteRange[0] + 1;
const rangeEnd = byteRange[1] - 1;
Expand Down
16 changes: 11 additions & 5 deletions src/js/init/caches/tissue-cache-worker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
fetchAndParse, getFullId, inspectWorker,
cacheFetch, cacheRangeFetch
cacheFetch, cacheRangeFetch, getCacheUrl
} from './cache-lib';


Expand Down Expand Up @@ -36,10 +36,16 @@ async function getTissueExpressions(gene, ideo) {

if (!byteRange) return null;

const geneDataLine = await cacheRangeFetch(
'/dist/data/cache/tissues/homo-sapiens-tissues.tsv',
byteRange
);
const config = ideo.config;
let cacheDir = null;
if (config.cacheDir) cacheDir = config.cacheDir;
const cacheType = 'tissues';
const extension = 'tsv';

const orgName = 'homo-sapiens';
const cacheUrl = getCacheUrl(orgName, cacheDir, cacheType, extension);

const geneDataLine = await cacheRangeFetch(cacheUrl, byteRange);

const tissueExpressions = [];
const rawExpressions = geneDataLine.split('\t').slice(1);
Expand Down
2 changes: 1 addition & 1 deletion src/js/version.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
var version = '1.45.0';
var version = '1.45.1-beta';
export default version;

0 comments on commit 7e6fe15

Please sign in to comment.