File not found when said file exists

179 views Asked by At

Part of a new program that I am creating downloads cif files (crystallized structures of protein molecules), and as part of the processing step I need to convert the filetype to pdb. According to biopython documentation, I can convert them using the following block of code;

            cifname = pdbid + ".cif"
            pdbname = pdbid + ".pdb"
            p = PDBParser()
            struc = p.get_structure("", cifname)
            io = MMCIFIO()
            io.set_structure(struc)
            io.save(pdbname)

Unfortunately, I recieve the error message "No such file or directory: '7kzp.cif'" when attempting to parse the file, despite the fact that a file of that exact name is present on my machine. I have opened directly to the directory with os commands, but the code still cannot find the file (or any cif file) despite them existing by name on my system. How can I go about fixing this?

EDIT- Passing the full file path name to the command gives the error

ValueError: invalid literal for int() with base 10: '.'

and none of the tutorials I have seen use the full path, just the file name

1

There are 1 answers

0
Anderson On

Try putting the file into the application's start directory, or specify the full path of your .cif file.