def download_sifts_xml(pdb_id, outdir='', outfile=''):
"""Download the SIFTS file for a PDB ID.
Args:
pdb_id:
outdir:
outfile:
Returns:
"""
baseURL = 'ftp://ftp.ebi.ac.uk/pub/databases/msd/sifts/xml/'
filename = '{}.xml.gz'.format(pdb_id)
if outfile:
outfile = op.join(outdir, outfile)
else:
outfile = op.join(outdir, filename.split('.')[0] + '.sifts.xml')
if not op.exists(outfile):
response = urlopen(baseURL + filename)
with open(outfile, 'wb') as f:
f.write(gzip.decompress(response.read()))
return outfile
评论列表
文章目录