Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 11. Protein Data Bank > PDB Files - Pg. 248

As a final example of processing files with Perl, here's the same functionality as the preceding programs, with a one-line program, issued at the command line: perl -e 'use File::Find;find sub{-f and (print $File::Find::name,"\n")},("pdb")' Pretty cool, for those who admire terseness, although it doesn't really eschew obfus- cation. Also note that for those on Unix systems, ls -R pdb and find pdb -print do the same thing with even less typing. File::Find is designed to call your own subroutines, because it enables you to per- form any arbitrary tests on the files you find and then take any actions with those files. It's another case of modularization: the File::Find module makes it easy to recurse over all the files and directories in a file structure and lets you do as you wish with the files and directories you find. PDB Files Here's a section of an actual PDB file: HEADER TITLE COMPND COMPND COMPND COMPND COMPND SUGAR BINDING PROTEIN 03-MAR-99 1C1F LIGAND-FREE CONGERIN I MOL_ID: 1; 2 MOLECULE: CONGERIN I; 3 CHAIN: A; 4 FRAGMENT: CARBOHYDRATE-RECOGNITION-DOMAIN; 5 BIOLOGICAL_UNIT: HOMODIMER