This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Creating Image Of Many Pdb Files

I have a list of >50 pdb ids. I need to make a single png image containing pictures of these pdb files with their ids. I am wondering if there is any way to do that.

pdb

2 answers

Using the following makefile (it calls Imagemagick ):

IDS=1A7W  3CFS 3CFV 2P3K  4DRV   4DS0  2P3I  4DRR 4F5X 
.PHONY: all clean

%.jpg:
    curl -o $@ "http://www.rcsb.org/pdb/images/$(basename $@)_bio_r_500.jpg?bioNum=1"
    convert  -draw "text 10,10 '$(basename $@)'" $@ $@

all: result.jpg

##
## see http://www.sitepoint.com/forums/showthread.php?469594-imagemagick-How-can-I-mosaic-9-JPGs-into-one-JPG
##
result.jpg: $(addsuffix .jpg,${IDS})
    montage  $^  -tile x5 $@


clean:
    rm -f result.jpg $(addsuffix .jpg,${IDS})

Result:

Thanks a lot. However when I try to run it I get the following error in ubuntu: makefile:6: * missing separator. Stop.

you've used a space instead of a tab: http://www.gnu.org/software/make/manual/html_node/Error-Messages.html

One of the most common reasons for this message is that you (or perhaps your oh-so-helpful editor, as is the case with many MS-Windows editors) have attempted to indent your recipe lines with spaces instead of a tab character. In this case, make will use the second form of the error above. Remember that every line in the recipe must begin with a tab character (unless you set .RECIPEPREFIX; see Special Variables). Eight spaces do not count. See Rule Syntax.

Thank you. It works now. I am wondering how to improve the quality of the picture. I would rather render them in PyMOL and combine them by imagemagick.

" am wondering how to improve the quality of the picture." : look at the manuals of convert and montage

Get PyMOL, learn the 'fetch', 'ray, and 'png' commands. You can write a Python script to get high quality pictures in succession (check PyMOL scripting). The ID can be added as a label. For the 'grid' like view, check the grid_mode, grid_slot, and grid_max commands.

This would be the best way of doing it. Not only because you can pre-process the PDB files and have exactly what you need, you can define particular orientations for each molecule.

I am wondering if there is any automatic way to only render monomers from the pdb.

Only monomers? Download only monomers from the PDB. Using the advanced search you can modulate the query and get only monomers, dimers, protein, rna, etc. Just get the IDs and then use what I described above. Otherwise you'll have to find a way of removing the chains that are superfluous (xtal copies) by comparing sequences for example. Much harder to be honest.

Log in to answer this question.