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

ngl/src/store /residue-type.ts isRna() issue #1016

Open
Fravadona opened this issue Jan 22, 2024 · 5 comments
Open

ngl/src/store /residue-type.ts isRna() issue #1016

Fravadona opened this issue Jan 22, 2024 · 5 comments
Labels

Comments

@Fravadona
Copy link

Fravadona commented Jan 22, 2024

Hi,

I've got a little issue with ngl.js.

Coarse-grainied DNA chains (with only P and/or C3' atoms) work fine, but coarse-grained RNA chains (with only P and/or C4' atoms) are not displayed.

With some efforts I found out that the isRna() function of ngl/src/store /residue-type.ts has a little problem:

In the expression

this.hasAtomWithName([ 'P', "O3'", 'O3*' ], [ "C4'", 'C4*' ], [ "O2'", 'O2*', "F2'", 'F2*' ]) ||
(RnaBases.includes(this.resname) && this.hasAtomWithName([ "O2'", 'O2*', "F2'", 'F2*' ]))

the && this.hasAtomWithName([ "O2'", 'O2*', "F2'", 'F2*' ]) shouldn't be there, IMHO. Why check for the presence of specific atoms when you already failed at it and felled-back to inquire the residue name?

Removing that expression makes NGL display coarse-grained RNA chains:

  isRna () {
    if (this.chemCompType) {
      return ChemCompRna.includes(this.chemCompType)
    } else if (this.hetero === 1) {
      return false
    } else {
      return (
        this.hasAtomWithName(
          [ 'P', "O3'", 'O3*' ], [ "C4'", 'C4*' ], [ "O2'", 'O2*', "F2'", 'F2*' ]
        ) ||
        RnaBases.includes(this.resname)
      )
    }
  }

Cheers
Rafael.

@Fravadona
Copy link
Author

There's also a bonding problem for coarse-grained DNA/RNA chains.

For two backbone atoms to make a bond, the max distance between them is set to √48 A in the code; that isn't enough for the RNA chains of ribosomes.

I set it to √96 A in ngl.js (which works with my test-cases), but I don't think that's the right thing to do. Checking that the ChainIDs are the same for both residues and that the ResidueNo are equals by ±1 would be safer.

@ppillot
Copy link
Collaborator

ppillot commented Jan 27, 2024

In the expression

this.hasAtomWithName([ 'P', "O3'", 'O3*' ], [ "C4'", 'C4*' ], [ "O2'", 'O2*', "F2'", 'F2*' ]) ||
(RnaBases.includes(this.resname) && this.hasAtomWithName([ "O2'", 'O2*', "F2'", 'F2*' ]))

the && this.hasAtomWithName([ "O2'", 'O2*', "F2'", 'F2*' ]) shouldn't be there, IMHO. Why check for the presence of specific atoms when you already failed at it and felled-back to inquire the residue name?

Note that the code is not doing the same thing in the two passes. The first test checks for hasAtomWithName([ 'P', "O3'", 'O3*' ], [ "C4'", 'C4*' ], [ "O2'", 'O2*', "F2'", 'F2*' ]) which is like the residue contains 1 atom which can be 'P' OR "O3'" OR 'O3*' AND 1 atom which can be "C4'" OR 'C4*' AND 1 atom which can be "O2'" OR 'O2*' OR "F2'" OR 'F2*'
The second predicate is a bit less restrictive as it only checks for the atoms "O2'" OR 'O2*' OR "F2'" OR 'F2*'
So, the code is not doing twice the same test.

That being said, I don't know what was the exact rationale behind those tests (it was coded more than 6 years ago by Alex Rose who is now dedicating his efforts towards Mol*). I remember that in some legacy PDB files the resnames A, T, C, G were used in DNA instead of proper DA, DT, DC, DG, which makes the test on the rna residue name insufficient. Also, there are typically multiple non-standard/modified bases in RNA.
In the first part of your message you mention "only P and/or C4' atoms", so it seems that we could add another case here specifically for coarse grain models. Note that the lsit of atoms considered for RNA coarse grained models is defined as [ "C4'", 'C4*', 'P' ], so this seems like the direction to go.

@ppillot ppillot added the bug label Jan 27, 2024
@Fravadona
Copy link
Author

Thank you for the reply.

So that condition is meant to prevent DNA chains in some older PDBs to be recognized as RNA chains?

A possible solution could be to handle those exceptions in the isDna() function:

... ||
DnaBases.includes(this.resname) ||
RnaBases.includes(this.resname) && ! this.hasAtomWithName([ "O2'", 'O2*', "F2'", 'F2*' ])

But in that case, coarse-grainded RNA chains would be evaluated as true by both isRna() and isDna().

@ppillot
Copy link
Collaborator

ppillot commented Jan 28, 2024

@Fravadona I am not sure why it was written this way.
Do you have an example of a public coarse grained RNA structure we could use for reference?

@Fravadona
Copy link
Author

@ppillot I'm not sure what you call a "public coarse grained RNA structure" but here's an example that works with my "patched" version of ngl.js:

http://www.dynstr.pasteur.fr/servers/minactionpath/minactionpath2_submission/examples/8G34_to_8G31/

If you load the transition.cif.gz or play the trajectory.cif.gz in http://nglviewer.org/ngl/ then the RNA chains will be missing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants