X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fmc_view%2FPDBChain.java;h=6d02630f118091f70858ccbfee74b61ae503a965;hb=c59abae32801dce40b900ad3129567e5ef5fac4f;hp=72d276effc349e5481f556ef21ae66fc5eeda635;hpb=57738a1f3c19b1c3a00bd3ac5108f8cd0af32f99;p=jalview.git diff --git a/src/mc_view/PDBChain.java b/src/mc_view/PDBChain.java index 72d276e..6d02630 100755 --- a/src/mc_view/PDBChain.java +++ b/src/mc_view/PDBChain.java @@ -20,24 +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.Locale; -import java.util.Vector; - public class PDBChain { public static final String RESNUM_FEATURE = "RESNUM"; @@ -79,17 +81,16 @@ public class PDBChain public String pdbid = ""; - String tfacName = "Temperature Factor"; + AnnotationRowBuilder tfacTemplate = new AnnotationRowBuilder( + "Temperature Factor"); public PDBChain(String thePdbid, String theId, - String tempFactorColumnName) + AnnotationRowBuilder template) { - this.pdbid = thePdbid == null ? thePdbid - : thePdbid.toLowerCase(Locale.ROOT); - this.id = theId; - if (tempFactorColumnName != null && tempFactorColumnName.length() > 0) + this(thePdbid, theId); + if (template != null) { - tfacName = tempFactorColumnName; + tfacTemplate = template; } } @@ -102,7 +103,9 @@ public class PDBChain */ public PDBChain(String thePdbid, String theId) { - this(thePdbid, theId, null); + this.pdbid = thePdbid == null ? thePdbid + : thePdbid.toLowerCase(Locale.ROOT); + this.id = theId; } /** @@ -516,14 +519,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); } - AlignmentAnnotation tfactorann = new AlignmentAnnotation(tfacName, - tfacName + " for " + pdbid + id, annots, min, max, - AlignmentAnnotation.LINE_GRAPH); + if (tfacTemplate.isHasMinMax()) + { + max = tfacTemplate.getMax(); + min = tfacTemplate.getMin(); + } + AlignmentAnnotation tfactorann = new AlignmentAnnotation( + 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); @@ -653,10 +666,16 @@ public class PDBChain ana.getCalcId(), ana.label, ana.description); if (transfer == null || transfer.size() == 0) { + ContactMatrixI cm = shadow.getContactMatrixFor(ana); ana = new AlignmentAnnotation(ana); + // TODO map contact matrix under mapping ana.liftOver(sequence, shadowMap); ana.liftOver(dsq, sqmpping); dsq.addAlignmentAnnotation(ana); + if (cm != null) + { + dsq.addContactListFor(ana, cm); + } } else { @@ -677,10 +696,14 @@ public class PDBChain ana.description); if (transfer == null || transfer.size() == 0) { + ContactMatrixI cm = sequence.getContactMatrixFor(ana); ana = new AlignmentAnnotation(ana); ana.liftOver(dsq, sqmpping); dsq.addAlignmentAnnotation(ana); - // mapping.transfer(ana); + if (cm != null) + { + dsq.addContactListFor(ana, cm); + } } else { @@ -694,8 +717,8 @@ public class PDBChain // Useful for debugging mappings - adds annotation for mapped position float min = -1, max = 0; Annotation[] an = new Annotation[sq.getEnd() - sq.getStart() + 1]; - for (int i = sq.getStart(), j = sq - .getEnd(), k = 0; i <= j; i++, k++) + for (int i = sq.getStart(), j = sq.getEnd(), + k = 0; i <= j; i++, k++) { int prn = mapping.getPDBResNum(k + 1);