This repository was archived by the owner on Jul 16, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetpdbblastdb.py
More file actions
50 lines (42 loc) · 2.18 KB
/
Copy pathgetpdbblastdb.py
File metadata and controls
50 lines (42 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
####################################################################################################
# #
# PROJECT Protein Adaptation #
# Script GetPDBBlastDB #
# PROGRAMMER Jeremy Adams #
# STARTED 10-01-15 #
# LASTMOD 10-01-15 #
# #
# DESCRIPTION script to download the PDB sequences in Fasta format and make a blast #
# database out of it #
# #
####################################################################################################
import urllib2
import os
import sys
"adds a slash to a directory path if it is needed"
def addSlashIfNeeded(PATH):
Ret = PATH
if PATH.endswith("/"):
pass
else:
Ret = PATH+"/"
return Ret
ftp = "ftp://ftp.ncbi.nlm.nih.gov/blast/db/pdbaa.tar.gz"
USAGE = """python getpdbblastdb.py --data-dir [datadir]
Where:
datadir: the absolute path to the directory containing this script
"""
#performs all necessary checks, prints the USAGE string if there is incorrect input
if len(sys.argv) != 3:
print USAGE
else:
if sys.argv[1] != "--data-dir":
print USAGE
else:
if os.path.exists(addSlashIfNeeded(sys.argv[2])+"pdb/"):
os.system("wget %s" % (ftp)) #fetches the file from the FTP
os.system("gunzip pdbaa.tar.gz")
os.system("tar -xvf pdbaa.tar")
os.system("mv pdbaa.* %smisc" % addSlashIfNeeded(sys.argv[2]))
else:
print USAGE