@judah-silva/rnacanvas 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +14 -9
- package/dist/index.mjs +14 -9
- package/judah-silva-rnacanvas-0.0.6.tgz +0 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -358,7 +358,7 @@ type MotifMesh = Record<string, any>;
|
|
|
358
358
|
* @returns {Promise<Motif>}
|
|
359
359
|
* @async
|
|
360
360
|
*/
|
|
361
|
-
declare function getMotif(motifName: string, motifMesh: MotifMesh, motifColorHex?: string): Promise<Motif>;
|
|
361
|
+
declare function getMotif(motifName: string, motifMesh: MotifMesh, motifColorHex?: string, includeAtoms?: boolean): Promise<Motif>;
|
|
362
362
|
|
|
363
363
|
/**
|
|
364
364
|
* Copyright (c) 2025 RNA3DS Lab CSUMB.
|
|
@@ -372,7 +372,7 @@ declare function getMotif(motifName: string, motifMesh: MotifMesh, motifColorHex
|
|
|
372
372
|
* @param nucleotideData {number[][]}
|
|
373
373
|
* @returns Object of { vertices: number[][], indices: number[][] }
|
|
374
374
|
*/
|
|
375
|
-
declare function getPoints(nucleotideData: number[][]): {
|
|
375
|
+
declare function getPoints(nucleotideData: number[][], includeAtoms: boolean): {
|
|
376
376
|
vertices: number[][];
|
|
377
377
|
indices: number[][];
|
|
378
378
|
};
|
|
@@ -413,6 +413,7 @@ interface CanvasProps {
|
|
|
413
413
|
rendererBackgroundColor?: string;
|
|
414
414
|
rendererSizeIsWindow?: boolean;
|
|
415
415
|
cameraPositionZ?: number;
|
|
416
|
+
showRMSD?: boolean;
|
|
416
417
|
motifProps: MotifProps[];
|
|
417
418
|
customEventProps?: AnyEventProps[];
|
|
418
419
|
}
|
|
@@ -432,7 +433,7 @@ interface CanvasProps {
|
|
|
432
433
|
* @function Canvas {JSX.Element}
|
|
433
434
|
* @returns {JSX.Element}
|
|
434
435
|
*/
|
|
435
|
-
declare function Canvas({ rendererHeight, rendererWidth, rendererBackgroundColor, rendererSizeIsWindow, cameraPositionZ, motifProps, customEventProps, }: CanvasProps): JSX.Element;
|
|
436
|
+
declare function Canvas({ rendererHeight, rendererWidth, rendererBackgroundColor, rendererSizeIsWindow, cameraPositionZ, showRMSD, motifProps, customEventProps, }: CanvasProps): JSX.Element;
|
|
436
437
|
|
|
437
438
|
/**
|
|
438
439
|
* Copyright (c) 2025 RNA3DS Lab CSUMB.
|
package/dist/index.d.ts
CHANGED
|
@@ -358,7 +358,7 @@ type MotifMesh = Record<string, any>;
|
|
|
358
358
|
* @returns {Promise<Motif>}
|
|
359
359
|
* @async
|
|
360
360
|
*/
|
|
361
|
-
declare function getMotif(motifName: string, motifMesh: MotifMesh, motifColorHex?: string): Promise<Motif>;
|
|
361
|
+
declare function getMotif(motifName: string, motifMesh: MotifMesh, motifColorHex?: string, includeAtoms?: boolean): Promise<Motif>;
|
|
362
362
|
|
|
363
363
|
/**
|
|
364
364
|
* Copyright (c) 2025 RNA3DS Lab CSUMB.
|
|
@@ -372,7 +372,7 @@ declare function getMotif(motifName: string, motifMesh: MotifMesh, motifColorHex
|
|
|
372
372
|
* @param nucleotideData {number[][]}
|
|
373
373
|
* @returns Object of { vertices: number[][], indices: number[][] }
|
|
374
374
|
*/
|
|
375
|
-
declare function getPoints(nucleotideData: number[][]): {
|
|
375
|
+
declare function getPoints(nucleotideData: number[][], includeAtoms: boolean): {
|
|
376
376
|
vertices: number[][];
|
|
377
377
|
indices: number[][];
|
|
378
378
|
};
|
|
@@ -413,6 +413,7 @@ interface CanvasProps {
|
|
|
413
413
|
rendererBackgroundColor?: string;
|
|
414
414
|
rendererSizeIsWindow?: boolean;
|
|
415
415
|
cameraPositionZ?: number;
|
|
416
|
+
showRMSD?: boolean;
|
|
416
417
|
motifProps: MotifProps[];
|
|
417
418
|
customEventProps?: AnyEventProps[];
|
|
418
419
|
}
|
|
@@ -432,7 +433,7 @@ interface CanvasProps {
|
|
|
432
433
|
* @function Canvas {JSX.Element}
|
|
433
434
|
* @returns {JSX.Element}
|
|
434
435
|
*/
|
|
435
|
-
declare function Canvas({ rendererHeight, rendererWidth, rendererBackgroundColor, rendererSizeIsWindow, cameraPositionZ, motifProps, customEventProps, }: CanvasProps): JSX.Element;
|
|
436
|
+
declare function Canvas({ rendererHeight, rendererWidth, rendererBackgroundColor, rendererSizeIsWindow, cameraPositionZ, showRMSD, motifProps, customEventProps, }: CanvasProps): JSX.Element;
|
|
436
437
|
|
|
437
438
|
/**
|
|
438
439
|
* Copyright (c) 2025 RNA3DS Lab CSUMB.
|
package/dist/index.js
CHANGED
|
@@ -838,10 +838,10 @@ async function parseAtomCoords(meshObject) {
|
|
|
838
838
|
}
|
|
839
839
|
|
|
840
840
|
// src/3D/utils/GetPoints.ts
|
|
841
|
-
function getPoints(nucleotideData) {
|
|
841
|
+
function getPoints(nucleotideData, includeAtoms) {
|
|
842
842
|
const vertices = [];
|
|
843
843
|
const indices = [];
|
|
844
|
-
for (let i = 1; i < nucleotideData.length; i += 2) {
|
|
844
|
+
for (let i = includeAtoms ? 1 : 0; i < nucleotideData.length; i += 2) {
|
|
845
845
|
vertices.push(nucleotideData[i]);
|
|
846
846
|
indices.push(nucleotideData[i + 1]);
|
|
847
847
|
}
|
|
@@ -849,10 +849,10 @@ function getPoints(nucleotideData) {
|
|
|
849
849
|
}
|
|
850
850
|
|
|
851
851
|
// src/3D/utils/GetMotif.ts
|
|
852
|
-
async function getMotif(motifName, motifMesh, motifColorHex = "0xcc2900") {
|
|
852
|
+
async function getMotif(motifName, motifMesh, motifColorHex = "0xcc2900", includeAtoms = true) {
|
|
853
853
|
const motif = new Motif(`${motifName}_motif`);
|
|
854
854
|
for (const [key] of Object.entries(motifMesh)) {
|
|
855
|
-
const { vertices, indices } = getPoints(motifMesh[key]);
|
|
855
|
+
const { vertices, indices } = getPoints(motifMesh[key], includeAtoms);
|
|
856
856
|
const residue = new Residue("residue");
|
|
857
857
|
const backboneMesh = new MeshObject(`backbone_${key}`);
|
|
858
858
|
backboneMesh.applyVertexData(vertices[0], indices[0]);
|
|
@@ -865,7 +865,7 @@ async function getMotif(motifName, motifMesh, motifColorHex = "0xcc2900") {
|
|
|
865
865
|
motif.addChild(residue);
|
|
866
866
|
}
|
|
867
867
|
motif.userData.fileName = motifName;
|
|
868
|
-
motif.userData.atomInfo = await parseAtomCoords(motifMesh);
|
|
868
|
+
if (includeAtoms) motif.userData.atomInfo = await parseAtomCoords(motifMesh);
|
|
869
869
|
return motif;
|
|
870
870
|
}
|
|
871
871
|
|
|
@@ -1134,6 +1134,7 @@ function Canvas({
|
|
|
1134
1134
|
rendererBackgroundColor = "#040a20",
|
|
1135
1135
|
rendererSizeIsWindow = false,
|
|
1136
1136
|
cameraPositionZ = 1e3,
|
|
1137
|
+
showRMSD = true,
|
|
1137
1138
|
motifProps,
|
|
1138
1139
|
customEventProps
|
|
1139
1140
|
}) {
|
|
@@ -1244,7 +1245,7 @@ function Canvas({
|
|
|
1244
1245
|
element.rotate(axisVec, angle);
|
|
1245
1246
|
}
|
|
1246
1247
|
});
|
|
1247
|
-
setScoreRMSD(calculateRMSD(Array.from(selectedMotifMeshState.current), motifs));
|
|
1248
|
+
if (showRMSD) setScoreRMSD(calculateRMSD(Array.from(selectedMotifMeshState.current), motifs));
|
|
1248
1249
|
}
|
|
1249
1250
|
}
|
|
1250
1251
|
}
|
|
@@ -1289,7 +1290,7 @@ function Canvas({
|
|
|
1289
1290
|
element.rotate(event.rotationAxis, angle);
|
|
1290
1291
|
}
|
|
1291
1292
|
});
|
|
1292
|
-
setScoreRMSD(calculateRMSD(Array.from(selectedMotifMeshState.current), motifs));
|
|
1293
|
+
if (showRMSD) setScoreRMSD(calculateRMSD(Array.from(selectedMotifMeshState.current), motifs));
|
|
1293
1294
|
}
|
|
1294
1295
|
function onKeyboardTranslate(event) {
|
|
1295
1296
|
if (event.translationDirection.equals(Vec3.Zero)) {
|
|
@@ -1367,7 +1368,7 @@ function Canvas({
|
|
|
1367
1368
|
}
|
|
1368
1369
|
});
|
|
1369
1370
|
updateGlow();
|
|
1370
|
-
setScoreRMSD(calculateRMSD(Array.from(selectedMotifMeshState.current), motifs));
|
|
1371
|
+
if (showRMSD) setScoreRMSD(calculateRMSD(Array.from(selectedMotifMeshState.current), motifs));
|
|
1371
1372
|
}, [selectedMotifIds]);
|
|
1372
1373
|
(0, import_react.useEffect)(() => {
|
|
1373
1374
|
const unsubscribe = CanvasDataManager.subscribe("lockedMotifIds" /* LOCKED_MOTIF_IDS */, () => {
|
|
@@ -1385,23 +1386,27 @@ function Canvas({
|
|
|
1385
1386
|
hardLockedMotifIds = CanvasDataManager.hardLockedMotifIds;
|
|
1386
1387
|
}, [CanvasDataManager.hardLockedMotifIds]);
|
|
1387
1388
|
(0, import_react.useEffect)(() => {
|
|
1389
|
+
if (!showRMSD) return;
|
|
1388
1390
|
const unsubscribe = CanvasDataManager.subscribe("scoreRMSD" /* SCORE_RMSD */, () => {
|
|
1389
1391
|
setScoreRMSD(CanvasDataManager.scoreRMSD);
|
|
1390
1392
|
});
|
|
1391
1393
|
return () => unsubscribe();
|
|
1392
1394
|
}, []);
|
|
1393
1395
|
(0, import_react.useEffect)(() => {
|
|
1396
|
+
if (!showRMSD) return;
|
|
1394
1397
|
if (CanvasDataManager.scoreRMSD !== scoreRMSD) {
|
|
1395
1398
|
CanvasDataManager.setScoreRMSD(scoreRMSD);
|
|
1396
1399
|
}
|
|
1397
1400
|
}, [scoreRMSD]);
|
|
1398
1401
|
(0, import_react.useEffect)(() => {
|
|
1402
|
+
if (!showRMSD) return;
|
|
1399
1403
|
const unsubscribe = CanvasDataManager.subscribe("kabschRMSD" /* KABSCH_RMSD */, () => {
|
|
1400
1404
|
setKabschRMSD(CanvasDataManager.kabschRMSD);
|
|
1401
1405
|
});
|
|
1402
1406
|
return () => unsubscribe();
|
|
1403
1407
|
}, []);
|
|
1404
1408
|
(0, import_react.useEffect)(() => {
|
|
1409
|
+
if (!showRMSD) return;
|
|
1405
1410
|
if (CanvasDataManager.kabschRMSD !== kabschRMSD) {
|
|
1406
1411
|
CanvasDataManager.setKabschRMSD(kabschRMSD);
|
|
1407
1412
|
} else if (CanvasDataManager.kabschRMSD.length !== motifs.length) {
|
|
@@ -1426,7 +1431,7 @@ function Canvas({
|
|
|
1426
1431
|
);
|
|
1427
1432
|
}
|
|
1428
1433
|
if (motifs.length > 0) {
|
|
1429
|
-
setKabschRMSD(calculateAllKabschRMSD(motifs));
|
|
1434
|
+
if (showRMSD) setKabschRMSD(calculateAllKabschRMSD(motifs));
|
|
1430
1435
|
if (scene.current.children.size !== motifs.length) {
|
|
1431
1436
|
const positions = calculatePositions(motifs.length);
|
|
1432
1437
|
motifs.forEach((motifMesh, index) => {
|
package/dist/index.mjs
CHANGED
|
@@ -781,10 +781,10 @@ async function parseAtomCoords(meshObject) {
|
|
|
781
781
|
}
|
|
782
782
|
|
|
783
783
|
// src/3D/utils/GetPoints.ts
|
|
784
|
-
function getPoints(nucleotideData) {
|
|
784
|
+
function getPoints(nucleotideData, includeAtoms) {
|
|
785
785
|
const vertices = [];
|
|
786
786
|
const indices = [];
|
|
787
|
-
for (let i = 1; i < nucleotideData.length; i += 2) {
|
|
787
|
+
for (let i = includeAtoms ? 1 : 0; i < nucleotideData.length; i += 2) {
|
|
788
788
|
vertices.push(nucleotideData[i]);
|
|
789
789
|
indices.push(nucleotideData[i + 1]);
|
|
790
790
|
}
|
|
@@ -792,10 +792,10 @@ function getPoints(nucleotideData) {
|
|
|
792
792
|
}
|
|
793
793
|
|
|
794
794
|
// src/3D/utils/GetMotif.ts
|
|
795
|
-
async function getMotif(motifName, motifMesh, motifColorHex = "0xcc2900") {
|
|
795
|
+
async function getMotif(motifName, motifMesh, motifColorHex = "0xcc2900", includeAtoms = true) {
|
|
796
796
|
const motif = new Motif(`${motifName}_motif`);
|
|
797
797
|
for (const [key] of Object.entries(motifMesh)) {
|
|
798
|
-
const { vertices, indices } = getPoints(motifMesh[key]);
|
|
798
|
+
const { vertices, indices } = getPoints(motifMesh[key], includeAtoms);
|
|
799
799
|
const residue = new Residue("residue");
|
|
800
800
|
const backboneMesh = new MeshObject(`backbone_${key}`);
|
|
801
801
|
backboneMesh.applyVertexData(vertices[0], indices[0]);
|
|
@@ -808,7 +808,7 @@ async function getMotif(motifName, motifMesh, motifColorHex = "0xcc2900") {
|
|
|
808
808
|
motif.addChild(residue);
|
|
809
809
|
}
|
|
810
810
|
motif.userData.fileName = motifName;
|
|
811
|
-
motif.userData.atomInfo = await parseAtomCoords(motifMesh);
|
|
811
|
+
if (includeAtoms) motif.userData.atomInfo = await parseAtomCoords(motifMesh);
|
|
812
812
|
return motif;
|
|
813
813
|
}
|
|
814
814
|
|
|
@@ -1077,6 +1077,7 @@ function Canvas({
|
|
|
1077
1077
|
rendererBackgroundColor = "#040a20",
|
|
1078
1078
|
rendererSizeIsWindow = false,
|
|
1079
1079
|
cameraPositionZ = 1e3,
|
|
1080
|
+
showRMSD = true,
|
|
1080
1081
|
motifProps,
|
|
1081
1082
|
customEventProps
|
|
1082
1083
|
}) {
|
|
@@ -1187,7 +1188,7 @@ function Canvas({
|
|
|
1187
1188
|
element.rotate(axisVec, angle);
|
|
1188
1189
|
}
|
|
1189
1190
|
});
|
|
1190
|
-
setScoreRMSD(calculateRMSD(Array.from(selectedMotifMeshState.current), motifs));
|
|
1191
|
+
if (showRMSD) setScoreRMSD(calculateRMSD(Array.from(selectedMotifMeshState.current), motifs));
|
|
1191
1192
|
}
|
|
1192
1193
|
}
|
|
1193
1194
|
}
|
|
@@ -1232,7 +1233,7 @@ function Canvas({
|
|
|
1232
1233
|
element.rotate(event.rotationAxis, angle);
|
|
1233
1234
|
}
|
|
1234
1235
|
});
|
|
1235
|
-
setScoreRMSD(calculateRMSD(Array.from(selectedMotifMeshState.current), motifs));
|
|
1236
|
+
if (showRMSD) setScoreRMSD(calculateRMSD(Array.from(selectedMotifMeshState.current), motifs));
|
|
1236
1237
|
}
|
|
1237
1238
|
function onKeyboardTranslate(event) {
|
|
1238
1239
|
if (event.translationDirection.equals(Vec3.Zero)) {
|
|
@@ -1310,7 +1311,7 @@ function Canvas({
|
|
|
1310
1311
|
}
|
|
1311
1312
|
});
|
|
1312
1313
|
updateGlow();
|
|
1313
|
-
setScoreRMSD(calculateRMSD(Array.from(selectedMotifMeshState.current), motifs));
|
|
1314
|
+
if (showRMSD) setScoreRMSD(calculateRMSD(Array.from(selectedMotifMeshState.current), motifs));
|
|
1314
1315
|
}, [selectedMotifIds]);
|
|
1315
1316
|
useEffect(() => {
|
|
1316
1317
|
const unsubscribe = CanvasDataManager.subscribe("lockedMotifIds" /* LOCKED_MOTIF_IDS */, () => {
|
|
@@ -1328,23 +1329,27 @@ function Canvas({
|
|
|
1328
1329
|
hardLockedMotifIds = CanvasDataManager.hardLockedMotifIds;
|
|
1329
1330
|
}, [CanvasDataManager.hardLockedMotifIds]);
|
|
1330
1331
|
useEffect(() => {
|
|
1332
|
+
if (!showRMSD) return;
|
|
1331
1333
|
const unsubscribe = CanvasDataManager.subscribe("scoreRMSD" /* SCORE_RMSD */, () => {
|
|
1332
1334
|
setScoreRMSD(CanvasDataManager.scoreRMSD);
|
|
1333
1335
|
});
|
|
1334
1336
|
return () => unsubscribe();
|
|
1335
1337
|
}, []);
|
|
1336
1338
|
useEffect(() => {
|
|
1339
|
+
if (!showRMSD) return;
|
|
1337
1340
|
if (CanvasDataManager.scoreRMSD !== scoreRMSD) {
|
|
1338
1341
|
CanvasDataManager.setScoreRMSD(scoreRMSD);
|
|
1339
1342
|
}
|
|
1340
1343
|
}, [scoreRMSD]);
|
|
1341
1344
|
useEffect(() => {
|
|
1345
|
+
if (!showRMSD) return;
|
|
1342
1346
|
const unsubscribe = CanvasDataManager.subscribe("kabschRMSD" /* KABSCH_RMSD */, () => {
|
|
1343
1347
|
setKabschRMSD(CanvasDataManager.kabschRMSD);
|
|
1344
1348
|
});
|
|
1345
1349
|
return () => unsubscribe();
|
|
1346
1350
|
}, []);
|
|
1347
1351
|
useEffect(() => {
|
|
1352
|
+
if (!showRMSD) return;
|
|
1348
1353
|
if (CanvasDataManager.kabschRMSD !== kabschRMSD) {
|
|
1349
1354
|
CanvasDataManager.setKabschRMSD(kabschRMSD);
|
|
1350
1355
|
} else if (CanvasDataManager.kabschRMSD.length !== motifs.length) {
|
|
@@ -1369,7 +1374,7 @@ function Canvas({
|
|
|
1369
1374
|
);
|
|
1370
1375
|
}
|
|
1371
1376
|
if (motifs.length > 0) {
|
|
1372
|
-
setKabschRMSD(calculateAllKabschRMSD(motifs));
|
|
1377
|
+
if (showRMSD) setKabschRMSD(calculateAllKabschRMSD(motifs));
|
|
1373
1378
|
if (scene.current.children.size !== motifs.length) {
|
|
1374
1379
|
const positions = calculatePositions(motifs.length);
|
|
1375
1380
|
motifs.forEach((motifMesh, index) => {
|
|
Binary file
|
package/package.json
CHANGED