Skip to content

Commit 7f87854

Browse files
committed
Dssp url fix and update to latest mmtf-java
1 parent 2435724 commit 7f87854

File tree

5 files changed

+15
-98
lines changed

5 files changed

+15
-98
lines changed

biojava-structure/src/main/java/org/biojava/nbio/structure/io/LocalPDBDirectory.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import org.biojava.nbio.structure.StructureException;
2828
import org.biojava.nbio.structure.align.util.UserConfiguration;
2929
import org.biojava.nbio.core.util.FileDownloadUtils;
30-
import org.rcsb.mmtf.decoder.ReaderUtils;
30+
import org.rcsb.mmtf.utils.CodecUtils;
3131
import org.biojava.nbio.core.util.InputStreamProvider;
3232
import org.slf4j.Logger;
3333
import org.slf4j.LoggerFactory;
@@ -547,10 +547,9 @@ private File downloadStructure(String pdbId, String pathOnServer, boolean obsole
547547

548548
String ftp;
549549

550-
if (getFilename(pdbId).endsWith(".mmtf.gz")){
551-
ftp = ReaderUtils.getUrl(pdbId);
552-
}
553-
else{
550+
if (getFilename(pdbId).endsWith(".mmtf.gz")){
551+
ftp = CodecUtils.getMmtfEntryUrl(pdbId, true, false);
552+
} else {
554553
ftp = String.format("%s%s/%s/%s",
555554
serverName, pathOnServer, pdbId.substring(1,3).toLowerCase(), getFilename(pdbId));
556555
}

biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/DSSPParser.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.net.URL;
3232
import java.util.ArrayList;
3333
import java.util.List;
34+
import java.util.zip.GZIPInputStream;
3435

3536
import org.biojava.nbio.structure.Group;
3637
import org.biojava.nbio.structure.ResidueNumber;
@@ -114,8 +115,11 @@ public static List<SecStrucState> fetch(String pdb,
114115
Structure structure, boolean assign)
115116
throws IOException, StructureException {
116117

117-
InputStream in = new URL("http://www.rcsb.org/pdb/files/"+
118-
pdb+".dssp").openStream();
118+
URL url = new URL("http://files.rcsb.org/dssp/" +
119+
pdb.toLowerCase().substring(1, 3) + "/" +
120+
pdb.toLowerCase() + "/" +
121+
pdb + ".dssp.gz");
122+
InputStream in = new GZIPInputStream(url.openStream());
119123
Reader read = new InputStreamReader(in);
120124
BufferedReader reader = new BufferedReader(read);
121125
return generalParse(reader, structure, assign);

biojava-structure/src/test/java/org/biojava/nbio/structure/secstruc/TestDSSPParser.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,11 @@ public void testDSSPParser() throws IOException, StructureException {
5353
Structure s = cache.getStructure(name);
5454

5555
// Test loading from file
56-
List<SecStrucState> file = DSSPParser.parseFile(
57-
"src/test/resources/" + name + ".dssp", s, false);
56+
List<SecStrucState> file = DSSPParser.parseInputStream(new GZIPInputStream(
57+
this.getClass().getResourceAsStream("/org/biojava/nbio/structure/secstruc/"+name+".dssp.gz")), s, false);
5858

5959
// Test fetching from PDB
60-
List<SecStrucState> pdb = DSSPParser.parseInputStream(new GZIPInputStream(
61-
this.getClass().getResourceAsStream("/org/biojava/nbio/structure/secstruc/"+name+".dssp.gz")), s, false);
60+
List<SecStrucState> pdb = DSSPParser.fetch(name, s, false);
6261

6362
// Test predicting, writting and parsing back
6463
SecStrucCalc sec = new SecStrucCalc();
@@ -83,4 +82,5 @@ public void testDSSPParser() throws IOException, StructureException {
8382
}
8483
}
8584
}
85+
8686
}

biojava-structure/src/test/resources/5pti.dssp

Lines changed: 0 additions & 86 deletions
This file was deleted.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3838
<project.build.targetEncoding>UTF-8</project.build.targetEncoding>
3939
<maxmem>512M</maxmem>
40-
<mmtf.version>1.0.5</mmtf.version>
40+
<mmtf.version>1.0.7</mmtf.version>
4141
<slf4j.version>1.7.21</slf4j.version>
4242
<log4j.version>2.6.1</log4j.version>
4343
</properties>

0 commit comments

Comments
 (0)