import jalview.bin.ArgParser.ArgValues;
import jalview.bin.ArgParser.SubVal;
import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
import jalview.datamodel.SequenceI;
+import jalview.datamodel.annotations.AlphaFoldAnnotationRowBuilder;
import jalview.gui.AlignFrame;
import jalview.gui.AlignmentPanel;
import jalview.gui.Desktop;
import jalview.io.FileLoader;
import jalview.io.HtmlSvgOutput;
import jalview.io.IdentifyFile;
+import jalview.structure.StructureImportSettings;
+import jalview.structure.StructureImportSettings.TFType;
import jalview.util.HttpUtils;
import jalview.util.MessageManager;
import jalview.util.Platform;
*/
// get kind of temperature factor annotation
- AlignmentAnnotation.TFType tempfacType = null;
+ StructureImportSettings.TFType tempfacType = TFType.DEFAULT;
if ((!ArgParser.getBoolean(m, Arg.NOTEMPFAC))
&& ArgParser.getArgValues(m, Arg.TEMPFAC) != null)
{
try
{
- tempfacType = AlignmentAnnotation.TFType.valueOf(ArgParser
+ tempfacType = StructureImportSettings.TFType.valueOf(ArgParser
.getValue(m, Arg.TEMPFAC).toUpperCase(Locale.ROOT));
Console.debug("Obtained Temperature Factor type of '"
+ tempfacType + "'");
.append(Arg.TEMPFAC.getName()).append(" to '")
.append(tempfacType)
.append("', ignoring. Valid values are: ");
- Iterator<AlignmentAnnotation.TFType> it = Arrays
- .stream(AlignmentAnnotation.TFType.values())
+ Iterator<StructureImportSettings.TFType> it = Arrays
+ .stream(StructureImportSettings.TFType.values())
.iterator();
while (it.hasNext())
{
Console.debug(
"Opening '" + openFile + "' in new alignment frame");
FileLoader fileLoader = new FileLoader(!headless);
- af = fileLoader.LoadFileWaitTillLoaded(openFile, protocol, format,
- tempfacType);
+
+ StructureImportSettings.setTemperatureFactorType(tempfacType);
+
+ af = fileLoader.LoadFileWaitTillLoaded(openFile, protocol,
+ format);
// wrap alignment?
if (ArgParser.getBoolean(m, Arg.WRAP))
// do this better (annotation types?)
List<String> hideThese = new ArrayList<>();
hideThese.add("Temperature Factor");
- hideThese.add(MessageManager
- .getString("label.alphafold_reliability"));
+ hideThese.add(AlphaFoldAnnotationRowBuilder.LABEL);
AlignmentUtils.showOrHideSequenceAnnotations(
af.getCurrentView().getAlignment(), hideThese, null,
false, false);
{
SubVal subVal = ArgParser.getSubVal(val);
File paeFile = new File(subVal.content);
- EBIAlfaFold.addAlphaFoldPAE(af.getCurrentView().getAlignment(),
- paeFile, subVal.index,
- "id".equals(subVal.keyName) ? subVal.keyValue : null);
- // required to readjust the height and position of the pAE
- // annotation
+ if ("structid".equals(subVal.index))
+ {
+ EBIAlfaFold.addAlphaFoldPAEToStructure(
+ af.getCurrentView().getAlignment(), paeFile,
+ subVal.index, subVal.keyValue);
+ }
+ else
+ {
+ EBIAlfaFold.addAlphaFoldPAEToSequence(af.getCurrentView().getAlignment(),
+ paeFile, subVal.index,
+ "id".equals(subVal.keyName) ? subVal.keyValue : null);
+ // required to readjust the height and position of the pAE
+ // annotation
+ }
for (AlignmentViewPanel ap : af.getAlignPanels())
{
ap.adjustAnnotationHeight();
switch (type)
{
case "svg":
+ Console.debug("Outputting type '" + type + "' to " + fileName);
af.createSVG(file);
break;
case "png":
+ Console.debug("Outputting type '" + type + "' to " + fileName);
af.createPNG(file);
break;
case "html":
+ Console.debug("Outputting type '" + type + "' to " + fileName);
HtmlSvgOutput htmlSVG = new HtmlSvgOutput(af.alignPanel);
htmlSVG.exportHTML(fileName);
break;
+ default:
+ Console.warn("--image type '" + type + "' not known. Ignoring");
+ break;
}
}
}
private SequenceI getSpecifiedSequence(AlignFrame af, SubVal subId)
{
- SequenceI seq = null;
- SequenceI[] sequences = af.getCurrentView().getAlignment()
- .getSequencesArray();
- if (-1 < subId.index && subId.index < sequences.length)
+ AlignmentI al = af.getCurrentView().getAlignment();
+ if (-1 < subId.index && subId.index < al.getSequences().size())
{
- seq = sequences[subId.index];
+ return al.getSequenceAt(subId.index);
}
else if ("id".equals(subId.keyName))
{
- for (SequenceI s : sequences)
- {
- if (s.getDisplayId(false).equals(subId.keyValue))
- {
- seq = s;
- break;
- }
- }
+ return al.findName(subId.keyValue);
}
- return seq;
+ return null;
}
}
import jalview.analysis.Rna;
import jalview.analysis.SecStrConsensus.SimpleBP;
import jalview.analysis.WUSSParseException;
+import jalview.structure.StructureImportSettings;
/**
* DOCUMENT ME!
*/
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;
+ private StructureImportSettings.TFType tfType = StructureImportSettings.TFType.DEFAULT;
- public void setTFType(TFType t)
+ public void setTFType(StructureImportSettings.TFType t)
{
tfType = t;
}
- public TFType getTFType()
+ public StructureImportSettings.TFType getTFType()
{
return tfType;
}
package jalview.datamodel.annotations;
-import jalview.datamodel.AlignmentAnnotation.TFType;
import jalview.datamodel.Annotation;
-import jalview.util.MessageManager;
+import jalview.structure.StructureImportSettings;
+import jalview.structure.StructureImportSettings.TFType;
public class AlphaFoldAnnotationRowBuilder extends AnnotationRowBuilder
{
+ public static final String LABEL = "Alphafold Reliability";
+
public AlphaFoldAnnotationRowBuilder()
{
- super(MessageManager.getString("label.alphafold_reliability"));
+ super(LABEL);
min = 0;
max = 100;
hasMinMax = true;
- this.setTFType(TFType.PLDDT);
+ this.setTFType(StructureImportSettings.TFType.PLDDT);
}
@Override
package jalview.datamodel.annotations;
-import jalview.datamodel.AlignmentAnnotation.TFType;
import jalview.datamodel.Annotation;
+import jalview.structure.StructureImportSettings;
+import jalview.structure.StructureImportSettings.TFType;
public class AnnotationRowBuilder
{
/**
* the type of temperature factor plot (if it is one)
*/
- private TFType tfType = TFType.DEFAULT;
+ private StructureImportSettings.TFType tfType = StructureImportSettings.TFType.DEFAULT;
- public void setTFType(TFType t)
+ public void setTFType(StructureImportSettings.TFType t)
{
tfType = t;
}
- public TFType getTFType()
+ public StructureImportSettings.TFType getTFType()
{
return tfType;
}
name = string;
}
- public AnnotationRowBuilder(String name, float min, float max, TFType tft)
+ public AnnotationRowBuilder(String name, float min, float max, StructureImportSettings.TFType tft)
{
this(name, min, max);
setTFType(tft);
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;
import jalview.io.FileParse;
import jalview.io.StructureFile;
import jalview.schemes.ResidueProperties;
+import jalview.structure.StructureImportSettings;
import jalview.util.Format;
import jalview.util.MessageManager;
import jalview.ws.dbsources.EBIAlfaFold;
}
public JmolParser(Object inFile, DataSourceType sourceType,
- AlignmentAnnotation.TFType tempfacType) throws IOException
+ StructureImportSettings.TFType tempfacType) throws IOException
{
super(inFile, sourceType, tempfacType);
}
{
AnnotationRowBuilder builder = null;
String tempFString = null;
- if (isAlphafoldModel()
- || this.getTemperatureFactorType() == AlignmentAnnotation.TFType.PLDDT)
+ if (isAlphafoldModel() || this
+ .getTemperatureFactorType() == StructureImportSettings.TFType.PLDDT)
{
builder = new AlphaFoldAnnotationRowBuilder();
}
}
}
+ public void setAlphafoldModel(boolean afm)
+ {
+ alphaFoldModel = afm;
+ }
+
private boolean isAlphafoldModel()
{
return alphaFoldModel;
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(dataObject, sourceType, null);
- }
-
- public AlignFile(Object dataObject, DataSourceType sourceType,
- AlignmentAnnotation.TFType tempfacType) throws IOException
- {
- this(true, dataObject, sourceType, tempfacType);
+ this(true, dataObject, sourceType);
}
/**
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();
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.PDBEntry.Type;
import jalview.datamodel.SequenceI;
import jalview.ext.jmol.JmolParser;
import jalview.structure.StructureImportSettings;
+import jalview.structure.StructureImportSettings.TFType;
import jalview.util.Platform;
/**
public AlignmentI readFile(File selectedFile, String file,
DataSourceType sourceType, FileFormatI fileFormat,
- AlignmentAnnotation.TFType tempfacType) throws IOException
+ StructureImportSettings.TFType tempfacType) throws IOException
{
this.selectedFile = selectedFile;
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();
}
{
if (selectedFile == null)
{
- al = fa.readFile(null, file, protocol, format,
- temperatureFactorType);
+ al = fa.readFile(null, file, protocol, format);
}
else
{
- al = fa.readFile(selectedFile, null, protocol, format,
- temperatureFactorType);
+ al = fa.readFile(selectedFile, null, protocol, format);
}
source = fa.getAlignFile(); // keep reference for later if
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.SequenceGroup;
import jalview.datamodel.SequenceI;
+import jalview.structure.StructureImportSettings;
+import jalview.structure.StructureImportSettings.TFType;
import jalview.util.Comparison;
/**
@Override
public AlignmentI readFile(File selectedFile, String file,
DataSourceType sourceType, FileFormatI fileFormat,
- AlignmentAnnotation.TFType tempfacType) throws IOException
+ StructureImportSettings.TFType tempfacType) throws IOException
{
AlignmentI al = super.readFile(selectedFile, file, sourceType,
fileFormat, tempfacType);
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 jalview.structure.StructureImportSettings.TFType;
import mc_view.PDBChain;
public abstract class StructureFile extends AlignFile
private boolean pdbIdAvailable;
+ private StructureImportSettings.TFType temperatureFactorType = TFType.DEFAULT;
+
+ public void setTemperatureFactorType(StructureImportSettings.TFType t)
+ {
+ this.temperatureFactorType = t;
+ }
+
+ public StructureImportSettings.TFType getTemperatureFactorType()
+ {
+ return temperatureFactorType;
+ }
+
public StructureFile(Object inFile, DataSourceType sourceType)
throws IOException
{
}
public StructureFile(Object inFile, DataSourceType sourceType,
- AlignmentAnnotation.TFType tempfacType) throws IOException
+ StructureImportSettings.TFType tempfacType) throws IOException
{
- super(inFile, sourceType, tempfacType);
+ super(inFile, sourceType);
+ this.setTemperatureFactorType(tempfacType);
}
public StructureFile(FileParse fp) throws IOException
.isProcessSecondaryStructure();
this.externalSecondaryStructure = StructureImportSettings
.isExternalSecondaryStructure();
-
+ this.temperatureFactorType = StructureImportSettings
+ .getTemperatureFactorType();
}
public StructureFile(boolean parseImmediately, Object dataObject,
JMOL_PARSER, JALVIEW_PARSER
}
+ public static enum TFType
+ {
+ DEFAULT, PLDDT, DOSE;
+ }
+
/**
* Determines the default file format for structure files to be downloaded
* from the PDB sequence fetcher. Possible options include: PDB|mmCIF
*/
private static StructureParser defaultPDBFileParser = StructureParser.JMOL_PARSER;
+ private static TFType temperatureFactorType;
+
public static void addSettings(boolean addAlignmentAnnotations,
boolean processSecStr, boolean externalSecStr)
{
return visibleChainAnnotation;
}
+ public static void setTemperatureFactorType(TFType t)
+ {
+ StructureImportSettings.temperatureFactorType = t;
+ }
+
public static void setVisibleChainAnnotation(
boolean visibleChainAnnotation)
{
.valueOf(defaultPDBFileParser.toUpperCase(Locale.ROOT));
}
+ public static TFType getTemperatureFactorType()
+ {
+ return temperatureFactorType;
+ }
+
}
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
+import jalview.gui.Desktop;
import jalview.io.DataSourceType;
import jalview.io.FileFormat;
import jalview.io.FileFormatI;
import jalview.io.FormatAdapter;
import jalview.io.PDBFeatureSettings;
+import jalview.structure.StructureSelectionManager;
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.ws.datamodel.alphafold.PAEContactMatrix;
Console.debug("Downloading pae from " + paeURL + " to " + pae.toString()
+ "");
UrlDownloadClient.download(paeURL, pae);
- addAlphaFoldPAE(pdbAlignment, pae, 0, null);
+ addAlphaFoldPAEToSequence(pdbAlignment, pae, 0, null);
}
- public static void addAlphaFoldPAE(AlignmentI pdbAlignment, File pae,
- int index, String seqId)
+ public static void addAlphaFoldPAEToSequence(AlignmentI pdbAlignment,
+ File pae, int index, String seqId)
{
FileInputStream pae_input = null;
try
}
+ public static void addAlphaFoldPAEToStructure(AlignmentI pdbAlignment,
+ File pae, int index, String structId)
+ {
+ StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(Desktop.instance);
+ if (ssm != null)
+ {
+ /*
+ ssm.setAddTempFacAnnot(showTemperatureFactor);
+ ssm.setProcessSecondaryStructure(showSecondaryStructure);
+ */
+ }
+
+ }
+
/**
* parses the given pAE matrix and adds it to sequence 0 in the given
* alignment
Console.debug("***** Got sequence at index " + seqToGet + ": "
+ (sequence == null ? null : sequence.getName()));
}
- else
+ if (sequence == null)
{
Console.debug("***** Looking for sequence with id '" + seqId + "'");