Skip to content

Commit 971a51a

Browse files
committed
remove MMTF download option
1 parent 3181d70 commit 971a51a

3 files changed

Lines changed: 29 additions & 30 deletions

File tree

docs/src/documentation.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ To download multiple PDB files to a specified directory:
587587
downloadpdb(["1EN2", "1ALW", "1AKE"], dir="path/to/pdb/directory")
588588
```
589589

590-
To download a PDB file in PDB, XML, mmCIF or MMTF format use the `format` argument:
590+
To download a PDB file in PDB, XML or mmCIF format use the `format` argument:
591591

592592
```julia
593593
# To get mmCIF
@@ -597,6 +597,7 @@ downloadpdb("1ALW", dir="path/to/pdb/directory", format=MMCIFFormat)
597597
downloadpdb("1ALW", dir="path/to/pdb/directory", format=PDBXMLFormat)
598598
```
599599

600+
Note that MMTF files are [no longer available to download](https://www.rcsb.org/news/65a1af31c76ca3abcc925d0c).
600601
To apply a function to a downloaded file and delete the file afterwards:
601602

602603
```julia
@@ -613,7 +614,7 @@ end
613614
```
614615

615616
Note that some PDB entries, e.g. large viral assemblies, are not available as PDB format files.
616-
In this case download the mmCIF file or MMTF file instead.
617+
In this case download the mmCIF file instead.
617618

618619
## Reading PDB files
619620

@@ -746,15 +747,15 @@ l = pdbentrylist()
746747
To download the entire RCSB PDB database in your preferred file format:
747748

748749
```julia
749-
downloadentirepdb(dir="path/to/pdb/directory", format=MMTFFormat)
750+
downloadentirepdb(dir="path/to/pdb/directory", format=MMCIFFormat)
750751
```
751752

752753
This operation takes a lot of disk space and time to complete, depending on internet connection.
753754

754755
To update your local PDB directory based on the weekly status list of new, modified and obsolete PDB files from the RCSB server:
755756

756757
```julia
757-
updatelocalpdb(dir="path/to/pdb/directory", format=MMTFFormat)
758+
updatelocalpdb(dir="path/to/pdb/directory", format=MMCIFFormat)
758759
```
759760

760761
Obsolete PDB files are stored in the auto-generated `obsolete` directory inside the specified local PDB directory.

src/download.jl

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Requires an internet connection.
151151
- `dir::AbstractString=pwd()`: the directory to which the PDB file is
152152
downloaded; defaults to the current working directory.
153153
- `format::Type=PDB`: the format of the PDB file; options are PDBFormat,
154-
PDBXMLFormat, MMCIFFormat and MMTFFormat.
154+
PDBXMLFormat and MMCIFFormat. MMTF files are no longer available to download.
155155
- `obsolete::Bool=false`: if set `true`, the PDB file is downloaded in the
156156
auto-generated "obsolete" directory inside the specified `dir`.
157157
- `overwrite::Bool=false`: if set `true`, overwrites the PDB file if it exists
@@ -161,7 +161,7 @@ Requires an internet connection.
161161
"""
162162
function downloadpdb(pdbid::AbstractString;
163163
dir::AbstractString=pwd(),
164-
format::Type{<:Union{PDBFormat, PDBXMLFormat, MMCIFFormat, MMTFFormat}}=PDBFormat,
164+
format::Type{<:Union{PDBFormat, PDBXMLFormat, MMCIFFormat}}=PDBFormat,
165165
obsolete::Bool=false,
166166
overwrite::Bool=false,
167167
ba_number::Integer=0)
@@ -196,18 +196,24 @@ function downloadpdb(pdbid::AbstractString;
196196
# Download the compressed PDB file to the temporary location
197197
@info "Downloading file from PDB: $pdbid"
198198
if ba_number == 0
199-
if format == MMTFFormat
200-
Downloads.download("http://mmtf.rcsb.org/v1.0/full/$pdbid.mmtf.gz", archivefilepath)
201-
else
202-
Downloads.download("http://files.rcsb.org/download/$pdbid.$(pdbextension[format]).gz", archivefilepath)
203-
end
199+
Downloads.download(
200+
"http://files.rcsb.org/download/$pdbid.$(pdbextension[format]).gz",
201+
archivefilepath,
202+
)
204203
else
205204
if format == PDBFormat
206-
Downloads.download("http://files.rcsb.org/download/$pdbid.$(pdbextension[format])$ba_number.gz", archivefilepath)
205+
Downloads.download(
206+
"http://files.rcsb.org/download/$pdbid.$(pdbextension[format])$ba_number.gz",
207+
archivefilepath,
208+
)
207209
elseif format == MMCIFFormat
208-
Downloads.download("http://files.rcsb.org/download/$pdbid-assembly$ba_number.$(pdbextension[format]).gz", archivefilepath)
210+
Downloads.download(
211+
"http://files.rcsb.org/download/$pdbid-assembly$ba_number.$(pdbextension[format]).gz",
212+
archivefilepath,
213+
)
209214
else
210-
throw(ArgumentError("Biological assemblies are available in the PDB and mmCIF formats only"))
215+
throw(ArgumentError("Biological assemblies are available in the " *
216+
"PDB and mmCIF formats only"))
211217
end
212218
end
213219
# Verify if the compressed file is downloaded properly and extract it
@@ -221,7 +227,9 @@ function downloadpdb(pdbid::AbstractString;
221227
# Verify if the PDB file is downloaded and extracted without any error
222228
if !isfile(pdbpath) || filesize(pdbpath) == 0
223229
if format == PDBFormat
224-
throw(ErrorException("Error downloading file: $pdbid; some PDB entries are not available as PDB format files, consider downloading the mmCIF file or MMTF file instead"))
230+
throw(ErrorException("Error downloading file: $pdbid; some PDB entries are " *
231+
"not available as PDB format files, consider downloading " *
232+
"the mmCIF file instead"))
225233
else
226234
throw(ErrorException("Error downloading file: $pdbid"))
227235
end
@@ -276,12 +284,12 @@ Requires an internet connection.
276284
- `dir::AbstractString=pwd()`: the directory to which the PDB files are
277285
downloaded; defaults to the current working directory.
278286
- `format::Type=PDB`: the format of the PDB file; options are PDBFormat,
279-
PDBXMLFormat, MMCIFFormat and MMTFFormat.
287+
PDBXMLFormat and MMCIFFormat. MMTF files are no longer available to download.
280288
- `overwrite::Bool=false`: if set `true`, overwrites the PDB file if it exists
281289
in `dir`; by default skips downloading the PDB file if it exists.
282290
"""
283291
function downloadentirepdb(; dir::AbstractString=pwd(),
284-
format::Type{<:Union{PDBFormat, PDBXMLFormat, MMCIFFormat, MMTFFormat}}=PDBFormat,
292+
format::Type{<:Union{PDBFormat, PDBXMLFormat, MMCIFFormat}}=PDBFormat,
285293
overwrite::Bool=false)
286294
pdblist = pdbentrylist()
287295
@info "About to download $(length(pdblist)) PDB files, make sure you have enough disk space and time"
@@ -300,7 +308,7 @@ automatically updates the PDB files of the given `format` inside the local
300308
Requires an internet connection.
301309
"""
302310
function updatelocalpdb(; dir::AbstractString=pwd(),
303-
format::Type{<:Union{PDBFormat, PDBXMLFormat, MMCIFFormat, MMTFFormat}}=PDBFormat)
311+
format::Type{<:Union{PDBFormat, PDBXMLFormat, MMCIFFormat}}=PDBFormat)
304312
addedlist, modifiedlist, obsoletelist = pdbrecentchanges()
305313
# Download the newly added and modified pdb files
306314
downloadpdb(vcat(addedlist, modifiedlist), dir=dir, overwrite=true, format=format)
@@ -337,12 +345,12 @@ Requires an internet connection.
337345
- `obsolete_dir::AbstractString=pwd()`: the directory where the PDB files are
338346
downloaded; defaults to the current working directory.
339347
- `format::Type=PDB`: the format of the PDB file; options are PDBFormat,
340-
PDBXMLFormat, MMCIFFormat and MMTFFormat.
348+
PDBXMLFormat and MMCIFFormat. MMTF files are no longer available to download.
341349
- `overwrite::Bool=false`: if set `true`, overwrites the PDB file if it exists
342350
in `dir`; by default skips downloading the PDB file if it exists.
343351
"""
344352
function downloadallobsoletepdb(; obsolete_dir::AbstractString=pwd(),
345-
format::Type{<:Union{PDBFormat, PDBXMLFormat, MMCIFFormat, MMTFFormat}}=PDBFormat,
353+
format::Type{<:Union{PDBFormat, PDBXMLFormat, MMCIFFormat}}=PDBFormat,
346354
overwrite::Bool=false)
347355
obsoletelist = pdbobsoletelist()
348356
downloadpdb(obsoletelist, dir=obsolete_dir, format=format, overwrite=overwrite)

test/runtests.jl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,6 @@ Aqua.test_all(BioStructures; ambiguities=(recursive=false))
126126
downloadpdb("1alw", dir=temp_dir, format=MMCIFFormat)
127127
pdbpath = joinpath(temp_dir, "1ALW.$(pdbextension[MMCIFFormat])")
128128
@test isfile(pdbpath) && filesize(pdbpath) > 0
129-
# MMTF format
130-
downloadpdb("1alw", dir=temp_dir, format=MMTFFormat)
131-
pdbpath = joinpath(temp_dir, "1ALW.$(pdbextension[MMTFFormat])")
132129
@test isfile(pdbpath) && filesize(pdbpath) > 0
133130
# Obsolete PDB
134131
downloadpdb("116l", dir=temp_dir, format=PDBFormat, obsolete=true)
@@ -3258,7 +3255,6 @@ end
32583255

32593256
pdb_path = downloadpdb("1BQ0", dir=temp_dir, format=PDBFormat)
32603257
cif_path = downloadpdb("1BQ0", dir=temp_dir, format=MMCIFFormat)
3261-
mmtf_path = downloadpdb("1BQ0", dir=temp_dir, format=MMTFFormat)
32623258

32633259
struc = read(pdb_path, PDBFormat)
32643260
for res in collectresidues(struc)[1:5]
@@ -3301,9 +3297,6 @@ end
33013297
struc3 = read(cif_path, MMCIFFormat; run_dssp=true)
33023298
@test sscode.(collectatoms(struc)) == sscode.(collectatoms(struc3))
33033299

3304-
struc4 = read(mmtf_path, MMTFFormat; run_dssp=true)
3305-
@test sscode.(collectatoms(struc)) == sscode.(collectatoms(struc3))
3306-
33073300
struc = read(pdb_path, PDBFormat)
33083301
runstride!(struc)
33093302

@@ -3333,9 +3326,6 @@ end
33333326
struc3 = read(cif_path, MMCIFFormat; run_stride=true)
33343327
@test sscode.(collectatoms(struc)) == sscode.(collectatoms(struc3))
33353328

3336-
struc4 = read(mmtf_path, MMTFFormat; run_stride=true)
3337-
@test sscode.(collectatoms(struc)) == sscode.(collectatoms(struc4))
3338-
33393329
isfile(temp_filename) && rm(temp_filename)
33403330
rundssp(cif_path, temp_filename)
33413331
@test countlines(temp_filename) > 50

0 commit comments

Comments
 (0)