From 9d80cca5113c0411aa06559d4bd3f86454459ce7 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 8 Dec 2021 15:45:51 +0000 Subject: [PATCH] =?utf8?q?JAL-3931=20remove=20%=20and=20-=20from=20ids=20so=20?= =?utf8?q?Pymol=20doesn=E2=80=99t=20strip=20them=20out=20and=20truncate=20th?= =?utf8?q?e=20structure=20identifier=20that=20Jalview=20uses=20to=20refer=20?= =?utf8?q?to=20each=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/gui/PymolBindingModel.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/jalview/gui/PymolBindingModel.java b/src/jalview/gui/PymolBindingModel.java index 538b101..719ca53 100644 --- a/src/jalview/gui/PymolBindingModel.java +++ b/src/jalview/gui/PymolBindingModel.java @@ -171,6 +171,21 @@ public class PymolBindingModel extends AAStructureBindingModel * a second parameter sets the pdbid as the loaded PyMOL object name */ String pdbId = pe.getId(); + try { + String safePDBId = java.net.URLEncoder.encode(pdbId,"UTF-8"); + pdbId = safePDBId.replace('%', '_'); + pdbId = pdbId.replace("-", "__"); + char fc = pdbId.charAt(0); + // put an 's' before any numerics + if (fc>='0' && fc<='9') + { + pdbId = 's'+pdbId; + } +// pdbId.replace('-', 0) + } catch (Exception x) + { + Cache.log.error("Unxpected encoding exception for '"+pdbId+"'",x); + } cmd.addParameter(pdbId); executeCommand(cmd, false); -- 1.7.10.2