X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2FMCview%2FPDBChain.java;h=30712f2228f98d9dcf1e610d5dfa232b03e5f44b;hb=a96d51f58325f8429c5792ae554243de5628d62a;hp=dc3743e1bbf538fb868d2018971452b5d88a5072;hpb=dd74fc4938723fe5ec48d4e5fdcfbe58ac42a48d;p=jalview.git diff --git a/src/MCview/PDBChain.java b/src/MCview/PDBChain.java index dc3743e..30712f2 100755 --- a/src/MCview/PDBChain.java +++ b/src/MCview/PDBChain.java @@ -25,6 +25,7 @@ import java.awt.*; import jalview.analysis.*; import jalview.datamodel.*; import jalview.schemes.*; +import jalview.structure.StructureMapping; public class PDBChain { @@ -65,7 +66,7 @@ public class PDBChain return tmp; } - void makeExactMapping(AlignSeq as, Sequence s1) + public void makeExactMapping(AlignSeq as, SequenceI s1) { int pdbpos = as.getSeq2Start() - 2; int alignpos = s1.getStart() + as.getSeq1Start() - 3; @@ -94,7 +95,6 @@ public class PDBChain } } } - /** * copy over the RESNUM seqfeatures from the internal chain sequence to the mapped sequence * @param seq @@ -104,13 +104,13 @@ public class PDBChain public SequenceFeature[] transferRESNUMFeatures(SequenceI seq, String status) { SequenceI sq = seq; - while (sq != null) + while (sq!=null && sq.getDatasetSequence()!=null) { + sq = sq.getDatasetSequence(); if (sq == sequence) { return null; } - sq = sq.getDatasetSequence(); } /** * Remove any existing features for this chain if they exist ? @@ -126,7 +126,7 @@ public class PDBChain SequenceFeature[] features = sequence.getSequenceFeatures(); for (int i = 0; i < features.length; i++) { - if (features[i].getFeatureGroup().equals(PDBChain.PDBFILEFEATURE)) + if (features[i].getFeatureGroup().equals(pdbid)) { SequenceFeature tx = new SequenceFeature(features[i]); tx.setBegin(1 + @@ -138,7 +138,8 @@ public class PDBChain tx.setStatus(status + ( (tx.getStatus() == null || tx.getStatus().length() == 0) ? "" : ":" + tx.getStatus())); - seq.addSequenceFeature(tx); + if (tx.begin!=0 && tx.end!=0) + sq.addSequenceFeature(tx); } } return features; @@ -188,6 +189,7 @@ public class PDBChain int count = 0; StringBuffer seq = new StringBuffer(); Vector resFeatures = new Vector(); + Vector resAnnotation = new Vector(); int i, iSize = atoms.size() - 1; int resNumber = -1; for (i = 0; i <= iSize; i++) @@ -233,8 +235,11 @@ public class PDBChain tmpat.resName + ":" + tmpat.resNumIns + " " + pdbid + id, "", offset + count, offset + count, - MCview.PDBChain.PDBFILEFEATURE); + pdbid); + + //MCview.PDBChain.PDBFILEFEATURE); resFeatures.addElement(sf); + resAnnotation.addElement(new Annotation(tmpat.tfactor)); // Keep totting up the sequence if (ResidueProperties.getAA3Hash().get(tmpat.resName) == null) { @@ -252,9 +257,9 @@ public class PDBChain count++; } - if (id.length() < 1 || id.equals(" ")) + if (id.length() < 1) { - id = "_"; + id = " "; } sequence = new Sequence(id, seq.toString(), offset, resNumber - 1); // Note: resNumber-offset ~= seq.size() @@ -265,6 +270,19 @@ public class PDBChain sequence.addSequenceFeature( (SequenceFeature) resFeatures.elementAt(i)); resFeatures.setElementAt(null, i); } + Annotation[] annots = new Annotation[resAnnotation.size()]; + float max=0; + for (i=0,iSize=annots.length; imax) + max = annots[i].value; + resAnnotation.setElementAt(null, i); + } + AlignmentAnnotation tfactorann = new AlignmentAnnotation("PDB.CATempFactor","CA Temperature Factor for "+sequence.getName(), + annots, 0, max, AlignmentAnnotation.LINE_GRAPH); + tfactorann.setSequenceRef(sequence); + sequence.addAlignmentAnnotation(tfactorann); } public void setChargeColours() @@ -359,4 +377,51 @@ public class PDBChain tmp.endCol = col; } } + + public AlignmentAnnotation[] transferResidueAnnotation(SequenceI seq, String status) + { + AlignmentAnnotation[] transferred = null; + + return transferred; + + } + + /** + * copy any sequence annotation onto the sequence mapped using the provided StructureMapping + * @param mapping + */ + public void transferResidueAnnotation(StructureMapping mapping) + { + SequenceI sq = mapping.getSequence(); + if (sq!=null) + { + if (sequence!=null && sequence.getAnnotation()!=null) + { + + } + 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++) + { + int prn = mapping.getPDBResNum(k+1); + + an[k] = new Annotation((float)prn); + if (min==-1) + { + min=k; + max=k; + } else { + if (min>k) + { + min=k; + } else + if (max