Skip to content

Commit

Permalink
Merge pull request #108 in STRUC/icn3d from release260b to master
Browse files Browse the repository at this point in the history
* commit '0daa6fb191a5f711f5444f17ca573c28fe362973':
  minor fix on color
  • Loading branch information
jiywang3 committed Mar 20, 2019
2 parents db1613f + 0daa6fb commit d3c4ad2
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
20 changes: 14 additions & 6 deletions src/icn3d/display/display_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ iCn3D.prototype.updateChainsColor = function (atom) {
}
};

iCn3D.prototype.setMmdbChainColor = function () {
this.applyOriginalColor(this.hash2Atoms(this.hAtoms));
iCn3D.prototype.setMmdbChainColor = function (inAtoms) {
var atoms = (inAtoms === undefined) ? this.hAtoms : inAtoms;
this.applyOriginalColor(this.hash2Atoms(atoms));

// atom color
var atomHash = this.unionHash(this.chemicals, this.ions);
Expand All @@ -33,12 +34,15 @@ iCn3D.prototype.setMmdbChainColor = function () {
};

iCn3D.prototype.setConservationColor = function (atoms, bIdentity) {
/*
for (var i in atoms) {
var atom = this.atoms[i];
atom.color = this.defaultAtomColor;
this.atomPrevColors[i] = atom.color;
}
*/
this.setMmdbChainColor(atoms);

for(var chainid in this.alnChainsSeq) {
var resObjectArray = this.alnChainsSeq[chainid];
Expand Down Expand Up @@ -261,6 +265,10 @@ iCn3D.prototype.setColorByOptions = function (options, atoms, bUseInputColor) {
this.setConservationColor(atoms, true);
break;

case 'conserved': // backward-compatible, "conserved" was changed to "identity"
this.setConservationColor(atoms, true);
break;

case 'conservation':
this.setConservationColor(atoms, false);
break;
Expand Down Expand Up @@ -899,12 +907,12 @@ iCn3D.prototype.applyOriginalColor = function (atoms) {

if(this.chainsColor.hasOwnProperty(chainid)) {
atom.color = this.chainsColor[chainid];

this.atomPrevColors[i] = atom.color;
}
else {
//atom.color = this.atomColors[atom.elem];
break;
atom.color = this.atomColors[atom.elem];
//break;
}

this.atomPrevColors[i] = atom.color;
}
};
11 changes: 5 additions & 6 deletions src/icn3dui/annotations/annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,21 +516,20 @@ iCn3DUI.prototype.getAnnotationData = function() { var me = this;
me.fullpos2ConsTargetpos[i + nGap] = {'same': 1, 'pos': i+1, 'res': targetSeq[i], 'color': colorHexStr};
me.consrvResPosArray.push(i+1);

me.icn3d.alnChainsSeq[chnid].push({'resi': i, 'color': '#FF0000', 'color2': '#' + colorHexStr});
me.icn3d.alnChainsSeq[chnid].push({'resi': i+1, 'color': '#FF0000', 'color2': '#' + colorHexStr});
}
else if(me.conservativeReplacement(targetSeq[i], querySeq[target2queryHash[i]])) {
compText += '+';
me.fullpos2ConsTargetpos[i + nGap] = {'same': 0, 'pos': i+1, 'res': targetSeq[i], 'color': colorHexStr};
me.consrvResPosArray.push(i+1);

//me.icn3d.alnChainsSeq[chnid].push({'resi': i, 'color': '#0000FF', 'color2': '#' + colorHexStr});
me.icn3d.alnChainsSeq[chnid].push({'resi': i, 'color': '#00FF00', 'color2': '#' + colorHexStr});
me.icn3d.alnChainsSeq[chnid].push({'resi': i+1, 'color': '#0000FF', 'color2': '#' + colorHexStr});
}
else {
compText += ' ';
me.fullpos2ConsTargetpos[i + nGap] = {'same': -1, 'pos': i+1, 'res': targetSeq[i], 'color': colorHexStr};

me.icn3d.alnChainsSeq[chnid].push({'resi': i, 'color': me.GREYC, 'color2': '#' + colorHexStr});
me.icn3d.alnChainsSeq[chnid].push({'resi': i+1, 'color': me.GREYC, 'color2': '#' + colorHexStr});
}
}
else {
Expand Down Expand Up @@ -999,8 +998,8 @@ iCn3DUI.prototype.showSeq = function(chnid, chnidBase, type, queryTitle, compTit
//var color = (atom.color) ? atom.color.getHexString() : me.icn3d.defaultAtomColor;

var color = '333333';
if(me.cfg.blast_rep_id == chnid) {
if(me.fullpos2ConsTargetpos !== undefined && me.fullpos2ConsTargetpos[i + nGap] !== undefined) color = me.fullpos2ConsTargetpos[i + nGap].color;
if(me.cfg.blast_rep_id == chnid && me.fullpos2ConsTargetpos !== undefined && me.fullpos2ConsTargetpos[i + nGap] !== undefined) {
color = me.fullpos2ConsTargetpos[i + nGap].color;
}
else {
var atom = me.icn3d.getFirstCalphaAtomObj(me.icn3d.residues[chnid + '_' + pos]);
Expand Down
2 changes: 1 addition & 1 deletion src/icn3dui/full_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ var iCn3DUI = function(cfg) {
me.opts['pk'] = 'residue'; //no, atom, residue, strand, chain
me.opts['chemicalbinding'] = 'hide'; //show, hide

if(me.cfg.align !== undefined) me.opts['color'] = 'conservation';
if(me.cfg.align !== undefined) me.opts['color'] = 'identity';
if(me.cfg.blast_rep_id !== undefined) me.opts['color'] = 'conservation';
if(me.cfg.cid !== undefined) me.opts['color'] = 'atom';

Expand Down
6 changes: 5 additions & 1 deletion src/icn3dui/html/set_html.js
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,11 @@ iCn3DUI.prototype.setMenu4 = function() { var me = this;
html += me.getRadio('mn4_clr', 'mn4_clrBfactorNorm', 'Percentile');
html += " </ul>";

if(me.cfg.align !== undefined || me.cfg.blast_rep_id !== undefined) {
if(me.cfg.align !== undefined) {
html += me.getRadio('mn4_clr', 'mn4_clrIdentity', 'Identity', true);
html += me.getRadio('mn4_clr', 'mn4_clrConserved', 'Conservation');
}
else if(me.cfg.blast_rep_id !== undefined) {
html += me.getRadio('mn4_clr', 'mn4_clrIdentity', 'Identity');
html += me.getRadio('mn4_clr', 'mn4_clrConserved', 'Conservation', true);
}
Expand Down
3 changes: 1 addition & 2 deletions src/icn3dui/parsers/mmcif_mmdb_parser_align.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,7 @@ iCn3DUI.prototype.setSeqAlign = function (seqalign, alignedStructures) { var me
me.consHash2[chainid2 + '_' + resi] = 1;
}
else {
//color = '#0000FF';
color = '#00FF00';
color = '#0000FF';
classname = 'icn3d-ncons';

me.nconsHash1[chainid1 + '_' + id2aligninfo[j].resi] = 1;
Expand Down

0 comments on commit d3c4ad2

Please sign in to comment.