Skip to content

Commit

Permalink
Upgrade dependencies, refactor tests (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-veit authored Jan 11, 2023
1 parent 06c9b87 commit f26b9df
Show file tree
Hide file tree
Showing 13 changed files with 8,001 additions and 21,221 deletions.
3 changes: 1 addition & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require('babel-polyfill');
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine', 'server-side'],
frameworks: ['jasmine'],

files: [
'node_modules/babel-polyfill/dist/polyfill.js',
Expand Down Expand Up @@ -38,7 +38,6 @@ module.exports = function(config) {
'karma-sourcemap-loader',
'karma-chrome-launcher',
'karma-phantomjs-launcher',
'karma-server-side',
'karma-verbose-reporter'
],

Expand Down
28,479 changes: 7,909 additions & 20,570 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 5 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "higlass-transcripts",
"version": "0.3.7",
"version": "0.3.8",
"description": "Gene transcripts track for HiGlass",
"private": false,
"author": "Alexander Veit",
Expand All @@ -20,11 +20,9 @@
],
"repository": "github:higlass/higlass-transcripts",
"devDependencies": {
"autoprefixer": "^8.6.5",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",
"box-intersect": "^1.0.1",
"file-loader": "^1.1.11",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.1.0",
Expand All @@ -36,10 +34,6 @@
"unminified-webpack-plugin": "^2.0.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3",
"fetch-mock": "^8.3.2",
"karma-server-side": "^1.8.0",
"fs-extra": "^8.1.0",
"fs": "0.0.2",
"jasmine": "^2.99.0",
"karma": "^4.4.1",
"karma-chrome-launcher": "^3.1.0",
Expand All @@ -53,10 +47,10 @@
"babel-preset-react": "^6.24.1",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.6.0",
"i": "^0.3.6",
"sourcemap": "^0.1.0",
"webpack": "^4.43.0",
"higlass": "^1.11.11"
"higlass": "^1.11.11",
"cheerio": "=1.0.0-rc.3"
},
"scripts": {
"build-es": "rm -rf ./es/* && npx babel ./src/scripts/ --out-dir ./es/ --env-name esm",
Expand All @@ -70,7 +64,7 @@
"d3-scale": "^4.0.2",
"d3-color": "^3.1.0",
"higlass-register": "^0.3.0",
"@gmod/indexedfasta": "1.1.0",
"generic-filehandle": "2.2.3"
"@gmod/indexedfasta": "^2.0.0",
"generic-filehandle": "^3.0.0"
}
}
10 changes: 5 additions & 5 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
}
</style>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<link rel="stylesheet" href="https://unpkg.com/[email protected].8/dist/hglib.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected].11/dist/hglib.css">
<link rel="stylesheet" href="hglib.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/pixi.js/5.2.3/pixi.min.js"></script>
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script crossorigin src="https://unpkg.com/[email protected].8/dist/hglib.min.js"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/react@16/umd/react.development.js"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/react-dom@16/umd/react-dom.development.js"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/[email protected].11/dist/hglib.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-bootstrap/0.32.1/react-bootstrap.min.js"></script>
</head>
<body>
Expand All @@ -29,7 +29,7 @@
<div style="height: 1500px"></div>
</body>
<script src="hglib.js"></script>
<script crossorigin src="https://unpkg.com/higlass-sequence/dist/higlass-sequence.js"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/higlass-sequence/dist/higlass-sequence.js"></script>
<script>
var viewConfig =
{
Expand Down
66 changes: 22 additions & 44 deletions test/AminoAcidTests.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { expect } from "chai";
import register from "higlass-register";

import FetchMockHelper from "./utils/FetchMockHelper";

import { HiGlassComponent, getTrackObjectFromHGC } from "higlass";

import { getTrackObjectFromHGC } from "higlass";

import {
waitForDataLoaded,
mountHGComponent,
removeHGComponent,
} from "./utils/test-helpers";
Expand All @@ -21,55 +20,34 @@ register({
config: TranscriptsTrack.config,
});

describe("Amino acid", () => {
const fetchMockHelper = new FetchMockHelper("", "AminoAcidTests");
describe("Amino acid tests", () => {
let hgc = null;
let div = null;

beforeAll(async () => {
await fetchMockHelper.activateFetchMock();
beforeAll((done) => {
[div, hgc] = mountHGComponent(div, hgc, viewConf, done);
});

describe("Amino acid tests", () => {
let hgc = null;
let div = null;

beforeAll((done) => {
[div, hgc] = mountHGComponent(div, hgc, viewConf, done);
});

it("tests that the export works and contains the correct data", (done) => {

const trackObj = getTrackObjectFromHGC(
hgc.instance(),
viewConf.views[0].uid,
viewConf.views[0].tracks.top[0].uid
);
const tile = trackObj.visibleAndFetchedTiles()[0];

setTimeout(() => {


console.log(tile.aaInfo.exonOffsets["ENST00000378404.3_chr1_3021483_3022903"]);
console.log(tile.aaInfo.aminoAcids);

done();
}, 2000);






it("tests that the export works and contains the correct data", (done) => {

const trackObj = getTrackObjectFromHGC(
hgc.instance(),
viewConf.views[0].uid,
viewConf.views[0].tracks.top[0].uid
);
const tile = trackObj.visibleAndFetchedTiles()[0];

setTimeout(() => {

});
console.log(tile.aaInfo.exonOffsets["ENST00000378404.3_chr1_3021483_3022903"]);
console.log(tile.aaInfo.aminoAcids);

done();
}, 2000);

afterAll(() => {
removeHGComponent(div);
});
});

afterAll(async () => {
await fetchMockHelper.storeDataAndResetFetchMock();
afterAll(() => {
removeHGComponent(div);
});
});
65 changes: 26 additions & 39 deletions test/SVGExportTests.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { expect } from "chai";
import register from "higlass-register";

import FetchMockHelper from "./utils/FetchMockHelper";

import { HiGlassComponent, getTrackObjectFromHGC } from "higlass";
import { getTrackObjectFromHGC } from "higlass";

import {
waitForDataLoaded,
mountHGComponent,
removeHGComponent,
} from "./utils/test-helpers";
Expand All @@ -21,53 +18,43 @@ register({
config: TranscriptsTrack.config,
});


describe("SVG export", () => {
const fetchMockHelper = new FetchMockHelper("", "SVGExport");
let hgc = null;
let div = null;

beforeAll(async () => {
await fetchMockHelper.activateFetchMock();
beforeAll((done) => {
[div, hgc] = mountHGComponent(div, hgc, viewConf, done);
});

describe("SVG export", () => {
let hgc = null;
let div = null;

beforeAll((done) => {
[div, hgc] = mountHGComponent(div, hgc, viewConf, done);
});
it("tests that the export works and contains the correct data", (done) => {
hgc.instance().handleExportSVG();

it("tests that the export works and contains the correct data", (done) => {
hgc.instance().handleExportSVG();
const trackObj = getTrackObjectFromHGC(
hgc.instance(),
viewConf.views[0].uid,
viewConf.views[0].tracks.top[1].uid
);

const trackObj = getTrackObjectFromHGC(
hgc.instance(),
viewConf.views[0].uid,
viewConf.views[0].tracks.top[1].uid
);
const tile = trackObj.visibleAndFetchedTiles()[1];
const exon = tile.allExonsForSVG[1];

const tile = trackObj.visibleAndFetchedTiles()[1];
const exon = tile.allExonsForSVG[1];
expect(exon.rect[0]).to.equal(282.39750000000004);
expect(exon.rect[5]).to.equal(33);
expect(exon.color).to.equal("#C0EAAF");

expect(exon.rect[0]).to.equal(285.4775);
expect(exon.rect[5]).to.equal(33);
expect(exon.color).to.equal("#C0EAAF");
const exon2 = tile.allExonsForSVG[2];

const exon2 = tile.allExonsForSVG[2];
expect(exon2.rect[0]).to.equal(324.7475);
expect(exon2.rect[5]).to.equal(33);
expect(exon2.color).to.equal("#bdbfff");

expect(exon2.rect[0]).to.equal(324.7475);
expect(exon2.rect[5]).to.equal(33);
expect(exon2.color).to.equal("#bdbfff");


done();
});

afterAll(() => {
removeHGComponent(div);
});
done();
});

afterAll(async () => {
await fetchMockHelper.storeDataAndResetFetchMock();
afterAll(() => {
removeHGComponent(div);
});
});

86 changes: 29 additions & 57 deletions test/TranscriptsTests.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { expect } from "chai";
import register from "higlass-register";

import FetchMockHelper from "./utils/FetchMockHelper";

import { HiGlassComponent, getTrackObjectFromHGC } from "higlass";
import { getTrackObjectFromHGC } from "higlass";

import {
waitForDataLoaded,
mountHGComponent,
removeHGComponent,
} from "./utils/test-helpers";
Expand All @@ -21,70 +18,45 @@ register({
config: TranscriptsTrack.config,
});

describe("Transcripts", () => {
const fetchMockHelper = new FetchMockHelper("", "TranscriptTests");

beforeAll(async () => {
await fetchMockHelper.activateFetchMock();
});

describe("Transcripts tests", () => {
let hgc = null;
let div = null;

beforeAll((done) => {
[div, hgc] = mountHGComponent(div, hgc, viewConf, done);
});

it("tests that basic infos are correct", (done) => {



const trackObj = getTrackObjectFromHGC(
hgc.instance(),
viewConf.views[0].uid,
viewConf.views[0].tracks.top[0].uid
);

//const tile = trackObj.visibleAndFetchedTiles()[2];
describe("Transcripts tests", () => {
let hgc = null;
let div = null;

expect(trackObj.trackHeight).to.equal(106);
expect(Object.keys(trackObj.transcriptInfo).length).to.equal(5);

const transcriptInfo = trackObj.transcriptInfo["ENST00000270722.9_chr1_3069211_3438621"];
expect(transcriptInfo.transcriptName).to.equal("PRDM16-201");
expect(transcriptInfo.txStart).to.equal(3069210);
expect(transcriptInfo.displayOrder).to.equal(4);

// Check position info
const posInfo = trackObj.transcriptPositionInfo[3][0]
expect(posInfo[1]).to.equal(3434342);

expect(trackObj.areTranscriptsHidden).to.equal(false);
beforeAll((done) => {
[div, hgc] = mountHGComponent(div, hgc, viewConf, done);
});

// Check vertical positioning of exon

// const exonPos1 = tile.allExonsForSVG[4].rect[1];
// const exonPos2 = tile.allExonsForSVG[4].rect[5];
// expect(exonPos1).to.equal(41);
// expect(exonPos2).to.equal(47);
it("tests that basic infos are correct", (done) => {

done();
const trackObj = getTrackObjectFromHGC(
hgc.instance(),
viewConf.views[0].uid,
viewConf.views[0].tracks.top[0].uid
);

// setTimeout(() => {
//const tile = trackObj.visibleAndFetchedTiles()[2];

// }, 1000);
expect(trackObj.trackHeight).to.equal(106);
expect(Object.keys(trackObj.transcriptInfo).length).to.equal(5);

const transcriptInfo = trackObj.transcriptInfo["ENST00000270722.10_chr1_3069203_3438621"];
expect(transcriptInfo.transcriptName).to.equal("PRDM16-201");
expect(transcriptInfo.txStart).to.equal(3069202);
expect(transcriptInfo.displayOrder).to.equal(3);


});
// Check position info
const posInfo = trackObj.transcriptPositionInfo[3][0]
expect(posInfo[1]).to.equal(3438621);
expect(trackObj.areTranscriptsHidden).to.equal(false);
done();

afterAll(() => {
removeHGComponent(div);
});
});

afterAll(async () => {
await fetchMockHelper.storeDataAndResetFetchMock();
afterAll(() => {
removeHGComponent(div);
});
});


Loading

0 comments on commit f26b9df

Please sign in to comment.