X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmc_view%2FPDBChain.java;h=2970ccf05e136b2b3a04a9d5f2a19e62c7b8ae55;hb=fa25baa61ac89d1bba5eccf6fe3df85928191706;hp=425bc18a23df197c10ad443d35c8c947245697f9;hpb=57381bb294ebc639073c198d14b03e16ca6aff97;p=jalview.git diff --git a/src/mc_view/PDBChain.java b/src/mc_view/PDBChain.java index 425bc18..2970ccf 100755 --- a/src/mc_view/PDBChain.java +++ b/src/mc_view/PDBChain.java @@ -20,22 +20,26 @@ */ package mc_view; +import java.awt.Color; +import java.util.List; +import java.util.Locale; +import java.util.Vector; + import jalview.analysis.AlignSeq; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.Annotation; +import jalview.datamodel.ContactMatrixI; import jalview.datamodel.Mapping; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; +import jalview.datamodel.annotations.AnnotationRowBuilder; import jalview.schemes.ColourSchemeI; import jalview.schemes.ResidueProperties; import jalview.structure.StructureImportSettings; import jalview.structure.StructureMapping; import jalview.util.Comparison; - -import java.awt.Color; -import java.util.List; -import java.util.Vector; +import jalview.ws.datamodel.MappableContactMatrixI; public class PDBChain { @@ -78,27 +82,31 @@ public class PDBChain public String pdbid = ""; - String tfacName = "Temperature Factor"; + AnnotationRowBuilder tfacTemplate = new AnnotationRowBuilder( + "Temperature Factor"); - - public PDBChain(String thePdbid, String theId, String tempFactorColumnName) + public PDBChain(String thePdbid, String theId, + AnnotationRowBuilder template) { - this.pdbid = thePdbid == null ? thePdbid : thePdbid.toLowerCase(); - this.id = theId; - if (tempFactorColumnName!=null && tempFactorColumnName.length()>0) + this(thePdbid, theId); + if (template != null) { - tfacName = tempFactorColumnName; + tfacTemplate = template; } } /** - * import chain data assuming Temperature Factor is in the Temperature Factor column + * import chain data assuming Temperature Factor is in the Temperature Factor + * column + * * @param thePdbid * @param theId */ public PDBChain(String thePdbid, String theId) { - this(thePdbid,theId, null); + this.pdbid = thePdbid == null ? thePdbid + : thePdbid.toLowerCase(Locale.ROOT); + this.id = theId; } /** @@ -210,8 +218,8 @@ public class PDBChain } char seqchar = ds.getCharAt(seqpos - ds.getStart()); - boolean sameResidue = Comparison.isSameResidue( - seqchar, strchar, false); + boolean sameResidue = Comparison.isSameResidue(seqchar, strchar, + false); if (sameResidue) { for (Atom atom : res.atoms) @@ -230,12 +238,14 @@ public class PDBChain * @param status * The Status of the transferred annotation * - * @param altPDBID the group id for the features on the destination sequence (e.g. the official accession ID) + * @param altPDBID + * the group id for the features on the destination sequence (e.g. + * the official accession ID) */ - public void transferRESNUMFeatures(SequenceI seq, - String status, String altPDBID) + public void transferRESNUMFeatures(SequenceI seq, String status, + String altPDBID) { - if (altPDBID==null) + if (altPDBID == null) { altPDBID = pdbid; } @@ -266,8 +276,9 @@ public class PDBChain if (feature.getFeatureGroup() != null && feature.getFeatureGroup().equals(pdbid)) { - int newBegin = 1 + residues.elementAt(feature.getBegin() - offset).atoms - .elementAt(0).alignmentMapping; + int newBegin = 1 + + residues.elementAt(feature.getBegin() - offset).atoms + .elementAt(0).alignmentMapping; int newEnd = 1 + residues.elementAt(feature.getEnd() - offset).atoms .elementAt(0).alignmentMapping; SequenceFeature tx = new SequenceFeature(feature, newBegin, newEnd, @@ -416,8 +427,8 @@ public class PDBChain { String desc = currAtom.resName + ":" + currAtom.resNumIns + " " + pdbid + id; - SequenceFeature sf = new SequenceFeature("INSERTION", desc, offset - + count - 1, offset + count - 1, "PDB_INS"); + SequenceFeature sf = new SequenceFeature("INSERTION", desc, + offset + count - 1, offset + count - 1, "PDB_INS"); resFeatures.addElement(sf); residues.lastElement().atoms.addAll(resAtoms); } @@ -429,8 +440,8 @@ public class PDBChain Residue tmpres = residues.lastElement(); Atom tmpat = tmpres.atoms.get(0); // Make A new SequenceFeature for the current residue numbering - String desc = tmpat.resName - + ":" + tmpat.resNumIns + " " + pdbid + id; + String desc = tmpat.resName + ":" + tmpat.resNumIns + " " + pdbid + + id; SequenceFeature sf = new SequenceFeature(RESNUM_FEATURE, desc, offset + count, offset + count, pdbid); resFeatures.addElement(sf); @@ -509,14 +520,24 @@ public class PDBChain for (int i = 0; i < iSize; i++) { annots[i] = resAnnotation.elementAt(i); + tfacTemplate.processAnnotation(annots[i]); max = Math.max(max, annots[i].value); min = Math.min(min, annots[i].value); resAnnotation.setElementAt(null, i); } + if (tfacTemplate.isHasMinMax()) + { + max = tfacTemplate.getMax(); + min = tfacTemplate.getMin(); + } + AlignmentAnnotation tfactorann = new AlignmentAnnotation( - tfacName, tfacName + " for " + pdbid + id, + tfacTemplate.getName(), + (tfacTemplate.isHasDescription() + ? tfacTemplate.getDescription() + : tfacTemplate.getName()) + " for " + pdbid + id, annots, min, max, AlignmentAnnotation.LINE_GRAPH); - + tfactorann.setTFType(tfacTemplate.getTFType()); tfactorann.setCalcId(getClass().getName()); tfactorann.setSequenceRef(sequence); @@ -524,7 +545,6 @@ public class PDBChain } } - /** * Colour start/end of bonds by charge *