From aa08cfe91eda60027de76aafb0bcdbfc6481a1d9 Mon Sep 17 00:00:00 2001 From: James Procter Date: Mon, 15 Jan 2024 17:16:03 +0000 Subject: [PATCH] JAL-4366 JAL-4371 allow cruft after inferred pdb ids, ex 1xyz_A.pdb yields 1xyzA --- .../gui/structurechooser/PDBStructureChooserQuerySource.java | 2 +- src/jalview/struture/PDBEntryUtils.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/jalview/gui/structurechooser/PDBStructureChooserQuerySource.java b/src/jalview/gui/structurechooser/PDBStructureChooserQuerySource.java index 2aa0401..bd9a2ab 100644 --- a/src/jalview/gui/structurechooser/PDBStructureChooserQuerySource.java +++ b/src/jalview/gui/structurechooser/PDBStructureChooserQuerySource.java @@ -146,7 +146,7 @@ public class PDBStructureChooserQuerySource } } - if (!isPDBRefsFound && !isUniProtRefsFound) + if (!isPDBRefsFound && !isUniProtRefsFound && pdbids.isEmpty()) { String seqName = seq.getName(); seqName = sanitizeSeqName(seqName); diff --git a/src/jalview/struture/PDBEntryUtils.java b/src/jalview/struture/PDBEntryUtils.java index 2d67434..131030c 100644 --- a/src/jalview/struture/PDBEntryUtils.java +++ b/src/jalview/struture/PDBEntryUtils.java @@ -61,11 +61,12 @@ public class PDBEntryUtils } return targetChainId; } - protected static Pattern id_and_chain=Pattern.compile("(\\d[0-9A-Za-z]{3})[_:|]?(.{1,2})?"); + protected static Pattern id_and_chain=Pattern.compile("(\\d[0-9A-Za-z]{3})[_:|]?([0-9A-Za-z]{1,2})?.*"); public static List inferPDBEntry(SequenceI seq) { Matcher matcher = id_and_chain.matcher(seq.getName()); + if (matcher.matches()) { String id = matcher.group(1); -- 1.7.10.2