Skip to content

Commit

Permalink
Fix for when PubChem return more than one molecule id - just take the…
Browse files Browse the repository at this point in the history
… first.
  • Loading branch information
stuartjamesmcnicholas committed Oct 24, 2024
1 parent 6a39f35 commit f85dad4
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,8 @@ export const MoorhenSMILESToLigandMenuItem = (props: {
const molSearchUrl = "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/"+smileRef.current+"/cids/TXT"
console.log(molSearchUrl)
const moleculeSearchResponse = await fetch(molSearchUrl)
const moleculeId = await moleculeSearchResponse.text()
const smilesSearchUrl = "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/"+moleculeId+"/property/CanonicalSMILES/TXT"
console.log(moleculeId)
const moleculeIds = await moleculeSearchResponse.text()
const smilesSearchUrl = "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/"+moleculeIds.split("\n")[0]+"/property/CanonicalSMILES/TXT"
const smilesResponse = await fetch(smilesSearchUrl)
const pubchemSmiles = await smilesResponse.text()
console.log(pubchemSmiles)
Expand Down

0 comments on commit f85dad4

Please sign in to comment.