From b52f1c317e9171563a69bcf5ef41ad29e9c4da49 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 8 Dec 2021 15:44:04 +0000 Subject: [PATCH] JAL-3929 URLencode pdbid to remove problematic characters - propagate urlEncoded ID to the features transferred from the structure file --- src/jalview/gui/StructureViewerBase.java | 4 +++- src/jalview/ws/dbsources/EBIAlfaFold.java | 17 +++++++++++++++++ src/mc_view/PDBChain.java | 3 ++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/jalview/gui/StructureViewerBase.java b/src/jalview/gui/StructureViewerBase.java index 1c0f43e..30ecc80 100644 --- a/src/jalview/gui/StructureViewerBase.java +++ b/src/jalview/gui/StructureViewerBase.java @@ -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")); diff --git a/src/jalview/ws/dbsources/EBIAlfaFold.java b/src/jalview/ws/dbsources/EBIAlfaFold.java index a93f233..b77fc47 100644 --- a/src/jalview/ws/dbsources/EBIAlfaFold.java +++ b/src/jalview/ws/dbsources/EBIAlfaFold.java @@ -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 allsf = pdbcs.getFeatures().getAllFeatures(); + List newsf = new ArrayList(); + 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 diff --git a/src/mc_view/PDBChain.java b/src/mc_view/PDBChain.java index e1c90f3..70fda66 100755 --- a/src/mc_view/PDBChain.java +++ b/src/mc_view/PDBChain.java @@ -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) ? "" -- 1.7.10.2