import javax.swing.SwingUtilities;
import javax.swing.table.AbstractTableModel;
+import com.stevesoft.pat.Regex;
+
import jalview.api.structures.JalviewStructureDisplayI;
import jalview.bin.Cache;
import jalview.bin.Console;
import jalview.bin.Jalview;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
+import jalview.ext.jmol.JmolParser;
import jalview.fts.api.FTSData;
import jalview.fts.api.FTSDataColumnI;
import jalview.fts.api.FTSRestClientI;
{
selectedPdbFileName = chooser.getSelectedFile().getPath();
Cache.setProperty("LAST_DIRECTORY", selectedPdbFileName);
+ boolean guessTFType = localPdbPaeMatrixFileName == null;
localPdbPaeMatrixFileName = guessPAEFilename();
+ guessTFType |= localPdbPaeMatrixFileName != null;
+ Regex alphaFold = JmolParser.getNewAlphafoldValidator();
+ if (guessTFType
+ && alphaFold.search(new File(selectedPdbFileName).getName())
+ && !tempFacAsChanged)
+ {
+ // localPdbPaeMatrixFileName was null and now isn't and filename could
+ // well be AlphaFold and user hasn't adjusted the tempFacType
+ combo_tempFacAs.setSelectedItem(TFType.PLDDT);
+ }
validateSelections();
}
}
private String guessPAEFilename()
{
- if (selectedPdbFileName.toLowerCase(Locale.ROOT).endsWith(".pdb"))
+ if (selectedPdbFileName.toLowerCase(Locale.ROOT).endsWith(".pdb")
+ || selectedPdbFileName.toLowerCase(Locale.ROOT)
+ .endsWith(".cif"))
{
String jsonExt = selectedPdbFileName.substring(0,
selectedPdbFileName.length() - 4) + ".json";
}
else if (currentView == VIEWS_FROM_FILE)
{
- SequenceI userSelectedSeq = ((AssociateSeqOptions) fileChooserAssSeqPanel
- .getCmb_assSeq().getSelectedItem()).getSequence();
+ TFType tft = (TFType) StructureChooser.this.combo_tempFacAs
+ .getSelectedItem();
+ String paeFilename = StructureChooser.this.localPdbPaeMatrixFileName;
+ AssociateSeqOptions assSeqOpt = (AssociateSeqOptions) fileChooserAssSeqPanel
+ .getCmb_assSeq().getSelectedItem();
+ SequenceI userSelectedSeq = assSeqOpt.getSequence();
if (userSelectedSeq != null)
- {
selectedSequence = userSelectedSeq;
- }
- PDBEntry fileEntry = new AssociatePdbFileWithSeq()
- .associatePdbWithSeq(selectedPdbFileName,
- DataSourceType.FILE, selectedSequence, true,
- Desktop.instance);
+ String pdbFilename = selectedPdbFileName;
+ PDBEntry fileEntry = new AssociatePdbFileWithSeq()
+ .associatePdbWithSeq(pdbFilename, DataSourceType.FILE,
+ selectedSequence, true, Desktop.instance, tft,
+ paeFilename);
+
+ /*
+ SequenceI[] seqArray = new SequenceI[] { selectedSequence };
+
+ StructureFile sf = ssm.computeMapping(true, seqArray, null,
+ selectedPdbFileName, DataSourceType.FILE, null, tft,
+ paeFilename);
+ StructureMapping[] sm = ssm.getMapping(fileEntry.getFile());
+ // DO SOMETHING WITH
+ File paeFile = paeFilename == null ? null : new File(paeFilename);
+ if (paeFilename != null && paeFile.exists())
+ {
+ AlignmentI al = StructureChooser.this.ap.getAlignment();
+ try
+ {
+ EBIAlfaFold.importPaeJSONAsContactMatrixToSequence(al,
+ paeFile, selectedSequence);
+ } catch (IOException | ParseException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ */
sViewer = launchStructureViewer(ssm, new PDBEntry[] { fileEntry },
ap, new SequenceI[]
{ selectedSequence });
for (SequenceI seq : sequences)
{
PDBEntry pdbe = pdbEntriesToView[p++];
+ Console.debug(
+ "##### pdbe=" + pdbe == null ? null : pdbe.toString());
+ Console.debug("##### pdbe.getFile()=" + pdbe == null ? null
+ : pdbe.getFile());
if (pdbe != null && pdbe.getFile() != null)
{
StructureMapping[] smm = ssm.getMapping(pdbe.getFile());
setProgressBar(MessageManager.formatMessage(
"status.fetching_3d_structures_for",
pdbEntriesToView[0].getId()), progressId);
+ // Can we pass a pre-computeMappinged pdbFile?
theViewer.viewStructures(pdbEntriesToView[0], sequences, alignPanel);
}
setProgressBar(null, progressId);