datagrok-ai / public

Public package repository for the Datagrok.ai platform
MIT License
43 stars 26 forks source link

#2605: BsV: Custom biostructure data provider #2605

Closed tanas80 closed 1 week ago

tanas80 commented 9 months ago

Add a property .biostructureDataProvider for the name of the custom data provider function. Add a property .biostructureIdColumnName to follow for the current row of the data frame linked to the viewer.

An example for custom biostructure data provider

//name: RCSB mmCIF
//description: Get biostructure by id as mmCIF
//meta.dataProvider: Molecule3D
//meta.cache: client
//meta.invalidateOn: 0 0 1 * * ?
//input: string id
//output: object result
export async function getBiostructureRcsbMmcif(id: string): Promise<BiostructureData> {
  const url = `https://files.rcsb.org/download/${id}.cif`;
  const response = await fetch(url);
  if (!response.ok)
    throw new Error(response.statusText);
  const data: string = await response.text();
  return {binary: false, data: data, ext: 'cif', options: {name: id}};
}
dnillovna commented 7 months ago

This issue has been mirrored in Jira: https://reddata.atlassian.net/browse/GROK-14898

dnillovna commented 3 months ago

This issue has been mirrored in Jira: https://reddata.atlassian.net/browse/GROK-16159