我一直在尝试使用名为Abnum的编号服务器自动重新编号pdb文件。它们声明:要对结构编号,必须以POST格式传递参数并使用enctype =“multipart / form-data”。它适用于单个序列,但上传pdb文件(纯文本文件)仍然是个问题。
我的代码:
import requests
rel_path = "PDB_mono"
rel_path2 = "1A5F.pdb"
i = os.path.abspath(__file__)
g = os.getcwd()
mypath = os.path.join(g,rel_path)
mypath = os.path.join(mypath,rel_path2)
print mypath
url = 'http://www.bioinf.org.uk/cgi-bin/abnum/abnumpdb.pl?plain=1&pdb=1A5F.pdb&scheme=-a&output=-l'
files = {'file': open('1A5F.pdb', 'rb')}
r=requests.post(url, files={'file': open(mypath)}).content
print r
MYFILE:
mypath =F:\Leuven\Python\PDB_mono\1A5F.pdb
响应:
<html>
<head>
<title>AbNum results</title>
<link rel='stylesheet' href='/bo.css' />
</head>
<body>
<h1>Abnum: PDB numbering</h1>
<h3>There was an error in your submission</h3>
<pre>
Either the PDB file you specified did not exist, or contained no ATOM records
</pre>
<p>Click the browser "Back" button to return to the form and correct your error.</p>
</body>
</html>
</body>
</html>
我正在使用Windows 7,python 2.7。
我真的很感激回应,或者至少有一些指向正确的方向
示例PDB文件:
您可以将其作为文本文件下载到右侧。这是一个包含原子坐标的简单文件