From: Ben Soares Date: Thu, 2 Mar 2023 22:22:09 +0000 (+0000) Subject: JAL-629 Removal of unnecessary methods. Set pLTTD tempfac for EBIAlfafold. Simplify... X-Git-Tag: Release_2_11_4_0~462 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=a5d05d981da8510d2fc2e02aec0b110d6f5dc47e;p=jalview.git JAL-629 Removal of unnecessary methods. Set pLTTD tempfac for EBIAlfafold. Simplify adding cmannot. --- diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 7142b48..271454a 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -1446,7 +1446,6 @@ warning.wrong_jvm_version_message = The Java version being used (Java {0}) may l label.alphafold_reliability = Alphafold Reliability label.tftype_default = Default label.tftype_plddt = pLDDT -label.tftype_dose = Dose label.optional = (optional) label.choose_tempfac_type = Choose Temperature Factor type label.add_pae_matrix_file = Add PAE matrix file diff --git a/resources/lang/Messages_es.properties b/resources/lang/Messages_es.properties index 4b3da75..c427104 100644 --- a/resources/lang/Messages_es.properties +++ b/resources/lang/Messages_es.properties @@ -1432,6 +1432,5 @@ label.alphafold_reliability = Fiabilidad Alphafold label.optional = (opcional) label.tftype_default = Default label.tftype_plddt = pLDDT -label.tftype_dose = Dose label.add_pae_matrix_file = AƱadir un fichero de matriz PAE label.nothing_selected = Nada seleccionado diff --git a/src/jalview/ext/jmol/JmolParser.java b/src/jalview/ext/jmol/JmolParser.java index 969d195..f0e477c 100644 --- a/src/jalview/ext/jmol/JmolParser.java +++ b/src/jalview/ext/jmol/JmolParser.java @@ -230,9 +230,7 @@ public class JmolParser extends StructureFile implements JmolStatusListener { setId(pdbId); setPDBIdAvailable(true); - Console.debug("##### DATASOURCETYPE=" + getDataSourceType()); - setAlphafoldModel(alphaFold.search(pdbId) && isMMCIF - && getDataSourceType() == DataSourceType.URL); + setAlphafoldModel(alphaFold.search(pdbId) && isMMCIF); } List significantAtoms = convertSignificantAtoms(ms); for (Atom tmpatom : significantAtoms) @@ -303,31 +301,16 @@ public class JmolParser extends StructureFile implements JmolStatusListener } } // add a PAEMatrix if set (either by above or otherwise) - Console.debug("##### hasPAEMatrix()=" + hasPAEMatrix()); - Console.debug("##### isAlphafoldModel()=" + isAlphafoldModel()); - Console.debug("##### getPAEMatrix()=" + getPAEMatrix()); if (hasPAEMatrix()) { Alignment al = new Alignment(prot.toArray(new SequenceI[0])); - if (isAlphafoldModel()) - { - EBIAlfaFold.addAlphaFoldPAE(al, new File(this.getPAEMatrix()), 0, - null, false, false); - } - else - { - EBIAlfaFold.addPAEToStructure(null, this.getInFile(), - new File(this.getPAEMatrix())); - } + EBIAlfaFold.addAlphaFoldPAE(al, new File(this.getPAEMatrix()), 0, + null, false, false); - Console.debug("##### al.getAlignmentAnnotation()=" - + al.getAlignmentAnnotation()); if (al.getAlignmentAnnotation() != null) { for (AlignmentAnnotation alann : al.getAlignmentAnnotation()) { - Console.debug("##### Adding to alann" + alann.annotationId + "(" - + alann.getCalcId() + ")"); annotations.add(alann); } } diff --git a/src/jalview/gui/PymolViewer.java b/src/jalview/gui/PymolViewer.java index 5069d93..52c253d 100644 --- a/src/jalview/gui/PymolViewer.java +++ b/src/jalview/gui/PymolViewer.java @@ -274,7 +274,7 @@ public class PymolViewer extends StructureViewerBase if (pe.hasStructureFile()) { pdb = pe.getStructureFile(); - Console.debug("##### (Re)Using StructureFile " + pdb.getId()); + Console.debug("(Re)Using StructureFile " + pdb.getId()); } else { diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index e2eaabd..80024d9 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -1389,10 +1389,6 @@ public class StructureChooser extends GStructureChooser 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()); diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java index b5ed052..9a4e982 100755 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -167,11 +167,7 @@ public class AppletFormatAdapter { this.selectedFile = selectedFile; - if (selectedFile != null) - { - this.inFile = selectedFile.getPath(); - } - this.inFile = file; + this.inFile = selectedFile != null ? selectedFile.getPath() : file; try { if (fileFormat.isStructureFile()) diff --git a/src/jalview/structure/StructureImportSettings.java b/src/jalview/structure/StructureImportSettings.java index a50101a..22ecdc7 100644 --- a/src/jalview/structure/StructureImportSettings.java +++ b/src/jalview/structure/StructureImportSettings.java @@ -62,7 +62,7 @@ public class StructureImportSettings public static enum TFType { - DEFAULT, PLDDT, DOSE; + DEFAULT, PLDDT; @Override public String toString() diff --git a/src/jalview/ws/dbsources/EBIAlfaFold.java b/src/jalview/ws/dbsources/EBIAlfaFold.java index aba0d4b..8609046 100644 --- a/src/jalview/ws/dbsources/EBIAlfaFold.java +++ b/src/jalview/ws/dbsources/EBIAlfaFold.java @@ -40,7 +40,6 @@ import com.stevesoft.pat.Regex; import jalview.api.FeatureSettingsModelI; import jalview.bin.Console; -import jalview.datamodel.AlignedCodonFrame; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.ContactMatrixI; @@ -54,6 +53,7 @@ import jalview.io.FileFormat; import jalview.io.FileFormatI; import jalview.io.FormatAdapter; import jalview.io.PDBFeatureSettings; +import jalview.structure.StructureImportSettings.TFType; import jalview.structure.StructureMapping; import jalview.structure.StructureSelectionManager; import jalview.util.MessageManager; @@ -154,12 +154,20 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy @Override public AlignmentI getSequenceRecords(String queries) throws Exception { - return getSequenceRecords(queries, null); + // used by the SequenceFetcher. Put forSequencesOnly to true (don't open + // structure viewer later) + return getSequenceRecords(queries, null, true); } public AlignmentI getSequenceRecords(String queries, String retrievalUrl) throws Exception { + return getSequenceRecords(queries, retrievalUrl, false); + } + + public AlignmentI getSequenceRecords(String queries, String retrievalUrl, + boolean forSequencesOnly) throws Exception + { AlignmentI pdbAlignment = null; String chain = null; String id = null; @@ -199,6 +207,7 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy { return null; } + // TODO Get the PAE file somewhere around here and remove from JmolParser pdbAlignment = importDownloadedStructureFromUrl(alphaFoldCif, tmpFile, id, chain, getDbSource(), getDbVersion()); @@ -217,6 +226,8 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy stopQuery(); throw (ex); } + // distinguish between AlphaFold cif/pdb opened as structure file or fetched + // as sequence/alignment return pdbAlignment; } @@ -398,22 +409,6 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy * @throws Exception */ public static boolean importPaeJSONAsContactMatrixToSequence( - AlignmentI pdbAlignment, InputStream pae_input) - throws IOException, ParseException - { - return importPaeJSONAsContactMatrixToSequence(pdbAlignment, pae_input, - 0, null); - } - - public static boolean importPaeJSONAsContactMatrixToSequence( - AlignmentI pdbAlignment, File paeFile, int index, String seqId) - throws FileNotFoundException, IOException, ParseException - { - return importPaeJSONAsContactMatrixToSequence(pdbAlignment, - new FileInputStream(paeFile), index, seqId); - } - - public static boolean importPaeJSONAsContactMatrixToSequence( AlignmentI pdbAlignment, InputStream pae_input, int index, String seqId) throws IOException, ParseException { @@ -446,14 +441,6 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy } public static boolean importPaeJSONAsContactMatrixToSequence( - AlignmentI pdbAlignment, File pae_input, SequenceI sequence) - throws IOException, ParseException - { - return importPaeJSONAsContactMatrixToSequence(pdbAlignment, - new FileInputStream(pae_input), sequence); - } - - public static boolean importPaeJSONAsContactMatrixToSequence( AlignmentI pdbAlignment, InputStream pae_input, SequenceI sequence) throws IOException, ParseException { @@ -520,13 +507,7 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy (Map) pae_obj); AlignmentAnnotation cmannot = sm.getSequence().addContactList(matrix); - // sm.getSequence().addAlignmentAnnotation(cmannot); - sm.transfer(cmannot); - // return true; - - StructureSelectionManager ssm = StructureSelectionManager - .getStructureSelectionManager(Desktop.instance); - List acfList = ssm.getSequenceMappings(); + sm.getSequence().addAlignmentAnnotation(cmannot); return true; } @@ -551,8 +532,10 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy String file = tmpFile.getAbsolutePath(); // todo get rid of Type and use FileFormatI instead? FileFormatI fileFormat = FileFormat.MMCif; - AlignmentI pdbAlignment = new FormatAdapter().readFile(tmpFile, - DataSourceType.FILE, fileFormat); + TFType tempfacType = TFType.PLDDT; + AlignmentI pdbAlignment = new FormatAdapter().readFile(tmpFile, file, + DataSourceType.FILE, fileFormat, tempfacType); + if (pdbAlignment != null) { List toremove = new ArrayList(); @@ -565,7 +548,6 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy if (pid.getFile() == file) { chid = pid.getChainCode(); - } } if (chain == null || (chid != null && (chid.equals(chain)