JAL-3929 URLencode pdbid to remove problematic characters - propagate urlEncoded...
authorJim Procter <j.procter@dundee.ac.uk>
Wed, 8 Dec 2021 15:44:04 +0000 (15:44 +0000)
committerJim Procter <j.procter@dundee.ac.uk>
Wed, 8 Dec 2021 15:44:04 +0000 (15:44 +0000)
src/jalview/gui/StructureViewerBase.java
src/jalview/ws/dbsources/EBIAlfaFold.java
src/mc_view/PDBChain.java

index 1c0f43e..30ecc80 100644 (file)
@@ -1160,8 +1160,10 @@ public abstract class StructureViewerBase extends GStructureViewer
       } else {
           if (processingEntry.hasRetrievalUrl())
           {
+            String safePDBId = java.net.URLEncoder.encode(pdbid,"UTF-8");
+                     
             // retrieve from URL to new local tmpfile
-            File tmpFile = File.createTempFile(pdbid,
+            File tmpFile = File.createTempFile(safePDBId,
                     "." + (PDBEntry.Type.MMCIF.toString().equals(
                             processingEntry.getType().toString()) ? "cif"
                                     : "pdb"));
index a93f233..b77fc47 100644 (file)
@@ -28,7 +28,9 @@ import jalview.datamodel.DBRefEntry;
 import jalview.datamodel.DBRefSource;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.PDBEntry.Type;
+import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
+import jalview.datamodel.features.SequenceFeaturesI;
 import jalview.io.DataSourceType;
 import jalview.io.FileFormat;
 import jalview.io.FileFormatI;
@@ -238,6 +240,21 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy
                     dbVersion, (chid == null ? id : id + chid));
             // dbentry.setMap()
             pdbcs.addDBRef(dbentry);
+            // update any feature groups
+            List<SequenceFeature> allsf = pdbcs.getFeatures().getAllFeatures();
+            List<SequenceFeature> newsf = new ArrayList<SequenceFeature>();
+            if (allsf!=null && allsf.size()>0)
+            {
+              for (SequenceFeature f:allsf)
+              {
+                if (file.equals(f.getFeatureGroup()))
+                {
+                  f = new SequenceFeature(f, f.type, f.begin, f.end, id, f.score);
+                }
+                newsf.add(f);
+              }
+              pdbcs.setSequenceFeatures(newsf);
+            }
           }
         }
         else
index e1c90f3..70fda66 100755 (executable)
@@ -229,6 +229,7 @@ public class PDBChain
    * @param seq
    * @param status
    *          The Status of the transferred annotation
+   * @param actualGroupId the group id for the features on the destination sequence (e.g. the official accession ID)
    */
   public void transferRESNUMFeatures(SequenceI seq,
           String status)
@@ -265,7 +266,7 @@ public class PDBChain
         int newEnd = 1 + residues.elementAt(feature.getEnd() - offset).atoms
                 .elementAt(0).alignmentMapping;
         SequenceFeature tx = new SequenceFeature(feature, newBegin, newEnd,
-                feature.getFeatureGroup(), feature.getScore());
+                pdbid, feature.getScore());
         tx.setStatus(status
                 + ((tx.getStatus() == null || tx.getStatus().length() == 0)
                         ? ""