label.memory_example_tooltip = The memory allocated to Jalview is the smaller of the percentage of physical memory (default 90%) and the maximum absolute memory (default 32GB). If your computer's memory cannot be ascertained then the maximum absolute memory defaults to 8GB (if not customised).<br>Jalview will always try and reserve 512MB for the OS and at least 512MB for itself.
warning.wrong_jvm_version_title = Wrong Java Version
warning.wrong_jvm_version_message = The Java version being used (Java {0}) may lead to problems.\nThis installation of Jalview should be used with Java {1}.
+label.alphafold_reliability = Alphafold Reliability
label.memory_example_tooltip = La memoria asignada a Jalview es el menor entre el porcentaje de memoria física (predeterminado 90%) y la memoria absoluta máxima (predeterminado 32 GB). Si no se puede determinar la memoria de su computadora, la memoria absoluta máxima predeterminada es de 8 GB (si no está personalizada).<br>Jalview siempre intentará reservar 512 MB para el sistema operativo y al menos 512 MB para sí mismo.
warning.wrong_jvm_version_title = Versión incorrecta de Java
warning.wrong_jvm_version_message = La versión de Java que se está utilizando (Java {0}) puede generar problemas.\nEsta instalación de Jalview debe usarse con Java {1}.
-
+label.alphafold_reliability = Fiabilidad Alphafold
// TODO use Character.toLowerCase to avoid creating String objects?
char[] upstream = new String(ds
.getSequence(s.getStart() - 1 - ustream_ds, s.getStart() - 1))
- .toLowerCase(Locale.ROOT).toCharArray();
+ .toLowerCase(Locale.ROOT).toCharArray();
char[] downstream = new String(
ds.getSequence(s_end - 1, s_end + dstream_ds))
- .toLowerCase(Locale.ROOT).toCharArray();
+ .toLowerCase(Locale.ROOT).toCharArray();
char[] coreseq = s.getSequence();
char[] nseq = new char[offset + upstream.length + downstream.length
+ coreseq.length];
}
}
+ public static AlignmentAnnotation getFirstSequenceAnnotationOfType(
+ AlignmentI al, int graphType)
+ {
+ AlignmentAnnotation[] anns = al.getAlignmentAnnotation();
+ if (anns != null)
+ {
+ for (AlignmentAnnotation aa : anns)
+ {
+ if (aa.sequenceRef != null && aa.graph == graphType)
+ return aa;
+ }
+ }
+ return null;
+ }
+
/**
* Returns true if either sequence has a cross-reference to the other
*
ANNOTATION2, DISPLAY, GUI, NEWS, NOQUESTIONNAIRE, SORTBYTREE,
USAGESTATS, OPEN, OPEN2, PROPS, QUESTIONNAIRE, SETPROP, TREE, VDOC,
VSESS, OUTPUT, OUTPUTTYPE, SSANNOTATION, NOTEMPFAC, TEMPFAC,
- TEMPFAC_LABEL, TEMPFAC_DESC, TEMPFAC_SHADING, TITLE;
+ TEMPFAC_LABEL, TEMPFAC_DESC, TEMPFAC_SHADING, TITLE, PAEMATRIX, WRAP;
static
{
TEMPFAC_DESC.setOptions(Opt.STRING, Opt.LINKED);
TEMPFAC_SHADING.setOptions(Opt.STRING, Opt.LINKED);
TITLE.setOptions(Opt.STRING, Opt.LINKED);
+ PAEMATRIX.setOptions(Opt.STRING, Opt.LINKED);
+ WRAP.setOptions(Opt.BOOLEAN, Opt.LINKED);
}
private final String[] argNames;
package jalview.bin;
import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
import java.util.Map;
import jalview.analysis.AlignmentUtils;
import jalview.bin.ArgParser.Arg;
import jalview.bin.ArgParser.ArgValues;
+import jalview.datamodel.AlignmentAnnotation;
import jalview.gui.AlignFrame;
import jalview.gui.Desktop;
import jalview.io.AppletFormatAdapter;
import jalview.util.HttpUtils;
import jalview.util.MessageManager;
import jalview.util.Platform;
+import jalview.ws.dbsources.EBIAlfaFold;
public class Commands
{
protected void processLinked(String id)
{
Map<Arg, ArgValues> m = argParser.linkedArgs(id);
- FileLoader fileLoader = new FileLoader(!headless);
/*
// script to execute after all loading is completed one way or another
{
if (openFile == null)
continue OPEN;
- Console.debug("********** id = " + id + ", openFile = " + openFile);
if (first)
{
af = afMap.get(id);
if (af == null)
{
+ // get kind of temperature factor annotation
+ AlignmentAnnotation.TFType tempfacType = null;
+ if ((m.get(Arg.NOTEMPFAC) == null
+ || !m.get(Arg.NOTEMPFAC).getBoolean())
+ && m.get(Arg.TEMPFAC) != null)
+ {
+ try
+ {
+ tempfacType = AlignmentAnnotation.TFType
+ .valueOf(m.get(Arg.TEMPFAC).getValue()
+ .toUpperCase(Locale.ROOT));
+ Console.debug("Obtained Temperature Factor type of '"
+ + tempfacType + "'");
+ } catch (IllegalArgumentException e)
+ {
+ StringBuilder sb = new StringBuilder().append("Cannot set --")
+ .append(Arg.TEMPFAC.getName()).append(" to '")
+ .append(tempfacType)
+ .append("', ignoring. Valid values are: ");
+ Iterator<AlignmentAnnotation.TFType> it = Arrays
+ .stream(AlignmentAnnotation.TFType.values())
+ .iterator();
+ while (it.hasNext())
+ {
+ sb.append(it.next().toString().toLowerCase(Locale.ROOT));
+ if (it.hasNext())
+ sb.append(", ");
+ }
+ Console.warn(sb.toString());
+ }
+ }
+
Console.debug(
"Opening '" + openFile + "' in new alignment frame");
- af = fileLoader.LoadFileWaitTillLoaded(openFile, protocol,
- format);
+ FileLoader fileLoader = new FileLoader(!headless);
+ af = fileLoader.LoadFileWaitTillLoaded(openFile, protocol, format,
+ tempfacType);
+
+ // wrap alignment?
+ if (m.get(Arg.WRAP) != null && m.get(Arg.WRAP).getBoolean())
+ {
+ af.getCurrentView().setWrapAlignment(true);
+ }
+
+ // change alignment frame title
if (m.get(Arg.TITLE) != null)
af.setTitle(m.get(Arg.TITLE).getValue());
+
+ // show secondary structure annotations?
if (m.get(Arg.SSANNOTATION) != null
&& !m.get(Arg.SSANNOTATION).getBoolean())
{
Collections.singleton("Secondary Structure"), null,
false, false);
}
+
+ // show temperature factor annotations?
if (m.get(Arg.NOTEMPFAC) != null
&& m.get(Arg.NOTEMPFAC).getBoolean())
{
// do this better (annotation types?)
+ List<String> hideThese = new ArrayList<>();
+ hideThese.add("Temperature Factor");
+ hideThese.add(MessageManager
+ .getString("label.alphafold_reliability"));
AlignmentUtils.showOrHideSequenceAnnotations(
- af.getCurrentView().getAlignment(),
- Collections.singleton("Temperature Factor"), null,
- false, false);
- AlignmentUtils.showOrHideSequenceAnnotations(
- af.getCurrentView().getAlignment(),
- Collections.singleton("Alphafold Reliability"), null,
+ af.getCurrentView().getAlignment(), hideThese, null,
false, false);
}
+ else
+ {
+ if (m.get(Arg.TEMPFAC_LABEL) != null)
+ {
+ AlignmentAnnotation aa = AlignmentUtils
+ .getFirstSequenceAnnotationOfType(
+ af.getCurrentView().getAlignment(),
+ AlignmentAnnotation.LINE_GRAPH);
+ Console.debug("***** Trying to change label from '"
+ + (aa == null ? aa : aa.label) + "' to '"
+ + m.get(Arg.TEMPFAC_LABEL).getValue() + "'");
+ if (aa != null)
+ {
+ aa.label = m.get(Arg.TEMPFAC_LABEL).getValue();
+ }
+ }
+ }
+
+ //
+
+ // load a pAE file?
+ if (m.get(Arg.PAEMATRIX) != null)
+ {
+ File paeFile = new File(m.get(Arg.PAEMATRIX).getValue());
+ EBIAlfaFold.addAlphaFoldPAE(af.getCurrentView().getAlignment(),
+ paeFile);
+ }
// store the AlignFrame for this id
afMap.put(id, af);
*/
public class AlignmentAnnotation
{
+
private static final String ANNOTATION_ID_PREFIX = "ann";
/*
*/
private long invalidrnastruc = -2;
+ public static enum TFType
+ {
+ DEFAULT, PLDDT, DOSE;
+ }
+
+ /**
+ * the type of temperature factor plot (if it is one)
+ */
+ private TFType tfType = TFType.DEFAULT;
+
+ public void setTFType(TFType t)
+ {
+ tfType = t;
+ }
+
+ public TFType getTFType()
+ {
+ return tfType;
+ }
+
/**
* Updates the _rnasecstr field Determines the positions that base pair and
* the positions of helices based on secondary structure from a Stockholm file
: annotations[index + offset].displayCharacter == null
|| annotations[index
+ offset].displayCharacter
- .length() == 0
- ? annotations[index
- + offset].secondaryStructure
- : annotations[index
- + offset].displayCharacter
- .charAt(0));
+ .length() == 0
+ ? annotations[index
+ + offset].secondaryStructure
+ : annotations[index
+ + offset].displayCharacter
+ .charAt(0));
}
@Override
package jalview.datamodel.annotations;
+import jalview.datamodel.AlignmentAnnotation.TFType;
import jalview.datamodel.Annotation;
+import jalview.util.MessageManager;
public class AlphaFoldAnnotationRowBuilder extends AnnotationRowBuilder
{
public AlphaFoldAnnotationRowBuilder()
{
- super("Alphafold Reliability");
+ super(MessageManager.getString("label.alphafold_reliability"));
min = 0;
max = 100;
hasMinMax = true;
+ this.setTFType(TFType.PLDDT);
}
@Override
package jalview.datamodel.annotations;
+import jalview.datamodel.AlignmentAnnotation.TFType;
import jalview.datamodel.Annotation;
public class AnnotationRowBuilder
boolean hasMinMax = false;
+ /**
+ * the type of temperature factor plot (if it is one)
+ */
+ private TFType tfType = TFType.DEFAULT;
+
+ public void setTFType(TFType t)
+ {
+ tfType = t;
+ }
+
+ public TFType getTFType()
+ {
+ return tfType;
+ }
+
public String getName()
{
return name;
name = string;
}
+ public AnnotationRowBuilder(String name, float min, float max, TFType tft)
+ {
+ this(name, min, max);
+ setTFType(tft);
+ }
+
public AnnotationRowBuilder(String name, float min, float max)
{
this(name);
import jalview.bin.Console;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentAnnotation.TFType;
import jalview.datamodel.Annotation;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
{
// BH 2018 File or String for filename
super(immediate, inFile, sourceType);
+
}
public JmolParser(Object inFile, DataSourceType sourceType)
throws IOException
{
- super(inFile, sourceType);
+ this(inFile, sourceType, null);
+ }
+
+ public JmolParser(Object inFile, DataSourceType sourceType,
+ AlignmentAnnotation.TFType tempfacType) throws IOException
+ {
+ super(inFile, sourceType, tempfacType);
}
public JmolParser(FileParse fp) throws IOException
{
AnnotationRowBuilder builder = null;
String tempFString = null;
- if (isAlphafoldModel())
+ if (isAlphafoldModel()
+ || this.getTemperatureFactorType() == AlignmentAnnotation.TFType.PLDDT)
{
builder = new AlphaFoldAnnotationRowBuilder();
}
import java.util.Vector;
import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentAnnotation.TFType;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceGroup;
private boolean dataClosed = false;
+ private AlignmentAnnotation.TFType temperatureFactorType = null;
+
+ public AlignmentAnnotation.TFType getTemperatureFactorType()
+ {
+ return this.temperatureFactorType;
+ }
+
/**
* @return if doParse() was called at construction time
*/
public AlignFile(Object dataObject, DataSourceType sourceType)
throws IOException
{
- this(true, dataObject, sourceType);
+ this(dataObject, sourceType, null);
+ }
+
+ public AlignFile(Object dataObject, DataSourceType sourceType,
+ AlignmentAnnotation.TFType tempfacType) throws IOException
+ {
+ this(true, dataObject, sourceType, tempfacType);
}
/**
public AlignFile(boolean parseImmediately, Object dataObject,
DataSourceType sourceType) throws IOException
{
+ this(parseImmediately, dataObject, sourceType, null);
+ }
+
+ public AlignFile(boolean parseImmediately, Object dataObject,
+ DataSourceType sourceType, AlignmentAnnotation.TFType tempfacType) throws IOException
+ {
// BH allows File or String
super(dataObject, sourceType);
initData();
+ this.temperatureFactorType = tempfacType;
if (parseImmediately)
{
doParse();
*/
package jalview.io;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
import java.util.Locale;
import jalview.api.AlignExportSettingsI;
import jalview.api.AlignmentViewPanel;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentAnnotation.TFType;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentView;
-import jalview.datamodel.SeqDistanceContactMatrix;
import jalview.datamodel.PDBEntry.Type;
import jalview.datamodel.SequenceI;
import jalview.ext.jmol.JmolParser;
import jalview.structure.StructureImportSettings;
import jalview.util.Platform;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-
/**
* A low level class for alignment and feature IO with alignment formatting
* methods used by both applet and application for generating flat alignment
DataSourceType sourceType, FileFormatI fileFormat)
throws IOException
{
+ return readFile(selectedFile, file, sourceType, fileFormat, null);
+ }
+
+ public AlignmentI readFile(File selectedFile, String file,
+ DataSourceType sourceType, FileFormatI fileFormat,
+ AlignmentAnnotation.TFType tempfacType) throws IOException
+ {
this.selectedFile = selectedFile;
if (selectedFile != null)
{
// needs a File option
alignFile = new JmolParser(
- selectedFile == null ? inFile : selectedFile, sourceType);
+ selectedFile == null ? inFile : selectedFile, sourceType,
+ tempfacType);
}
else
{
*/
package jalview.io;
-import java.util.Locale;
-
import java.awt.Color;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import jalview.api.FeaturesSourceI;
import jalview.bin.Cache;
import jalview.bin.Jalview;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentAnnotation.TFType;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.PDBEntry;
private File selectedFile;
+ private AlignmentAnnotation.TFType temperatureFactorType = null;
+
/**
* default constructor always raised errors in GUI dialog boxes
*/
public AlignFrame LoadFileWaitTillLoaded(String file,
DataSourceType sourceType, FileFormatI format)
{
+ return LoadFileWaitTillLoaded(file, sourceType, format, null);
+ }
+
+ /**
+ * Load alignment from (file, protocol) of type format with specified
+ * temperature factor type and wait till loaded
+ *
+ * @param file
+ * @param sourceType
+ * @param format
+ * @param tempfacType
+ * @return alignFrame constructed from file contents
+ */
+ public AlignFrame LoadFileWaitTillLoaded(String file,
+ DataSourceType sourceType, FileFormatI format, AlignmentAnnotation.TFType tempfacType)
+ {
this.file = file;
this.protocol = sourceType;
this.format = format;
+ this.temperatureFactorType = tempfacType;
return _LoadFileWaitTillLoaded();
}
? "Copied From Clipboard"
: file;
Runtime rt = Runtime.getRuntime();
+
try
{
if (Desktop.instance != null)
{
if (selectedFile == null)
{
- al = fa.readFile(file, protocol, format);
+ al = fa.readFile(null, file, protocol, format,
+ temperatureFactorType);
}
else
{
- al = fa.readFile(selectedFile, protocol, format);
+ al = fa.readFile(selectedFile, null, protocol, format,
+ temperatureFactorType);
}
source = fa.getAlignFile(); // keep reference for later if
*/
package jalview.io;
+import java.io.File;
+import java.io.IOException;
import java.util.Locale;
import jalview.api.AlignExportSettingsI;
import jalview.bin.Cache;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentAnnotation.TFType;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceI;
import jalview.util.Comparison;
-import java.io.File;
-import java.io.IOException;
-
/**
* Additional formatting methods used by the application in a number of places.
*
}
@Override
+ public AlignmentI readFile(File selectedFile, String file,
+ DataSourceType sourceType, FileFormatI fileFormat,
+ AlignmentAnnotation.TFType tempfacType) throws IOException
+ {
+ AlignmentI al = super.readFile(selectedFile, file, sourceType,
+ fileFormat, tempfacType);
+ return al;
+ }
+
+ @Override
public AlignmentI readFile(String file, DataSourceType sourceType,
FileFormatI fileFormat) throws IOException
{
*/
package jalview.io;
+import java.awt.Color;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.List;
+import java.util.Vector;
+
import jalview.analysis.AlignSeq;
import jalview.api.FeatureSettingsModelI;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentAnnotation.TFType;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.DBRefSource;
import jalview.datamodel.PDBEntry.Type;
import jalview.datamodel.SequenceI;
import jalview.structure.StructureImportSettings;
-
-import java.awt.Color;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.util.List;
-import java.util.Vector;
-
import mc_view.PDBChain;
public abstract class StructureFile extends AlignFile
public StructureFile(Object inFile, DataSourceType sourceType)
throws IOException
{
- super(inFile, sourceType);
+ this(inFile, sourceType, null);
+ }
+
+ public StructureFile(Object inFile, DataSourceType sourceType,
+ AlignmentAnnotation.TFType tempfacType) throws IOException
+ {
+ super(inFile, sourceType, tempfacType);
}
public StructureFile(FileParse fp) throws IOException
@SuppressWarnings("unchecked")
public PAEContactMatrix(SequenceI _refSeq, Map<String, Object> pae_obj)
- throws Exception
{
refSeq = _refSeq;
while (refSeq.getDatasetSequence() != null)
public String getAnnotLabel()
{
return "pAE Matrix";
-
}
}
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import org.json.simple.parser.ParseException;
+
import com.stevesoft.pat.Regex;
import jalview.api.FeatureSettingsModelI;
* @param retrievalUrl
* - URL of .mmcif from EBI-AlphaFold - will be used to generate the
* pAE URL automatically
+ * @throws IOException
* @throws Exception
*/
public static void retrieve_AlphaFold_pAE(String id,
- AlignmentI pdbAlignment, String retrievalUrl) throws Exception
+ AlignmentI pdbAlignment, String retrievalUrl) throws IOException
{
// import PAE as contact matrix - assume this will work if there was a
// model
- File pae = File.createTempFile(id, "pae_json");
String paeURL = getAlphaFoldPaeDownloadUrl(id, AF_VERSION);
if (retrievalUrl != null)
paeURL = retrievalUrl.replace("model", "predicted_aligned_error")
.replace(".cif", ".json");
}
+
+ File pae = null;
+ try
+ {
+ pae = File.createTempFile(id == null ? "af_pae" : id, "pae_json");
+ } catch (IOException e)
+ {
+ e.printStackTrace();
+ }
Console.debug("Downloading pae from " + paeURL + " to " + pae.toString()
+ "");
+ UrlDownloadClient.download(paeURL, pae);
+ addAlphaFoldPAE(pdbAlignment, pae);
+ }
+ public static void addAlphaFoldPAE(AlignmentI pdbAlignment, File pae)
+ {
+ FileInputStream pae_input = null;
try
{
- UrlDownloadClient.download(paeURL, pae);
- FileInputStream pae_input = new FileInputStream(pae);
+ pae_input = new FileInputStream(pae);
+ } catch (FileNotFoundException e)
+ {
+ Console.error(
+ "Could not find pAE file '" + pae.getAbsolutePath() + "'", e);
+ }
+ try
+ {
if (!importPaeJSONAsContactMatrix(pdbAlignment, pae_input))
{
- Console.warn("Couln't import contact matrix from " + paeURL
- + " (stored in " + pae.toString() + ")");
+ Console.warn("Could not import contact matrix from '"
+ + pae.getAbsolutePath() + "'");
}
- } catch (Exception pae_ex)
+ } catch (IOException e1)
+ {
+ Console.error("Error when importing pAE file '"
+ + pae.getAbsolutePath() + "'", e1);
+ } catch (ParseException e2)
{
- Console.error("Couldn't download PAE", pae_ex);
+ Console.error(
+ "Error when parsing pAE file '" + pae.getAbsolutePath() + "'",
+ e2);
}
}
* @param pdbAlignment
* @param pae_input
* @return true if there was a pAE matrix added
+ * @throws ParseException
+ * @throws IOException
* @throws Exception
*/
public static boolean importPaeJSONAsContactMatrix(
- AlignmentI pdbAlignment, InputStream pae_input) throws Exception
+ AlignmentI pdbAlignment, InputStream pae_input)
+ throws IOException, ParseException
{
List<Object> pae_obj = (List<Object>) Platform.parseJSON(pae_input);
? tfacTemplate.getDescription()
: tfacTemplate.getName()) + " for " + pdbid + id,
annots, min, max, AlignmentAnnotation.LINE_GRAPH);
+ tfactorann.setTFType(tfacTemplate.getTFType());
tfactorann.setCalcId(getClass().getName());
tfactorann.setSequenceRef(sequence);
*/
package mc_view;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
+
+import jalview.bin.Console;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.DBRefSource;
import jalview.datamodel.SequenceI;
import jalview.io.StructureFile;
import jalview.util.MessageManager;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Vector;
-
public class PDBfile extends StructureFile
{
private static String CALC_ID_PREFIX = "JalviewPDB";
DataSourceType sourceType) throws IOException
{
super(false, dataObject, sourceType);
+ Console.debug("***** PDBfile constructor");
addSettings(addAlignmentAnnotations, predictSecStr, externalSecStr);
+ Console.debug("***** About to doParse() 1");
doParse();
}
{
super(false, source);
addSettings(addAlignmentAnnotations, predictSecStr, externalSecStr);
+ Console.debug("***** About to doParse() 2");
doParse();
}