Creating Image Of Many Pdb Files
2
2
Entering edit mode
11.2 years ago
Pappu ★ 2.1k

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 • 5.7k views
ADD COMMENT
5
Entering edit mode
11.2 years ago

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:

ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode
11.2 years ago
João Rodrigues ★ 2.5k

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.

ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

Traffic: 1797 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6