Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port over adapters #73

Merged
merged 32 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f36608e
Initial move of adapters.
dlrice Nov 5, 2024
a3338aa
Slight restructure.
dlrice Nov 5, 2024
274bfbe
More restructuring.
dlrice Nov 5, 2024
d5a25fa
Move lots of things around.
dlrice Nov 5, 2024
54990f2
Drop protvista-X and transormDataX prefixes; move types around.
dlrice Nov 5, 2024
0e4b23b
Update .gitignore for yalc.
dlrice Nov 5, 2024
3a60d29
Remove packages.
dlrice Nov 5, 2024
a998a47
Remove types already in nightingale.
dlrice Nov 5, 2024
d3f50e0
Fix proteomics-ptm-adapter import.
dlrice Nov 5, 2024
2ef7898
Fix type imports for variants.
dlrice Nov 5, 2024
e26c053
Type fixes.
dlrice Nov 5, 2024
7740f0c
Update test.
dlrice Nov 5, 2024
8b39038
Move tests around and save as ts.
dlrice Nov 5, 2024
5aebdde
Fix filter-config types.
dlrice Nov 6, 2024
cc9d03b
Update snapshot.
dlrice Nov 6, 2024
51d651a
Remove unused code.
dlrice Nov 6, 2024
4985ca7
Remove yalc references.
dlrice Nov 6, 2024
36ae063
Export tooltips from index.
dlrice Nov 6, 2024
a8ebd5b
Tweak index.html title, remove unused d3 v4 load.
dlrice Nov 6, 2024
cda1741
Have lit register the web components.
dlrice Nov 6, 2024
ae9253e
Remove gitHead from package.json.
dlrice Nov 6, 2024
0081a39
Still need loadComponent though for the individual tracks.
dlrice Nov 6, 2024
2ddcf7b
Tidy up debugging statements.
dlrice Nov 6, 2024
11a0992
Remove unused types and move a few others around.
dlrice Nov 6, 2024
a124e7e
Remove link-all and add-all package.json scripts as only yalc is used.
dlrice Nov 7, 2024
7bb8e17
Remove unused DownloadConfig.
dlrice Nov 8, 2024
fe6d6f9
Pin color-hash version.
dlrice Nov 8, 2024
7908abe
Remove data-loader from protvista-uniprot-structure.
dlrice Nov 8, 2024
0651215
Create fetchAll util fn and use to replace data-loader.
dlrice Nov 8, 2024
3412e06
Remove data-loader.
dlrice Nov 8, 2024
b2d8f9d
Remove debugging statement.
dlrice Nov 8, 2024
c3c779d
Remove D3 and file-saver; remove D3 peerDep; pin dep versions.
dlrice Nov 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
{
"presets": [
[
"@babel/preset-env", {
"@babel/preset-env",
{
"useBuiltIns": "usage",
"corejs": "3"
"corejs": "3"
}
],
"@babel/preset-typescript"
],
"plugins": [
["@babel/plugin-transform-runtime", {
[
"@babel/plugin-transform-runtime",
{
"corejs": "3"
}]
}
],
["@babel/plugin-proposal-decorators", { "version": "2023-11" }]
]
}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
build/
dist/
node_modules/
*.log
*.log
.yalc/
yalc.lock
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
"build:es": "tsc",
"build": "webpack --mode=production && yarn build:es",
"watch": "webpack --mode=development -w",
"link-all": "yarn link protvista-interpro-adapter protvista-feature-adapter protvista-interpro-track nightingale-filter nightingale-manager nightingale-navigation protvista-proteomics-adapter nightingale-sequence protvista-structure-adapter nightingale-track nightingale-variation protvista-variation-adapter nightingale-linegraph-track protvista-datatable nightingale-structure data-loader",
"add-all": "yarn add protvista-feature-adapter nightingale-filter nightingale-manager nightingale-navigation protvista-proteomics-adapter nightingale-sequence protvista-structure-adapter nightingale-track nightingale-variation protvista-variation-adapter nightingale-linegraph-track protvista-datatable nightingale-structure data-loader",
"start": "webpack serve --mode=development",
"test:lint": "eslint src --ext .ts ",
"test:types": "tsc",
Expand All @@ -36,26 +34,24 @@
"@nightingale-elements/nightingale-structure": "5.2.0",
"@nightingale-elements/nightingale-track": "5.2.0",
"@nightingale-elements/nightingale-variation": "5.2.0",
"color-hash": "^2.0.2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just using the fixed version like the rest of them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pinned all dep versions but not devDeps as I encountered webpack issues so left as is there.

"core-js": "^3.13.0",
"data-loader": "^2.9.1",
"file-saver": "^2.0.2",
"lit": "3.1.3",
"protvista-datatable": "3.8.22",
"protvista-feature-adapter": "3.8.22",
"protvista-interpro-adapter": "3.8.22",
"protvista-proteomics-adapter": "3.8.22",
"protvista-structure-adapter": "3.8.22",
"protvista-variation-adapter": "3.8.22",
"timing-functions": "^2.0.1",
"url-join": "^4.0.1"
},
"devDependencies": {
"@babel/core": "^7.14.3",
"@babel/plugin-proposal-decorators": "^7.25.9",
"@babel/plugin-transform-runtime": "^7.14.3",
"@babel/preset-env": "^7.14.2",
"@babel/preset-typescript": "^7.13.0",
"@babel/runtime-corejs3": "^7.14.0",
"@types/file-saver": "^2.0.2",
"@types/jest": "^29.5.14",
"@types/url-join": "^4.0.0",
"@typescript-eslint/eslint-plugin": "4.26.1",
"@typescript-eslint/parser": "4.26.1",
Expand All @@ -79,5 +75,11 @@
"peerDependencies": {
"d3": "5.X"
},
"gitHead": "5a756316482fa31d085602d46438861fb45e5178"
"jest": {
"testRegex": "(/__tests__/.*|(\\.|/))spec\\.ts$",
"testPathIgnorePatterns": [
"/__mocks__/",
"<rootDir>/dist/"
]
}
}
3 changes: 1 addition & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<title>UniProt - ProtVista</title>
<title>protvista-uniprot</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

Expand Down Expand Up @@ -46,7 +46,6 @@
<!-- <protvista-uniprot accession="P27958"></protvista-uniprot> -->
</div>

<script src="https://d3js.org/d3.v4.min.js" charset="utf-8" defer></script>
<script src="./protvista-uniprot.js" charset="utf-8" defer></script>
</body>
</html>
22 changes: 15 additions & 7 deletions test/filterConfig.spec.js → src/__spec__/filter-config.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { colorConfig, getFilteredVariants } from '../src/filterConfig';
import {
colorConfig,
getFilteredVariants,
VariantsForFilter,
} from '../filter-config';

const transformedVariantPositions = [
{
Expand All @@ -7,7 +11,7 @@ const transformedVariantPositions = [
accession: 'A',
begin: 1,
end: 1,
start: '1',
start: 1,
tooltipContent: '',
sourceType: 'source',
variant: 'V',
Expand All @@ -24,12 +28,13 @@ const transformedVariantPositions = [
},
],
xrefs: [],
hasPredictions: false,
},
{
accession: 'B',
begin: 1,
end: 1,
start: '1',
start: 1,
tooltipContent: '',
sourceType: 'source',
variant: 'D',
Expand All @@ -40,6 +45,7 @@ const transformedVariantPositions = [
alternativeSequence: 'D',
consequenceType: 'disease',
xrefs: [],
hasPredictions: false,
},
],
},
Expand All @@ -49,7 +55,7 @@ const transformedVariantPositions = [
accession: 'C',
begin: 2,
end: 2,
start: '2',
start: 2,
tooltipContent: '',
sourceType: 'source',
variant: 'V',
Expand All @@ -60,6 +66,7 @@ const transformedVariantPositions = [
alternativeSequence: 'V',
consequenceType: 'disease',
xrefs: [],
hasPredictions: false,
},
],
},
Expand All @@ -69,7 +76,7 @@ const transformedVariantPositions = [
accession: 'D',
begin: 3,
end: 3,
start: '3',
start: 3,
tooltipContent: '',
sourceType: 'source',
variant: 'V',
Expand All @@ -81,6 +88,7 @@ const transformedVariantPositions = [
consequenceType: 'disease',
siftScore: 0.5,
xrefs: [],
hasPredictions: false,
},
],
},
Expand All @@ -89,7 +97,7 @@ const transformedVariantPositions = [
describe('Variation filter config', () => {
test('it should filter according to the callback function', () => {
const filteredVariants = getFilteredVariants(
transformedVariantPositions,
transformedVariantPositions as VariantsForFilter,
(variant) => variant.accession === 'A'
);
expect(filteredVariants).toEqual([
Expand Down Expand Up @@ -121,7 +129,7 @@ describe('Variation filter config', () => {

test('it should get the right colour for other', () => {
const thirdVariant = colorConfig(
transformedVariantPositions[1].variants[0]
transformedVariantPositions?.[1].variants[0]
);
expect(thirdVariant).toEqual('#009e73');
});
Expand Down
76 changes: 76 additions & 0 deletions src/adapters/__tests__/__mocks__/uniprotkb-entry-data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
const data = {
accession: 'P01234',
id: 'A4_HUMAN_mocked',
dbReferences: [
{
type: 'UniGene',
id: 'Hs.434980',
},
{
type: 'PDB',
id: '1AAP',
properties: {
method: 'X-ray',
resolution: '1.50 A',
},
},
{
type: 'PDB',
id: '1AMB',
properties: {
method: 'NMR',
chains: 'A=672-699',
},
},
{
type: 'PDB',
id: '1AMC',
properties: {
method: 'NMR',
chains: 'A=672-699',
},
},
{
type: 'PDB',
id: '1AML',
properties: {
method: 'NMR',
chains: 'A=672-711',
},
},
{
type: 'PDB',
id: '1BA4',
properties: {
method: 'NMR',
chains: 'A=672-711',
},
},
{
type: 'PROSITE',
id: 'PS00280',
properties: {
'match status': '1',
'entry name': 'BPTI_KUNITZ_1',
},
},
{
type: 'PROSITE',
id: 'PS50279',
properties: {
'match status': '1',
'entry name': 'BPTI_KUNITZ_2',
},
},
],
sequence: {
version: 3,
length: 770,
mass: 86943,
modified: '1991-11-01',
sequence:
'MLPGLALLLLAAWTARALEVPTDGNAGLLAEPQIAMFCGRLNMHMNVQNGKWDSDPSGTKTCIDTKEGILQYCQEVYPELQITNVVEANQPVTIQNWCKRGRKQCKTHPHFVIPYRCLVGEFVSDALLVPDKCKFLHQERMDVCETHLHWHTVAKETCSEKSTNLHDYGMLLPCGIDKFRGVEFVCCPLAEESDNVDSADAEEDDSDVWWGGADTDYADGSEDKVVEVAEEEEVAEVEEEEADDDEDDEDGDEVEEEAEEPYEEATERTTSIATTTTTTTESVEEVVREVCSEQAETGPCRAMISRWYFDVTEGKCAPFFYGGCGGNRNNFDTEEYCMAVCGSAMSQSLLKTTQEPLARDPVKLPTTAASTPDAVDKYLETPGDENEHAHFQKAKERLEAKHRERMSQVMREWEEAERQAKNLPKADKKAVIQHFQEKVESLEQEAANERQQLVETHMARVEAMLNDRRRLALENYITALQAVPPRPRHVFNMLKKYVRAEQKDRQHTLKHFEHVRMVDPKKAAQIRSQVMTHLRVIYERMNQSLSLLYNVPAVAEEIQDEVDELLQKEQNYSDDVLANMISEPRISYGNDALMPSLTETKTTVELLPVNGEFSLDDLQPWHSFGADSVPANTENEVEPVDARPAADRGLTTRPGSGLTNIKTEEISEVKMDAEFRHDSGYEVHHQKLVFFAEDVGSNKGAIIGLMVGGVVIATVIVITLVMLKKKQYTSIHHGVVEVDAAVTPEERHLSKMQQNGYENPTYKFFEQMQN',
},
};

export default data;
Loading