mirror of
https://github.com/obsidian-desci/Obsidian-Desci.git
synced 2026-07-22 08:50:32 +00:00
debug
This commit is contained in:
parent
2033373495
commit
d79fc5317e
4 changed files with 89 additions and 47 deletions
|
|
@ -1,7 +1,8 @@
|
|||
from plex import CoreTools, plex_init, plex_run
|
||||
from plex import CoreTools, plex_init, plex_run, plex_vectorize, plex_mint
|
||||
import sys
|
||||
import json
|
||||
import os
|
||||
import py3Dmol
|
||||
|
||||
dir_path = sys.argv[1]
|
||||
protein_path = [f"{dir_path}/{sys.argv[2]}"]
|
||||
|
|
@ -17,3 +18,17 @@ initial_io_cid = plex_init(
|
|||
)
|
||||
|
||||
completed_io_cid, io_local_filepath = plex_run(initial_io_cid, dir_path)
|
||||
print("after plex_run")
|
||||
print(completed_io_cid)
|
||||
results = plex_vectorize(completed_io_cid, CoreTools.EQUIBIND.value, output_dir=dir_path)
|
||||
print('after plex_vectorize')
|
||||
best_docked_small_molecule_path = results['best_docked_small_molecule']['filePaths'][0]
|
||||
best_docked_small_molecule_cid = results['best_docked_small_molecule']['cidPaths'][0]
|
||||
|
||||
print(results)
|
||||
print("Docked Protein: ", best_docked_small_molecule_path.replace(dir_path, ""))
|
||||
print(best_docked_small_molecule_cid)
|
||||
|
||||
os.environ["AUTOTASK_WEBHOOK"] = "https://api.defender.openzeppelin.com/autotasks/e15b3f39-28f8-4d30-9bf3-5d569bdf2e78/runs/webhook/8315d17c-c493-4d04-a257-79209f95bb64/2gmqi9SRRAQMoy1SRdktai"
|
||||
|
||||
plex_mint(completed_io_cid)
|
||||
|
|
@ -48,18 +48,6 @@ export const getProtein = async function () {
|
|||
chat_role: 'assistant'
|
||||
}
|
||||
)
|
||||
const displayNode = createNode(canvas, created,
|
||||
{
|
||||
text: "test",
|
||||
size: { height: placeholderNoteHeight*3 }
|
||||
},
|
||||
{
|
||||
color: assistantColor,
|
||||
chat_role: 'assistant'
|
||||
}
|
||||
)
|
||||
displayNode.setText("")
|
||||
|
||||
|
||||
try {
|
||||
const res = await requestUrl({
|
||||
|
|
@ -79,24 +67,6 @@ export const getProtein = async function () {
|
|||
console.error('Error saving image:', error);
|
||||
} else {
|
||||
const file = this.app.vault.getAbstractFileByPath(`${filename}`)
|
||||
import("3dmol/build/3Dmol.js").then(async ($3Dmol) => {
|
||||
|
||||
console.log('displayNode', displayNode)
|
||||
const el = displayNode.containerEl
|
||||
console.log($3Dmol);
|
||||
console.log('el', el)
|
||||
console.log('canvas', canvas)
|
||||
await sleep(200)
|
||||
let config = { backgroundColor: 'rgb(30,30,30)' };
|
||||
let viewer = $3Dmol.createViewer(el, config);
|
||||
let m = viewer.addModel()
|
||||
m.addMolData(fs.readFileSync(`${this.app.vault.adapter.basePath}/${filename}`, 'utf-8'), 'pdb')
|
||||
|
||||
viewer.zoomTo();
|
||||
viewer.render();
|
||||
console.log('viewer', viewer)
|
||||
viewer.zoom(0.8, 2000);
|
||||
});
|
||||
const cidNode = createNode(canvas, created,
|
||||
{
|
||||
file,
|
||||
|
|
|
|||
|
|
@ -83,9 +83,20 @@ export const runEquibind = async function () {
|
|||
equibind.stdout?.on('data', (data) => {
|
||||
console.log('stdout:data:', data)
|
||||
const outputDirRegex = /Created working directory: (.*)\n/;
|
||||
const outputFileRegex = /[^\/]+(?=\/$|$)/
|
||||
const outputDir = data.match(outputDirRegex)[1]
|
||||
const outputFileRegex = /[^\/]+(?=\/$|$)/
|
||||
const outputFile = outputDir.match(outputFileRegex)[0]
|
||||
const nftLinkRegex = / ProofOfScience NFT at (.*)\n/;
|
||||
const nftLink = data.match(nftLinkRegex)[0]
|
||||
|
||||
const dockedProteinRegex = /Docked Protein: \/(.*)\n/;
|
||||
let dockedProteinPath = data.match(dockedProteinRegex)[1]
|
||||
console.log('dockedProteinPath', dockedProteinPath)
|
||||
dockedProteinPath = dockedProteinPath.replace(/DockedProtein: /, '')
|
||||
const dockedProteinFile = this.app.vault.getAbstractFileByPath(dockedProteinPath)
|
||||
console.log('dockedProteinPath', dockedProteinPath)
|
||||
console.log('dockerProteinFile', dockedProteinFile)
|
||||
console.log('nftLink', nftLink)
|
||||
console.log('outputfile', outputFile)
|
||||
|
||||
const cidRegex = /Completed IO JSON CID: (.*)\n/;
|
||||
|
|
@ -111,7 +122,32 @@ export const runEquibind = async function () {
|
|||
chat_role: 'assistant'
|
||||
|
||||
},
|
||||
{ x:-400, y:0}
|
||||
{ x:-650, y:0}
|
||||
)
|
||||
const dockedProteinNode = createNode(canvas, outputFileNode,
|
||||
{
|
||||
file: dockedProteinFile,
|
||||
size: { height: placeholderNoteHeight }
|
||||
},
|
||||
{
|
||||
color: assistantColor,
|
||||
chat_role: 'assistant'
|
||||
|
||||
},
|
||||
)
|
||||
|
||||
const nftNode = createNode(canvas, created,
|
||||
{
|
||||
text: `NFT: ${nftLink}`,
|
||||
size: {
|
||||
height: placeholderNoteHeight
|
||||
}
|
||||
},
|
||||
{
|
||||
color: assistantColor,
|
||||
chat_role: 'assistant'
|
||||
},
|
||||
{ x:650, y:0}
|
||||
)
|
||||
|
||||
})
|
||||
|
|
|
|||
|
|
@ -21,9 +21,10 @@ export const viewMolecule = async function () {
|
|||
return
|
||||
}
|
||||
const selection = canvas.selection
|
||||
if (selection?.size !== 1) return
|
||||
if (selection?.size > 2) return
|
||||
const values: CanvasNode[] = Array.from(selection.values())
|
||||
const node: CanvasNode = values[0]
|
||||
const node2: CanvasNode | null = values[1] ? values[1] : null
|
||||
if (node) {
|
||||
await canvas.requestSave()
|
||||
await sleep(200)
|
||||
|
|
@ -42,7 +43,8 @@ export const viewMolecule = async function () {
|
|||
text: "loading model",
|
||||
size: {
|
||||
width: 1000,
|
||||
height: 1000 }
|
||||
height: 1000
|
||||
}
|
||||
},
|
||||
{
|
||||
color: assistantColor,
|
||||
|
|
@ -73,26 +75,45 @@ export const viewMolecule = async function () {
|
|||
fs.readFileSync(`${this.app.vault.adapter.basePath}/${nodeData.file}`, 'utf-8'),
|
||||
fileType
|
||||
)
|
||||
if (fileType === 'pdb') {
|
||||
m.setStyle({ 'model': 0 }, { 'cartoon': { 'color': 'spectrum' } })
|
||||
} else {
|
||||
m.setStyle({ 'model': 1 }, { 'stick': {} })
|
||||
}
|
||||
if (node2) {
|
||||
const node2Data = node2.getData()
|
||||
console.log('node2Data', node2Data)
|
||||
const path2 = `${this.app.vault.adapter.basePath}/${node2Data.file}`
|
||||
console.log('path2', path2)
|
||||
const fileType2 = pdb.test(node2Data.file) ? 'pdb' : 'sdf'
|
||||
m.addMolData(
|
||||
fs.readFileSync(`${this.app.vault.adapter.basePath}/${node2Data.file}`, 'utf-8'),
|
||||
fileType2
|
||||
)
|
||||
console.log(viewer, 'viewer')
|
||||
console.log(m, 'm')
|
||||
m.setStyle({ 'model': 1 }, { 'stick': {} })
|
||||
}
|
||||
|
||||
viewer.zoomTo();
|
||||
viewer.render();
|
||||
console.log('viewer', viewer)
|
||||
viewer.zoom(0.8, 2000);
|
||||
displayNode.setText("")
|
||||
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
const cideNodeError = createNode(canvas, node,
|
||||
{
|
||||
text: `error: ${e}`,
|
||||
size: { height: placeholderNoteHeight }
|
||||
},
|
||||
{
|
||||
color: assistantColor,
|
||||
chat_role: 'assistant'
|
||||
}
|
||||
)
|
||||
const cideNodeError = createNode(canvas, node,
|
||||
{
|
||||
text: `error: ${e}`,
|
||||
size: { height: placeholderNoteHeight }
|
||||
},
|
||||
{
|
||||
color: assistantColor,
|
||||
chat_role: 'assistant'
|
||||
}
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue