--- /dev/null
+package jalview.datamodel.annotations.AnnotationRowBuilder;
+
+import jalview.datamodel.Annotation;
+
+public class AlphaFoldAnnotationRowBuilder extends AnnotationRowBuilder
+{
+ public AlphaFoldAnnotationRowBuilder()
+ {
+ super("Alphafold Reliability");
+ min = 0;
+ max = 100;
+ hasMinMax = true;
+ }
+
+ @Override
+ public void processAnnotation(Annotation annotation)
+ {
+ if (annotation.value > 90)
+ {
+ // Very High
+ annotation.colour = new java.awt.Color(0, 83, 214);
+ }
+ if (annotation.value <= 90)
+ {
+ // High
+ annotation.colour = new java.awt.Color(101, 203, 243);
+ }
+ if (annotation.value <= 70)
+ {
+ // Confident
+ annotation.colour = new java.awt.Color(255, 219, 19);
+ }
+ if (annotation.value < 50)
+ {
+ annotation.colour = new java.awt.Color(255, 125, 69);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+package jalview.datamodel.annotations.AnnotationRowBuilder;
+
+import jalview.datamodel.Annotation;
+
+public class AnnotationRowBuilder
+{
+
+ String name;
+
+ boolean hasDescription = false;
+
+ String description;
+
+ boolean hasMinMax = false;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public boolean isHasDescription()
+ {
+ return hasDescription;
+ }
+
+ public void setHasDescription(boolean hasDescription)
+ {
+ this.hasDescription = hasDescription;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public boolean isHasMinMax()
+ {
+ return hasMinMax;
+ }
+
+ public void setHasMinMax(boolean hasMinMax)
+ {
+ this.hasMinMax = hasMinMax;
+ }
+
+ public float getMin()
+ {
+ return min;
+ }
+
+ public void setMin(float min)
+ {
+ this.min = min;
+ }
+
+ public float getMax()
+ {
+ return max;
+ }
+
+ public void setMax(float max)
+ {
+ this.max = max;
+ }
+
+ float min, max;
+
+ public AnnotationRowBuilder(String string)
+ {
+ name = string;
+ }
+
+ public AnnotationRowBuilder(String name, float min, float max)
+ {
+ this(name);
+ this.min = min;
+ this.max = max;
+ this.hasMinMax = true;
+ }
+
+ /**
+ * override this to apply some form of transformation to the annotation - eg a
+ * colourscheme
+ *
+ * @param annotation
+ */
+ public void processAnnotation(Annotation annotation)
+ {
+
+ }
+}
*/
package jalview.ext.jmol;
-import java.util.Locale;
-
-import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.Annotation;
-import jalview.datamodel.PDBEntry;
-import jalview.datamodel.SequenceI;
-import jalview.io.DataSourceType;
-import jalview.io.FileParse;
-import jalview.io.StructureFile;
-import jalview.schemes.ResidueProperties;
-import jalview.util.Format;
-import jalview.util.MessageManager;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Vector;
import com.stevesoft.pat.Regex;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.datamodel.annotations.AnnotationRowBuilder.AlphaFoldAnnotationRowBuilder;
+import jalview.datamodel.annotations.AnnotationRowBuilder.AnnotationRowBuilder;
+import jalview.io.DataSourceType;
+import jalview.io.FileParse;
+import jalview.io.StructureFile;
+import jalview.schemes.ResidueProperties;
+import jalview.util.Format;
+import jalview.util.MessageManager;
import mc_view.Atom;
import mc_view.PDBChain;
import mc_view.Residue;
}
else
{
+ AnnotationRowBuilder builder = null;
String tempFString = null;
if (isAlphafoldModel())
{
- tempFString = "Alphafold Reliability";
+ builder = new AlphaFoldAnnotationRowBuilder();
}
- tmpchain = new PDBChain(getId(), tmpatom.chain, tempFString);
+ tmpchain = new PDBChain(getId(), tmpatom.chain, builder);
getChains().add(tmpchain);
tmpchain.atoms.addElement(tmpatom);
}
*/
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.Sequence;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
+import jalview.datamodel.annotations.AnnotationRowBuilder.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";
public String pdbid = "";
- String tfacName = "Temperature Factor";
+ AnnotationRowBuilder tfacTemplate = new AnnotationRowBuilder(
+ "TemperatureFactor");
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;
}
}
*/
public PDBChain(String thePdbid, String theId)
{
- this(thePdbid, theId, null);
+ this.pdbid = thePdbid == null ? thePdbid
+ : thePdbid.toLowerCase(Locale.ROOT);
+ this.id = theId;
}
/**
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.setCalcId(getClass().getName());
tfactorann.setSequenceRef(sequence);
// 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);