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

NMR #214

Merged
merged 88 commits into from
May 21, 2024
Merged

NMR #214

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
9615250
Minor refactor
p3rcypj May 17, 2023
83e3be7
Add NMR block
p3rcypj May 17, 2023
0c160b8
Add tooltip
p3rcypj May 17, 2023
69cf722
Tooltip table
p3rcypj May 18, 2023
4eb13b2
Merge branch 'development' into feature/nmr
p3rcypj May 23, 2023
c53a4fb
NMR codec
p3rcypj May 23, 2023
76bacbd
Domain types and view
p3rcypj Jun 12, 2023
f8dd2ce
NMR: work in progress
p3rcypj Jul 9, 2023
e7f6944
Merge branch 'development' into feature/nmr
p3rcypj Oct 20, 2023
826b1d2
NMR types changes, tracks, block defs
p3rcypj Oct 25, 2023
1a2798b
Block to only dialog
p3rcypj Oct 25, 2023
2d72e5c
Dialog open action from protvista
p3rcypj Oct 25, 2023
5dc124e
Show NMR badge on covid19 table
p3rcypj Oct 25, 2023
b5957a6
Repo
p3rcypj Oct 26, 2023
96107c1
Types
p3rcypj Oct 26, 2023
78ea1a1
Badge, dialog, entity cell
p3rcypj Oct 26, 2023
f3bc5e2
NMR Pagination
p3rcypj Nov 23, 2023
4ec842e
Loading rows, and loading on export
p3rcypj Nov 23, 2023
4744bfc
Add sequential on Future
p3rcypj Nov 23, 2023
fdecc95
Add getAll
p3rcypj Nov 23, 2023
e989d6a
Save NMR, loader, cancel
p3rcypj Nov 23, 2023
4fd358c
Page + 1
p3rcypj Nov 26, 2023
127651a
Loaders NMR and IDR
p3rcypj Nov 26, 2023
ea2ee2c
isDev
p3rcypj Nov 26, 2023
f6a68e3
Filter NMR
p3rcypj Nov 26, 2023
b93db87
Clone NMR on viewer
p3rcypj Nov 28, 2023
b2cc874
Refactor
p3rcypj Nov 28, 2023
a7890f1
NSPTarget to NMRTarget
p3rcypj Nov 28, 2023
236e99a
NMRScreening
p3rcypj Nov 28, 2023
35f7d7d
i18n
p3rcypj Nov 28, 2023
873e33a
Nullable
p3rcypj Nov 28, 2023
7e5a556
Domain entities refactor
p3rcypj Nov 28, 2023
a935d4f
Encapsulate uniprotId, start, end
p3rcypj Nov 28, 2023
abe64d4
NMRPagination viewer
p3rcypj Nov 28, 2023
7cbdb34
Encapsulate uniprotId, start, end in viewer
p3rcypj Nov 28, 2023
2f6e933
Small refactor
p3rcypj Nov 29, 2023
26c7b80
i18n-scanner error
p3rcypj Dec 4, 2023
fdbf1d4
i18n
p3rcypj Dec 4, 2023
3e99c4e
NMRFragmentTarget
p3rcypj Dec 5, 2023
be162a1
NMR Target
p3rcypj Dec 5, 2023
2a8731c
Merge pull request #97 from EyeSeeTea/development
adrianq Jan 8, 2024
362914c
Merge pull request #100 from EyeSeeTea/development
adrianq Jan 8, 2024
c124c83
Merge branch 'development' into feature/nmr
p3rcypj Feb 7, 2024
6f964e9
Merge pull request #103 from EyeSeeTea/development
adrianq Feb 12, 2024
3932e07
Merge branch 'feature/data-updates' into develop
Feb 13, 2024
9309405
Merge remote-tracking branch 'origin/master' into develop
Feb 13, 2024
55541bd
Weekly data update
Feb 13, 2024
9a8a8ec
Weekly data update
Feb 13, 2024
86f2438
Merge branch 'development' into feature/nmr
p3rcypj Feb 14, 2024
52fa4dc
Fix errors with merge
p3rcypj Feb 14, 2024
c0e39fd
Merge branch 'feature/weekly-data-updates' of https://github.com/3dbi…
p3rcypj Feb 14, 2024
1445cac
Update NMR to be target string
p3rcypj Feb 15, 2024
ab87627
protvista version beta
p3rcypj Feb 21, 2024
b1ace21
i18n
p3rcypj Feb 21, 2024
8827ffb
Protvista versions
p3rcypj Feb 21, 2024
e635c91
yarn lock
p3rcypj Feb 21, 2024
3432257
Update github actions with versions check
p3rcypj Feb 22, 2024
83627d1
Merge branch 'development' into feature/nmr
p3rcypj Feb 22, 2024
19333fc
Fix workflow
p3rcypj Feb 22, 2024
02d08de
Typo
p3rcypj Feb 22, 2024
19c6161
Change NMR filter name
p3rcypj Mar 5, 2024
359d403
Entity, UseCase, Repository
p3rcypj Apr 15, 2024
14c27ac
API Request
p3rcypj Apr 15, 2024
a6e3fb0
CheckboxFilter descriptions by API
p3rcypj Apr 15, 2024
4814ef0
Sources on Badges from API
p3rcypj Apr 15, 2024
9a497ed
Add nmr source
p3rcypj Apr 15, 2024
5722a73
Change track, subtrack and color for NMR
p3rcypj Apr 15, 2024
5af0d80
Get NMR Source for viewer by API
p3rcypj Apr 15, 2024
e17faa6
NMR Dialog source content
p3rcypj Apr 15, 2024
5cb617a
NMR tooltip
p3rcypj Apr 15, 2024
f400b87
Repositories rename and move
p3rcypj Apr 16, 2024
f978c8e
i18n
p3rcypj Apr 16, 2024
9c2d3d2
EOF, and array reduce prevent intialValue
p3rcypj Apr 24, 2024
a286ce8
Array keyof
p3rcypj Apr 24, 2024
7cfb44e
Separate component export button
p3rcypj Apr 24, 2024
794d6e3
Dont provocate side effects before run
p3rcypj Apr 24, 2024
2567802
Not need of useMemo
p3rcypj Apr 24, 2024
9adea12
Descriptive name
p3rcypj Apr 24, 2024
3b48dc2
No need for type
p3rcypj Apr 24, 2024
c7c0152
Array reduce
p3rcypj Apr 24, 2024
4ce213c
Maybe instead of optional
p3rcypj Apr 24, 2024
8df2142
Move to useHook
p3rcypj Apr 24, 2024
d0963cf
Make Items a component, make smiles formula and pubchemId as mandatory
p3rcypj Apr 24, 2024
ae4860a
No need to cast
p3rcypj Apr 24, 2024
84b45d7
makeStyles
p3rcypj Apr 24, 2024
46e040a
Merge branch 'feature/api-structural-hub' into feature/nmr
p3rcypj May 6, 2024
5501743
Merge with api-structural-hub
p3rcypj May 6, 2024
c45cfb0
NMR as an Array
p3rcypj May 6, 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
62 changes: 62 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,73 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: '16.14.0'
- name: Check versions
run: |
main_version=$(grep -E '^# 3DBIONOTES-WS v[0-9.]+' README.md | sed -E 's/^# 3DBIONOTES-WS v([0-9.]+)$/\1/')
viewer_protvista_version=$(cat app/views/webserver/viewer.html.haml | grep -Eo 'protvista-pdb-[0-9.]+-est-[0-9]+(-beta.[0-9]+){0,1}' | awk '{print $1}')
viewer_pdbe_molstar_version=$(cat app/views/webserver/viewer.html.haml | grep -Eo 'pdbe-molstar-plugin-[0-9.]+-est-[0-9]+(-beta.[0-9]+){0,1}' | awk '{print $1}')
cd app/assets/javascripts/covid19
bio_covid19_version=$(cat package.json | jq -r '.version')
cd ../3dbio_viewer
bio_viewer_version=$(cat package.json | jq -r '.version')
protvista_version=$(cat package.json | jq -r '.dependencies["@3dbionotes/protvista-pdb"]')
pdbe_molstar_version=$(cat package.json | jq -r '.dependencies["@3dbionotes/pdbe-molstar"]')
index_protvista_version=$(cat public/index.html | grep -Eo 'protvista-pdb-[0-9.]+-est-[0-9]+(-beta.[0-9]+){0,1}' | awk '{print $1}')
index_pdbe_molstar_version=$(cat public/index.html | grep -Eo 'pdbe-molstar-plugin-[0-9.]+-est-[0-9]+(-beta.[0-9]+){0,1}' | awk '{print $1}')
if [ "$bio_viewer_version" != "$bio_covid19_version" ] ||
[ "$main_version" != "$bio_covid19_version" ]; then
echo "3dbio_viewer version doesn't match with covid19 version"
echo "3dbio_viewer: $bio_viewer_version"
echo "covid19: $bio_covid19_version"
echo "README.md version: $main_version"
exit 1
fi

if [ "$viewer_protvista_version" != "$index_protvista_version" ] ||
[ "$viewer_pdbe_molstar_version" != "$index_pdbe_molstar_version" ] ||
[ "$(echo "$index_protvista_version" | sed 's/protvista-pdb-//')" != "$protvista_version" ] ||
[ "$(echo "$index_pdbe_molstar_version" | sed 's/pdbe-molstar-plugin-//')" != "$pdbe_molstar_version" ]; then
echo "Versions don't match:"
echo "Viewer and index protvista: $viewer_protvista_version, $index_protvista_version"
echo "Viewer and index pdbe-molstar: $viewer_pdbe_molstar_version, $index_pdbe_molstar_version"
echo "3dbio_viewer dependency and index protvista: $protvista_version, $(echo "$index_protvista_version" | sed 's/protvista-pdb-//')"
echo "3dbio_viewer dependency and index pdbe-molstar: $pdbe_molstar_version, $(echo "$index_pdbe_molstar_version" | sed 's/pdbe-molstar-plugin-//'), "
exit 1
fi

echo "3dbio_viewer versions match"
echo "README.md version: $main_version"
echo "3DBIONOTES version: $bio_viewer_version"
echo "protvista-pdb version: $protvista_version"
echo "pdbe-molstar version: $pdbe_molstar_version"
- name: Install and build (3dbio_viewer)
run: |
cd app/assets/javascripts/3dbio_viewer
yarn install
yarn build
- name: Check build dependency versions (3dbioviewer)
run: |
cd app/assets/javascripts/3dbio_viewer
index_protvista_version=$(cat public/index.html | grep -Eo 'protvista-pdb-[0-9.]+-est-[0-9]+(-beta.[0-9]+){0,1}' | awk '{print $1}')
index_pdbe_molstar_version=$(cat public/index.html | grep -Eo 'pdbe-molstar-plugin-[0-9.]+-est-[0-9]+(-beta.[0-9]+){0,1}' | awk '{print $1}')
build_pdbe_molstar_file="build/pdbe-molstar/$index_pdbe_molstar_version.js"
if [ -f "$build_pdbe_molstar_file" ]; then
echo "Build file $build_pdbe_molstar_file exists."
else
echo "Build file $build_pdbe_molstar_file does not exist."
exit 1
fi

build_protvista_file="build/protvista-pdb/$index_protvista_version.js"
if [ -f "$build_protvista_file" ]; then
echo "Build file $build_protvista_file exists."
else
echo "Build file $build_protvista_file does not exist."
exit 1
fi
- name: Run tests (3dbio_viewer)
run: |
cd app/assets/javascripts/3dbio_viewer
yarn test:nowatch
- name: Install and build (covid19)
run: |
Expand Down
7 changes: 5 additions & 2 deletions app/assets/javascripts/3dbio_viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"@3dbionotes/pdbe-molstar": "3.1.0-est-2",
"@3dbionotes/protvista-pdb": "2.0.1-est-2",
"@3dbionotes/protvista-pdb": "2.0.1-est-2-beta.1",
"@material-ui/core": "^4.11.2",
"@material-ui/data-grid": "4.0.0-alpha.35",
"@material-ui/icons": "^4.11.2",
Expand All @@ -14,6 +14,7 @@
"classnames": "^2.2.6",
"d2-ui-components": "^2.4.0",
"data-loader": "^3.0.0",
"file-saver": "^2.0.5",
"fluture": "^13.0.1",
"jszip": "^3.10.1",
"purify-ts": "^1.1.0",
Expand Down Expand Up @@ -42,8 +43,10 @@
"@types/axios": "^0.14.0",
"@types/classnames": "^2.2.11",
"@types/express": "^4.17.11",
"@types/file-saver": "^2.0.7",
"@types/hookrouter": "^2.2.5",
"@types/jest": "^26.0.15",
"@types/mime-types": "^2.1.4",
"@types/node": "^12.0.0",
"@types/react": "17.0.2",
"@types/react-dom": "17.0.2",
Expand Down Expand Up @@ -114,4 +117,4 @@
"\\.(jpg|jpeg|png|svg)$": "<rootDir>/config/fileMock.js"
}
}
}
}
2 changes: 1 addition & 1 deletion app/assets/javascripts/3dbio_viewer/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
type="text/css"
/>

<script src="/protvista-pdb/protvista-pdb-2.0.1-est-2.js"></script>
<script src="/protvista-pdb/protvista-pdb-2.0.1-est-2-beta.1.js"></script>
<script src="/pdbe-molstar/pdbe-molstar-plugin-3.1.0-est-2.js"></script>

<title>3dbio Viewer</title>
Expand Down
10 changes: 10 additions & 0 deletions app/assets/javascripts/3dbio_viewer/src/compositionRoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ import { BionotesOrganismRepository } from "./data/repositories/BionotesOrganism
import { ExportAllAnnotationsUseCase } from "./domain/usecases/ExportAllAnnotationsUseCase";
import { AnnotationsExportApiRepository } from "./data/repositories/AnnotationsExportApiRepository";
import { ExportAnnotationsUseCase } from "./domain/usecases/ExportAnnotationsUseCase";
import { GetPartialNMRTargetUseCase } from "./domain/usecases/GetPartialNMRTargetUseCase";
import { SaveNMRTargetUseCase } from "./domain/usecases/SaveNMRTargetUseCase";
import { NMRApiRepository } from "./data/repositories/NMRApiRepository";
import { GetSourcesUseCase } from "./domain/usecases/GetSourcesUseCase";
import { SourcesApiRepository } from "./data/repositories/SourcesApiRepository";

export function getCompositionRoot() {
const pdbRepository = new ApiPdbRepository();
Expand All @@ -33,8 +38,11 @@ export function getCompositionRoot() {
const ontologyRepository = new BionotesOntologyRepository();
const organismRepository = new BionotesOrganismRepository();
const annotationsExportRepository = new AnnotationsExportApiRepository();
const nmrRepository = new NMRApiRepository();
const sourcesRepository = new SourcesApiRepository();

return {
getSources: new GetSourcesUseCase(sourcesRepository),
getPdb: new GetPdbUseCase(pdbRepository, ontologyRepository, organismRepository),
getPdbInfo: new GetPdbInfoUseCase(pdbInfoRepository),
searchDbModels: new SearchDbModelsUseCase(dbModelRepository),
Expand All @@ -50,6 +58,8 @@ export function getCompositionRoot() {
exportAnnotations: new ExportAnnotationsUseCase(annotationsExportRepository),
buildNetwork: new BuildNetworkUseCase(networkRepository),
getNetwork: new GetNetworkUseCase(networkRepository),
getPartialNMR: new GetPartialNMRTargetUseCase(nmrRepository),
saveNMR: new SaveNMRTargetUseCase(nmrRepository),
};
}

Expand Down
79 changes: 79 additions & 0 deletions app/assets/javascripts/3dbio_viewer/src/data/NMRScreening.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import _ from "lodash";
import { Codec, GetType, nullType, number, oneOf, string } from "purify-ts";
import { NMRFragmentTarget } from "../domain/entities/Protein";
import { commonLigand, pdbLigandC } from "./PdbLigands";

const featureTypeCodec = Codec.interface({
dataSource: string,
name: string, // binding | not binding
p3rcypj marked this conversation as resolved.
Show resolved Hide resolved
description: string,
externalLink: string,
});

export const nmrFragmentCodec = Codec.interface({
name: string,
description: string,
externalLink: string,
pdbentry: nullType,
uniprotentry: string,
ligandentity: oneOf([Codec.interface(commonLigand), pdbLigandC]),
details: Codec.interface({
type: string, // binding | notbinding
entity: string, // NMR target
}),
start: number,
end: number,
featureType: featureTypeCodec,
});

export type NMRScreeningFragment = GetType<typeof nmrFragmentCodec>;

export function getNMR(nmrScreenings: NMRScreeningFragment[]): NMRFragmentTarget[] {
const fragments = nmrScreenings.map(nmr => ({
...nmr,
binding: !nmr.details.type.toLowerCase().includes("not"),
}));

const targets = _(fragments)
.groupBy(i => i.details.entity)
.toPairs()
.value();

return targets.flatMap(([name, targetFragments]) => {
const fragments = targetFragments.map(
({ name, description, externalLink, binding, ligandentity, start, end }) => ({
name,
description,
externalLink,
binding,
ligand: {
...ligandentity,
inChI: ligandentity.IUPACInChIkey,
smiles: ligandentity.canonicalSMILES,
pubchemId: ligandentity.pubChemCompoundId,
formula: ligandentity.formula,
imageDataResource: undefined,
},
start,
end,
})
);

const start = _.first(fragments.map(({ start }) => start));
const end = _.first(fragments.map(({ end }) => end));
const uniprotId = _.first(targetFragments.map(({ uniprotentry }) => uniprotentry));
if (!start || !end || !uniprotId) return [];

return [
{
name,
uniprotId,
fragments,
bindingCount: fragments.filter(({ binding }) => binding).length,
notBindingCount: fragments.filter(({ binding }) => !binding).length,
start,
end,
},
];
});
}
11 changes: 11 additions & 0 deletions app/assets/javascripts/3dbio_viewer/src/data/NMRTarget.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import _ from "lodash";
import { Codec, GetType, number, string } from "purify-ts";

export const nmrTargetCodec = Codec.interface({
entity: string,
start: number,
end: number,
uniprot_acc: string,
});

export type NMRTarget = GetType<typeof nmrTargetCodec>;
10 changes: 3 additions & 7 deletions app/assets/javascripts/3dbio_viewer/src/data/Ontologies.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { array, Codec, GetType, nullType, number, oneOf, string } from "purify-ts";

function maybeNull<Data>(type: Codec<Data>) {
return oneOf([type, nullType]);
}
import { array, Codec, GetType, nullable, number, string } from "purify-ts";

function getOntologiesResponse<T>(codec: Codec<T>) {
return Codec.interface({
count: number,
next: maybeNull(string),
previous: maybeNull(string),
next: nullable(string),
previous: nullable(string),
results: codec,
});
}
Expand Down
10 changes: 3 additions & 7 deletions app/assets/javascripts/3dbio_viewer/src/data/Organisms.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import _ from "lodash";
import { array, Codec, GetType, nullType, number, oneOf, string } from "purify-ts";
import { array, Codec, GetType, nullable, number, string } from "purify-ts";
import { Organism } from "../domain/entities/LigandImageData";

function maybeNull<Data>(type: Codec<Data>) {
return oneOf([type, nullType]);
}

function getOrganismsResponse<T>(codec: Codec<T>) {
return Codec.interface({
count: number,
next: maybeNull(string),
previous: maybeNull(string),
next: nullable(string),
p3rcypj marked this conversation as resolved.
Show resolved Hide resolved
previous: nullable(string),
results: codec,
});
}
Expand Down
13 changes: 10 additions & 3 deletions app/assets/javascripts/3dbio_viewer/src/data/PdbLigands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,22 @@ const imageDataC = Codec.interface({
assays: array(assayC),
});

export const pdbLigandC = Codec.interface({
export const commonLigand = {
IUPACInChIkey: string,
dbId: string,
pubChemCompoundId: string,
name: string,
formula: string,
formula_weight: number,
imageLink: string,
externalLink: string,
pubChemCompoundId: string,
IUPACInChI: string,
isomericSMILES: string,
canonicalSMILES: string,
};

export const pdbLigandC = Codec.interface({
...commonLigand,
dbId: string,
imageData: optional(array(imageDataC)), //it shouldn't be an array...
});

Expand Down Expand Up @@ -256,6 +260,9 @@ export function getPdbLigand(pdbLigandOptions: PdbLigandsOptions): PdbLigand {
name: ligand.name,
inChI: ligand.IUPACInChIkey,
imageDataResource: idr,
smiles: ligand.canonicalSMILES,
formula: ligand.formula,
pubchemId: ligand.pubChemCompoundId,
};
}

Expand Down
21 changes: 21 additions & 0 deletions app/assets/javascripts/3dbio_viewer/src/data/codec-utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Codec, array, nullable, number, optional, string } from "purify-ts";

export function paginationCodec<Data>(type: Codec<Data>): Codec<Pagination<Data>> {
return Codec.interface({
count: number,
next: optional(nullable(string)),
previous: optional(nullable(string)),
results: array(type),
});
}

export function getResults<Data>(pagination?: Pagination<Data>) {
return pagination?.results ?? [];
}

export type Pagination<K> = {
count: number;
next: string | null | undefined;
previous: string | null | undefined;
results: K[];
};
Loading
Loading