nglviewer / ngl

WebGL protein viewer
http://nglviewer.org/ngl/
MIT License
666 stars 169 forks source link

pdb versus mmtf 'reduced', versus mmtf 'full' : differences in cartoon representation (aspectRatio) #783

Open 0gust1 opened 4 years ago

0gust1 commented 4 years ago

Hi,

I hope my question is not too silly (I'm a webdev, not a biologist)

I'm currently testing the usage of mmtf files instead of pdb ones, and I noticed differences in cartoon representation (and also in surface representation).

With a mmtf file "reduced" and a cartoon representation, the representationParameter aspectRatio seems locked to 1.0, and changing it has no effect.

With a mmtf "full", I have the same render and behavior than the PDB file (aspectRatio parameter works as intended)

Why ? I understand that there data stripped from "full" to "reduced" mmtf files, but I don't understand why it would have an effect of the AspectRatio of rendered ribbons.

Context :
NGL version : ngl@2.0.0-dev.37 Structure : https://www.rcsb.org/structure/1IGY
PDB file : 1igy.pdb downloaded from rcsb
MMTF 'reduced' file : curl -O https://mmtf.rcsb.org/v1.0/reduced/1IGY.mmtf.gz
MMTF 'full' file : curl -O https://mmtf.rcsb.org/v1.0/full/1IGY.mmtf.gz

fredludlow commented 4 years ago

Yes, it does seem to be hard-coded:

https://github.com/nglviewer/ngl/blob/master/src/representation/cartoon-representation.ts#L125

    getAspectRatio(polymer) {
        return polymer.isCg() ? 1.0 : this.aspectRatio;
    }

I don't know why that's the case. We could just allow it to be set, but that would change existing behaviour for course-grained structures. We could probably fudge it so that the default value is NaN (which then gets interpreted as 1.0 or 5.0 depending on polymer.isCg)? What do you (and anyone else) think?

arose commented 4 years ago

It is fixed because there is no way implemented to infer the direction into which extend the cartoon for CA only models.

fredludlow commented 4 years ago

Thanks @arose - that makes sense. You say no way implemented, is there a way it could be done or does the reduced form just not have enough information in it to do it? (Other than making a guess based on the secondary structure of nearby elements, which sounds complicated and error-prone).

0gust1 commented 4 years ago

Thanks @arose and @fredludlow !

I had a confirmation from my "chief scientific officer" : the ribbon oval orientation is dependent of both the backbone and secondary structures.

Knowing this, the behavior seems legit. "Today I learned"

0gust1 commented 4 years ago

I'm wondering if what I learnt today could be put somewhere here, or it's maybe common sense for biology/chemistry aware people.

Anyway, you can close the issue as you wish.

fredludlow commented 4 years ago

We could stick it in the docs for CartoonRepresentation, specifically for CartoonRepresentationParameters.aspectRatio (I've long been meaning to udpate the docs - they do build currently locally but I haven't looked into how to update the public version).

If you look at e.g. dihedral-representation.ts the parameters are documented in a typedoc block at the top - we could add the equivalent block to cartoon-representation.ts

0gust1 commented 4 years ago

Seems a good (an hopefully easy) way for me to try a first contrib !

fredludlow commented 4 years ago

Seems a good (an hopefully easy) way for me to try a first contrib !

Absolutely! :)