This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Pdbs Not Downloading Into The Correct Location

I'm using the code below to create a folder and then download the assocated PDBs with that protein. The problem I'm having is the PDBs are downloaded into the wrong location. They are downloaded into the loaction with the python script and not into the Cytochrome_C folder.

pdbs = [
['Cytochrome_C']
['1giw','TITLE']
['1lc1','TITLE']
['1lc2','TITLE']
]

for pdb in pdbs:

    if str(pdb[0]) == 'Cytochrome_C':
        os.popen('mkdir Cytochrome_C')
        os.popen('cd ./Cytochrome_C')


    if len(pdb) == 2:
        os.popen('wget <http://www.pdb.org/pdb/files/%s.pdb'> % (str(pdb[0])))
pdb python

1 answer

Try changing:

os.popen('cd ./Cytochrome_C')

to:

os.chdir('Cytochrome_C')

D'oh! Silly me.

Log in to answer this question.