cheminfo / octochemdb

https://octochemdb.cheminfo.org/documentation/static/index.html
MIT License
1 stars 0 forks source link

Create aggregation script #26

Closed lpatiny closed 1 year ago

lpatiny commented 2 years ago

Get inspired by mfs / aggreates.

We will at first get all the different noStereoID and make a unique list using something like

const collections = [];
const targetCollection = 'bestofCompounds';
const uniqueIDs = {};
for (let i = 0; i < collections.length; i++) {
  // fetch all noStereoID from the DB
  for (let id of ids) {
    uniqueIDs[id] = true;
  }
}
let array = Object.keys(uniqueIDs);

for (let id of array) {
  // retrieve all the info in all the collections
  // join the information in a smart way ;)
  // add mf, em using OCL.Molecule.fromIdCode and then getMF https://github.com/cheminfo/docker-pubchem/blob/de2e577531484e0c8f6fb24ae008a1d0e0e6330e/pubchem/src/plugins/compounds/sync/utils/improveCompound.js#L50-L56
  // save in the new targetCollection
}
RicardoSilvestr commented 1 year ago

Done: https://github.com/cheminfo/docker-pubchem/blob/a60c54af0f423d4bd374c9b66dd870f024fefbb3/pubchem/src/plugins/activesOrNaturals/aggregates/aggregateActivesOrNaturals.js