Merge branch 'features/r2_11_2_alphafold/JAL-629' into features/JAL-4134_treeviewerfo...
[jalview.git] / src / jalview / ws / dbsources / EBIAlfaFold.java
index aba0d4b..d9cbbd9 100644 (file)
@@ -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;
@@ -199,6 +199,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());
@@ -398,22 +399,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 +431,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
   {
@@ -465,6 +442,7 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy
     }
     ContactMatrixI matrix = new PAEContactMatrix(sequence,
             (Map<String, Object>) paeDict);
+    ((PAEContactMatrix) matrix).makeGroups(5f, true);
 
     AlignmentAnnotation cmannot = sequence.addContactList(matrix);
     pdbAlignment.addAnnotation(cmannot);
@@ -518,15 +496,9 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy
 
     ContactMatrixI matrix = new PAEContactMatrix(sm.getSequence(),
             (Map<String, Object>) pae_obj);
-
+    ((PAEContactMatrix) matrix).makeGroups(5f, true);
     AlignmentAnnotation cmannot = sm.getSequence().addContactList(matrix);
-    // sm.getSequence().addAlignmentAnnotation(cmannot);
-    sm.transfer(cmannot);
-    // return true;
-
-    StructureSelectionManager ssm = StructureSelectionManager
-            .getStructureSelectionManager(Desktop.instance);
-    List<AlignedCodonFrame> acfList = ssm.getSequenceMappings();
+    sm.getSequence().addAlignmentAnnotation(cmannot);
 
     return true;
   }
@@ -551,8 +523,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<SequenceI> toremove = new ArrayList<SequenceI>();
@@ -565,7 +539,6 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy
           if (pid.getFile() == file)
           {
             chid = pid.getChainCode();
-
           }
         }
         if (chain == null || (chid != null && (chid.equals(chain)