Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script to extract ion names from CCD #62

Closed
arose opened this issue May 27, 2020 · 6 comments
Closed

Script to extract ion names from CCD #62

arose opened this issue May 27, 2020 · 6 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@arose
Copy link
Member

arose commented May 27, 2020

Should extend the existing cli/chem-comp-bonds/ script (renamed to chem-comp). Data should go to src\mol-model\structure\model\types\ions.ts. Include all chemical components with the word "ion" in their name. Will replace IonNames in src\mol-model\structure\model\types.ts.

Related: #63

@thetechnocrat-dev
Copy link
Contributor

Is this still a good first issue?

@arose
Copy link
Member Author

arose commented Sep 12, 2020

Is this still a good first issue?

Yes it is!

@thetechnocrat-dev
Copy link
Contributor

I noticed there is a src/cli/lipid-params/index.ts file that does for lipids what this new function should do for ions.

I also noticed the current hardcoded IonNames have a comment above on how to extract all ions:

/**
 * TODO write script that read CCD and outputs list of ion names
 *
 * all chemical components with the word "ion" in their name, Sep 2016
 *
 * SET SESSION group_concat_max_len = 1000000;
 * SELECT GROUP_CONCAT(id_ ORDER BY id_ ASC SEPARATOR '", "') from
 * (
 *     SELECT count(obj_id) as c, id_
 *     FROM pdb.chem_comp WHERE name LIKE "% ION%"
 *     GROUP BY id_
 * ) AS t1;
 */
export var IonNames = new Set([
    '118', '119', '1AL', '1CU', '2FK', '2HP', '2OF', '3CO', ...

Lastly, I am able to run node --max-old-space-size=4096 lib/commonjs/cli/chem-comp-dict/create-table.js build/data/ccb.bcif -b to create the ccb.bcif locally. Where I'm stuck is what functions to use to query this file. Do you have any guidance to point me in the right direction?

@arose
Copy link
Member Author

arose commented Sep 24, 2020

HI @McMenemy, if you reuse readCCD you can loop over all components like below. No need to create ccb.bcif here.

const ccd = await readCCD();
for (const k in ccd) {
    const { chem_comp } = ccd[k];
    if (chem_comp.name.value(0).toUpperCase().includes(' ION')) {
        // found ion, write out `chem_comp.id.value(0)`
    }
}

@thetechnocrat-dev
Copy link
Contributor

@arose Thanks for the pointers to get started, exactly what I needed 💯 . Here is the the PR that goes with this issue.

@thetechnocrat-dev
Copy link
Contributor

Should this issue get closed now?

@arose arose closed this as completed Oct 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants