Hello,
My question may be simple. But I think others could benefit from having this skill, and I'm not quite sure how to separate these files once I get them. So I was looking through a molecular dynamics paper and I noticed that the authors used a lot of PDB files so I wanted to take those files and retrieve them with curl (c uniform resource locater).
If I just call this command then in my terminal I can see all the PDB files from the protein data bank that I am interested in, where the curly braces specify different files in the basic file extension.
$ sudo curl "http://files.rcsb.org/view/{1PPE,1AVW,1BRC,1CGI,1TGS,1TAB,2PTC,2SIC,1DFJ,2SNI,1UGH,1CHO,1
ACB,2TEC,4HTC,1CSE,1MAH,1FSS,1BRS,1DFJ}.pdb"
If I create an empty file named "enzyme_inhibitor_complexes, and redirect the output sequentially with " >> " (instead of overwriting the file multiple times with " > " which would not be good!) so that 1PPE is dumped into enzyme_inhibitor_complexes, then 1AVW, and finally 1DFJ, then I can dump all the information from the pdb files into the enzyme_inhibitor_complexes file one after another.
$ curl "http://files.rcsb.org/view/{1PPE,1AVW,1BRC,1CGI,1TGS,1TAB,2PTC,2SIC,1DFJ,2SNI,1UGH,1CHO,1
ACB,2TEC,4HTC,1CSE,1MAH,1FSS,1BRS,1DFJ}.pdb" >> enzyme_inhibitor_complexes
But now I want to separate the files into their own pdb files, such as 1PPE.pdb, 1AVW.pdb, 1BRC.pdb, and so forth. I would rather not have all the files in one big file. I felt that I had to do that compromise to collect all the pdb information.
For example, if I just wanted to download and save one of the files, then that would be easy.
$ curl "http://files.rcsb.org/view/1CGI.pdb" -o 1CGI.pdb,
where "-o" designates the output file.
It seems like it would be useful to use a scripting perl or python "for loop", but I don't know how I would make one for this "curl" application.
Obviously, it's more tedious to learn how to do this than downloading all the files individually from my web browser, but if I can learn how to do this, then I would save a lot of time in the long run as I work with pdb files in my bioinformatics career.
Thank you! Your help is much appreciated!
- Adron