Skip to content

Commit 468c44d

Browse files
committed
Update UniprotProxySequenceReader.java
1 parent 2cc65e1 commit 468c44d

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ public UniprotProxySequenceReader(String accession, CompoundSet<C> compoundSet)
106106

107107
/**
108108
* The xml is passed in as a DOM object so we know everything about the protein.
109-
* Some uniprot records contain white space in the sequence. We must strip it out so setContents doesn't fail.
110-
* TODO add simmilar logic to the other constructors
111109
* If an error occurs throw an exception. We could have a bad uniprot id
112110
* @param document
113111
* @param compoundSet
@@ -116,7 +114,7 @@ public UniprotProxySequenceReader(String accession, CompoundSet<C> compoundSet)
116114
public UniprotProxySequenceReader(Document document, CompoundSet<C> compoundSet) throws CompoundNotFoundException {
117115
setCompoundSet(compoundSet);
118116
uniprotDoc = document;
119-
String seq = this.getSequence(uniprotDoc).replaceAll("\\s","");
117+
String seq = this.getSequence(uniprotDoc);
120118
setContents(seq);
121119
}
122120
/**
@@ -144,15 +142,16 @@ public void setCompoundSet(CompoundSet<C> compoundSet) {
144142

145143
/**
146144
* Once the sequence is retrieved set the contents and make sure everything this is valid
145+
* Some uniprot records contain white space in the sequence. We must strip it out so setContents doesn't fail.
147146
* @param sequence
148147
* @throws CompoundNotFoundException
149148
*/
150149
@Override
151150
public void setContents(String sequence) throws CompoundNotFoundException {
152151
// Horrendously inefficient - pretty much the way the old BJ did things.
153152
// TODO Should be optimised.
154-
// NOTE This chokes on whitespace in the sequence, so whitespace is stripped by the caller
155-
this.sequence = sequence;
153+
// NOTE This chokes on whitespace in the sequence, so whitespace is stripped
154+
this.sequence = sequence.replaceAll("\\s","");
156155
this.parsedCompounds.clear();
157156
for (int i = 0; i < sequence.length();) {
158157
String compoundStr = null;

0 commit comments

Comments
 (0)