From: Jim Procter Date: Thu, 17 Jan 2019 12:29:06 +0000 (+0000) Subject: JAL-3116 clear out whitespace when materialising Sequence object from Uniprot XML X-Git-Tag: Release_2_11_1_0~77 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=0173acde216fc54fb54d935c2f7d2550e4c25016;p=jalview.git JAL-3116 clear out whitespace when materialising Sequence object from Uniprot XML --- diff --git a/src/jalview/ws/dbsources/Uniprot.java b/src/jalview/ws/dbsources/Uniprot.java index 86282c7..d97bf69 100644 --- a/src/jalview/ws/dbsources/Uniprot.java +++ b/src/jalview/ws/dbsources/Uniprot.java @@ -178,16 +178,12 @@ public class Uniprot extends DbSourceProxyImpl SequenceI uniprotEntryToSequence(Entry entry) { String id = getUniprotEntryId(entry); - String seqString = entry.getSequence().getValue(); - /* - * for backwards compatibility with Castor processing, - * remove any internal spaces + * Sequence should not include any whitespace, but JAXB leaves these in */ - if (seqString.indexOf(' ') > -1) - { - seqString = seqString.replace(" ", ""); - } + String seqString = entry.getSequence().getValue().replaceAll("\\s*", + ""); + SequenceI sequence = new Sequence(id, seqString); sequence.setDescription(getUniprotEntryDescription(entry)); diff --git a/test/jalview/ws/dbsources/UniprotTest.java b/test/jalview/ws/dbsources/UniprotTest.java index e835724..86f5602 100644 --- a/test/jalview/ws/dbsources/UniprotTest.java +++ b/test/jalview/ws/dbsources/UniprotTest.java @@ -216,6 +216,8 @@ public class UniprotTest SequenceI seq = new Uniprot().uniprotEntryToSequence(entry); assertNotNull(seq); assertEquals(6, seq.getDBRefs().length); // 2*Uniprot, PDB, PDBsum, 2*EMBL + assertEquals(seq.getSequenceAsString(), + seq.createDatasetSequence().getSequenceAsString()); }