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

Partial coloring of structure #182

Open
lokapal opened this issue Oct 22, 2017 · 3 comments
Open

Partial coloring of structure #182

lokapal opened this issue Oct 22, 2017 · 3 comments

Comments

@lokapal
Copy link

lokapal commented Oct 22, 2017

Hello, Marco!
I'm lost (err, again ;) in the documentation of your omnipotent ;) pv. I need in partial coloring of structure. From pv documentation I revealed that I need in something like "Color structure by custom property" i.e. in function pv.color.byResidueProp(), but I don't need in 'funky' colors. I don't need in rainbow and/or gradient. I need in uniform coloring per chain (it's done) while SOME residues have unique colors (I'll handle both list of these residues and colors per residue). Could you enhance the documentation with this kind of example? Thank you in advance!
P.S. I've tried to use something like
var index = 0;
structure.eachResidue(function(r) {
var tmpc;
if (index==0) { tmpc=9; }
else { tmpc=4; }
r.setProp('funky', tmpc);
index++;
});

or
var index=0;
structure.eachResidue(function(r) {
var tmpc;
if (index==0) { tmpc='red'; }
else { tmpc='blue'; }
r.setProp('funky', tmpc);
index++;
});

Unfortunately it doesn't work.

@a-rasimmurat
Copy link

Hi!

Could you find any solution for your problem, I have the same issue.

@arthurchipdean
Copy link

arthurchipdean commented Dec 27, 2018

A little late here but this is what I did. If you color by chain first you can then select individual atoms or residues by some criteria and overlap the color of your choice on top of the chain coloring. That's what I'm doing here:

//First select the chain
var main_chain = structure.atomSelect(function(atom) {
  return atom._tempFactor >= 10 && atom.residue().chain().name() == options.chain;
});
//Give a tag 'main-chain', and color it
 viewer.cartoon('main-chain', main_chain, {
  color: color.uniform('#d0ffbf')
});
//Select atoms based on some factor.
var lowQualityAtoms = structure.atomSelect(function (atom) {
   return atom._tempFactor != 10;
});
//And color them
viewer.lineTrace('lowQuality', lowQualityAtoms, {color: color.uniform('lightgrey')});

@gaiagbola
Copy link

Hello!!
I am building a software for drug design purposes and needed a viewer. I tried to input a specific PDB file but it did not seem to work. Can anybody explain why? I added the protein into the pulldown menu of the viewer but still nothing.

Thank you for your attention

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

No branches or pull requests

4 participants