Skip to content

Commit

Permalink
GROK-16944: AutoDock: Error when run from context pane from Browse
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksashka11 committed Oct 28, 2024
1 parent a64e476 commit b9dc6ca
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions packages/Docking/src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,16 @@ export async function runAutodock4(
//output: list<string> configFiles
export async function getConfigFiles(): Promise<string[]> {
const targetsFiles: DG.FileInfo[] = await grok.dapi.files.list(TARGET_PATH, true);
return targetsFiles.filter(file => file.isDirectory).map(file => file.name);
const directoriesWithGpf = await Promise.all(
targetsFiles.filter(file => file.isDirectory).map(async dir => {
const filesInDir = await grok.dapi.files.list(dir.fullPath, true);
return filesInDir.some(file => file.path.endsWith('.gpf')) ? dir.name : null;
}
)
);

return directoriesWithGpf.filter((dir): dir is string => Boolean(dir));

}

export async function prepareAutoDockData(
Expand Down Expand Up @@ -339,10 +348,11 @@ export async function autodockPanel(smiles: DG.SemanticValue): Promise<DG.Widget
const loader = ui.loader();
resultsContainer.appendChild(loader);

const table = smiles.cell.dataFrame.clone();
table.rows.removeWhereIdx((idx) => idx !== 0);
const ligandColumn = 'smiles';
const table = DG.DataFrame.fromCsv(`${ligandColumn}\n${smiles.value}`);
await grok.data.detectSemanticTypes(table);

const data = await prepareAutoDockData(target.value!, table, smiles.cell.column.name, poses.value!);
const data = await prepareAutoDockData(target.value!, table, ligandColumn, poses.value!);

const app = new AutoDockApp();
const autodockResults = await app.init(data);
Expand Down

0 comments on commit b9dc6ca

Please sign in to comment.