1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724
|
#LyX 1.3 created this file. For more info see http://www.lyx.org/
\lyxformat 221
\textclass article
\begin_preamble
% header
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{Structural Biopython FAQ}
\rhead{}
% remove date
\date{}
% make everything have section numbers
% Make links between references
\usepackage{hyperref}
\newif\ifpdf
\ifx\pdfoutput\undefined
\pdffalse
\else
\pdfoutput=1
\pdftrue
\fi
\ifpdf
\hypersetup{colorlinks=true, hyperindex=true, citecolor=red, urlcolor=blue}
\fi
\end_preamble
\language english
\inputencoding auto
\fontscheme bookman
\graphics default
\paperfontsize default
\spacing single
\papersize a4paper
\paperpackage a4
\use_geometry 1
\use_amsmath 0
\use_natbib 0
\use_numerical_citations 0
\paperorientation portrait
\topmargin 20mm
\bottommargin 20mm
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 1
\papercolumns 1
\papersides 1
\paperpagestyle default
\layout Title
\size huge
The Biopython
\newline
Structural Bioinformatics FAQ
\layout Author
Thomas Hamelryck
\layout Author
\size normal
Bioinformatics center
\newline
Institute of Molecular Biology
\newline
University of Copenhagen
\newline
Universitetsparken 15, Bygning 10
\newline
DK-2100 Kbenhavn
\newline
Denmark
\newline
thamelry@binf.ku.dk
\size default
\newline
\begin_inset LatexCommand \url{http://www.binf.ku.dk/users/thamelry/}
\end_inset
\layout Section
Introduction
\layout Standard
The Biopython Project is an international association of developers of freely
available Python (
\begin_inset LatexCommand \url{http://www.python.org}
\end_inset
) tools for computational molecular biology.
Python is an object oriented, interpreted, flexible language that is becoming
increasingly popular for scientific computing.
Python is easy to learn, has a very clear syntax and can easily be extended
with modules written in C, C++ or FORTRAN.
\layout Standard
The Biopython web site (
\begin_inset LatexCommand \url{http://www.biopython.org}
\end_inset
) provides an online resource for modules, scripts, and web links for developers
of Python-based software for bioinformatics use and research.
Basically, the goal of biopython is to make it as easy as possible to use
python for bioinformatics by creating high-quality, reusable modules and
classes.
Biopython features include parsers for various Bioinformatics file formats
(BLAST, Clustalw, FASTA, Genbank,...), access to online services (NCBI, Expasy,...),
interfaces to common and not-so-common programs (Clustalw, DSSP, MSMS...),
a standard sequence class, various clustering modules, a KD tree data structure
etc.
and even documentation.
\layout Standard
Bio.PDB is a biopython module that focuses on working with crystal structures
of biological macromolecules.
This document gives a fairly complete overview of Bio.PDB.
\layout Section
Bio.PDB's installation
\layout Standard
Bio.PDB is automatically installed as part of Biopython.
Biopython can be obtained from
\begin_inset LatexCommand \url{http://www.biopython.org}
\end_inset
.
It runs on many platforms (Linux/Unix, windows, Mac,...).
\layout Section
Who's using Bio.PDB?
\layout Standard
Bio.PDB was used in the construction of DISEMBL, a web server that predicts
disordered regions in proteins (
\begin_inset LatexCommand \url{http://dis.embl.de/}
\end_inset
), and COLUMBA, a website that provides annotated protein structures (
\begin_inset LatexCommand \url{http://www.columba-db.de/}
\end_inset
).
Bio.PDB has also been used to perform a large scale search for active sites
similarities between protein structures in the PDB (see
\shape italic
Proteins Struct.
Func.
Gen.
\shape default
,
\series bold
2003
\series default
, 51, 96-108), and to develop a new algorithm that identifies linear secondary
structure elements (
\emph on
BMC Bioinformatics
\emph default
,
\series bold
2005
\series default
, 6, 202,
\begin_inset LatexCommand \url{http://www.biomedcentral.com/1471-2105/6/202}
\end_inset
).
\layout Standard
Judging from requests for features and information, Bio.PDB is also used
by several LPCs (Large Pharmaceutical Companies :-).
\layout Section
Is there a Bio.PDB reference?
\layout Standard
Yes, and I'd appreciate it if you would refer to Bio.PDB in publications
if you make use of it.
The reference is:
\layout Quote
Hamelryck, T., Manderick, B.
(2003) PDB parser and structure class implemented in Python.
\shape italic
Bioinformatics
\shape default
,
\series bold
19
\series default
, 2308-2310.
\layout Standard
The article can be freely downloaded via the Bioinformatics journal website
(
\begin_inset LatexCommand \url{http://www.binf.ku.dk/users/thamelry/references.html}
\end_inset
).
I welcome e-mails telling me what you are using Bio.PDB for.
Feature requests are welcome too.
\layout Section
How well tested is Bio.PDB?
\layout Standard
Pretty well, actually.
Bio.PDB has been extensively tested on nearly 5500 structures from the PDB
- all structures seemed to be parsed correctly.
More details can be found in the Bio.PDB Bioinformatics article.
Bio.PDB has been used/is being used in many research projects as a reliable
tool.
In fact, I'm using Bio.PDB almost daily for research purposes and continue
working on improving it and adding new features.
\layout Section
How fast is it?
\layout Standard
The
\family typewriter
PDBParser
\family default
performance was tested on about 800 structures (each belonging to a unique
SCOP superfamily).
This takes about 20 minutes, or on average 1.5 seconds per structure.
Parsing the structure of the large ribosomal subunit (1FKK), which contains
about 64000 atoms, takes 10 seconds on a 1000 MHz PC.
In short: it's more than fast enough for many applications.
\layout Section
Why should I use Bio.PDB?
\layout Standard
Bio.PDB might be exactly what you want, and then again it might not.
If you are interested in data mining the PDB header, you might want to
look elsewhere because there is only limited support for this.
If you look for a powerful, complete data structure to access the atomic
data Bio.PDB is probably for you.
\layout Section
Usage
\layout Subsection
General questions
\layout Subsubsection*
Importing Bio.PDB
\layout Standard
That's simple:
\layout LyX-Code
from Bio.PDB import *
\layout Subsubsection*
Is there support for molecular graphics?
\layout Standard
Not directly, mostly since there are quite a few Python based/Python aware
solutions already, that can potentially be used with Bio.PDB.
My choice is Pymol, BTW (I've used this successfully with Bio.PDB, and there
will probably be specific PyMol modules in Bio.PDB soon/some day).
Python based/aware molecular graphics solutions include:
\layout Itemize
PyMol:
\begin_inset LatexCommand \url{http://pymol.sourceforge.net/}
\end_inset
\layout Itemize
Chimera:
\begin_inset LatexCommand \url{http://www.cgl.ucsf.edu/chimera/}
\end_inset
\layout Itemize
PMV:
\begin_inset LatexCommand \url{http://www.scripps.edu/~sanner/python/}
\end_inset
\layout Itemize
Coot:
\begin_inset LatexCommand \url{http://www.ysbl.york.ac.uk/~emsley/coot/}
\end_inset
\layout Itemize
CCP4mg:
\begin_inset LatexCommand \url{http://www.ysbl.york.ac.uk/~lizp/molgraphics.html}
\end_inset
\layout Itemize
mmLib:
\begin_inset LatexCommand \url{http://pymmlib.sourceforge.net/}
\end_inset
\layout Itemize
VMD:
\begin_inset LatexCommand \url{http://www.ks.uiuc.edu/Research/vmd/}
\end_inset
\layout Itemize
MMTK:
\begin_inset LatexCommand \url{http://starship.python.net/crew/hinsen/MMTK/}
\end_inset
\layout Standard
I'd be crazy to write another molecular graphics application (been there
- done that, actually :-).
\layout Subsection
Input/output
\layout Subsubsection*
How do I create a structure object from a PDB file?
\layout Standard
First, create a
\family typewriter
PDBParser
\family default
object:
\layout LyX-Code
parser=PDBParser()
\layout Standard
Then, create a structure object from a PDB file in the following way (the
PDB file in this case is called '1FAT.pdb', 'PHA-L' is a user defined name
for the structure):
\layout LyX-Code
structure=parser.get_structure('PHA-L', '1FAT.pdb')
\layout Subsubsection*
How do I create a structure object from an mmCIF file?
\layout Standard
Similarly to the case the case of PDB files, first create an
\family typewriter
MMCIFParser
\family default
object:
\layout LyX-Code
parser=MMCIFParser()
\layout Standard
Then use this parser to create a structure object from the mmCIF file:
\layout LyX-Code
structure=parser.get_structure('PHA-L', '1FAT.cif')
\layout Subsubsection*
...and what about the new PDB XML format?
\layout Standard
That's not yet supported, but I'm definitely planning to support that in
the future (it's not a lot of work).
Contact me if you need this, it might encourage me :-).
\layout Subsubsection*
I'd like to have some more low level access to an mmCIF file...
\layout Standard
You got it.
You can create a python dictionary that maps all mmCIF tags in an mmCIF
file to their values.
If there are multiple values (like in the case of tag
\family typewriter
_atom_site.Cartn_y
\family default
, which holds the y coordinates of all atoms), the tag is mapped to a list
of values.
The dictionary is created from the mmCIF file as follows:
\layout LyX-Code
mmcif_dict=MMCIF2Dict('1FAT.cif')
\layout Standard
Example: get the solvent content from an mmCIF file:
\layout LyX-Code
sc=mmcif_dict['_exptl_crystal.density_percent_sol']
\layout Standard
Example: get the list of the y coordinates of all atoms
\layout LyX-Code
y_list=mmcif_dict['_atom_site.Cartn_y']
\layout Subsubsection*
Can I access the header information?
\layout Standard
Thanks to Christian Rother you can access some information from the PDB
header.
Note however that many PDB files contain headers with incomplete or erroneous
information.
Many of the errors have been fixed in the equivalent mmCIF files.
\emph on
Hence, if you are interested in the header information, it is a good idea
to extract information from mmCIF files using the
\family typewriter
MMCIF2Dict
\family default
tool described above, instead of parsing the PDB header.
\layout Standard
Now that is clarified, let's return to parsing the PDB header.
The structure object has an attribute called
\family typewriter
header
\family default
which is a python dictionary that maps header records to their values.
\layout Standard
Example:
\layout LyX-Code
resolution=structure.header['resolution']
\layout LyX-Code
keywords=structure.header['keywords']
\layout Standard
The available keys are
\family typewriter
name, head, deposition_\SpecialChar \-
date, release_\SpecialChar \-
date, structure_\SpecialChar \-
method, resolution,
structure_\SpecialChar \-
reference
\family default
(maps to a list of references),
\family typewriter
journal_\SpecialChar \-
reference, author
\family default
and
\family typewriter
compound
\family default
(maps to a dictionary with various information about the crystallized compound).
\layout Standard
The dictionary can also be created without creating a
\family typewriter
Structure
\family default
object, ie.
directly from the PDB file:
\layout LyX-Code
file=open(filename,'r')
\layout LyX-Code
header_dict=parse_pdb_header(file)
\layout LyX-Code
file.close()
\layout Subsubsection*
Can I use Bio.PDB with NMR structures (ie.
with more than one model)?
\layout Standard
Sure.
Many PDB parsers assume that there is only one model, making them all but
useless for NMR structures.
The design of the
\family typewriter
Structure
\family default
object makes it easy to handle PDB files with more than one model (see
section
\begin_inset LatexCommand \ref{sub:The-Structure-object}
\end_inset
).
\layout Subsubsection*
How do I download structures from the PDB?
\layout Standard
This can be done using the
\family typewriter
PDBList
\family default
object, using the
\family typewriter
retrieve_pdb_file
\family default
method.
The argument for this method is the PDB identifier of the structure.
\layout LyX-Code
pdbl=PDBList()
\layout LyX-Code
pdbl.retrieve_pdb_file('1FAT')
\layout Standard
The
\family typewriter
PDBList
\family default
class can also be used as a command-line tool:
\layout LyX-Code
python PDBList.py 1fat
\layout Standard
The downloaded file will be called
\family typewriter
pdb1fat.ent
\family default
and stored in the current working directory.
Note that the
\family typewriter
retrieve_pdb_file
\family default
method also has an optional argument
\family typewriter
pdir
\family default
that specifies a specific directory in which to store the downloaded PDB
files.
\layout Standard
The
\family typewriter
retrieve_pdb_file
\family default
method also has some options to specify the compression format used for
the download, and the program used for local decompression (default
\family typewriter
.Z
\family default
format and
\family typewriter
gunzip
\family default
).
In addition, the PDB ftp site can be specified upon creation of the
\family typewriter
PDBList
\family default
object.
By default, the RCSB PDB server (
\begin_inset LatexCommand \url{ftp://ftp.rcsb.org/pub/pdb/data/structures/divided/pdb/}
\end_inset
) is used.
See the API documentation for more details.
Thanks again to Kristian Rother for donating this module.
\layout Subsubsection*
How do I download the entire PDB?
\layout Standard
The following commands will store all PDB files in the
\family typewriter
/data/pdb
\family default
directory:
\layout LyX-Code
python PDBList.py all /data/pdb
\layout LyX-Code
python PDBList.py all /data/pdb -d
\layout Standard
\noindent
The API method for this is called
\family typewriter
download_entire_pdb
\family default
.
Adding the
\family typewriter
-d
\family default
option will store all files in the same directory.
Otherwise, they are sorted into PDB-style subdirectories according to their
PDB ID's.
Depending on the traffic, a complete download will take 2-4 days.
\layout Subsubsection*
How do I keep a local copy of the PDB up-to-date?
\layout Standard
This can also be done using the
\family typewriter
PDBList
\family default
object.
One simply creates a
\family typewriter
PDBList
\family default
object (specifying the directory where the local copy of the PDB is present)
and calls the
\family typewriter
update_pdb
\family default
method:
\layout LyX-Code
pl=PDBList(pdb='/data/pdb')
\layout LyX-Code
pl.update_pdb()
\layout Standard
One can of course make a weekly
\family typewriter
cronjob
\family default
out of this to keep the local copy automatically up-to-date.
The PDB ftp site can also be specified (see API documentation).
\layout Standard
\family typewriter
PDBList
\family default
has some additional methods that can be of use.
The
\family typewriter
get_all_obsolete
\family default
method can be used to get a list of all obsolete PDB entries.
The
\family typewriter
changed_this_week
\family default
method can be used to obtain the entries that were added, modified or obsoleted
during the current week.
For more info on the possibilities of
\family typewriter
PDBList
\family default
, see the API documentation.
\layout Subsubsection*
What about all those buggy PDB files?
\layout Standard
It is well known that many PDB files contain semantic errors (I'm not talking
about the structures themselves know, but their representation in PDB files).
Bio.PDB tries to handle this in two ways.
The PDBParser object can behave in two ways: a restrictive way and a permissive
way (THIS IS NOW THE DEFAULT).
The restrictive way used to be the default, but people seemed to think
that Bio.PDB 'crashed' due to a bug (hah!), so I changed it.
If you ever encounter a real bug, please tell me immediately!
\layout Standard
Example:
\layout LyX-Code
# Permissive parser
\layout LyX-Code
parser=PDBParser(PERMISSIVE=1)
\layout LyX-Code
parser=PDBParser() # The same (default)
\layout LyX-Code
# Strict parser
\layout LyX-Code
strict_parser=PDBParser(PERMISSIVE=0)
\layout Standard
In the permissive state (DEFAULT), PDB files that obviously contain errors
are 'corrected' (ie.
some residues or atoms are left out).
These errors include:
\layout Itemize
Multiple residues with the same identifier
\layout Itemize
Multiple atoms with the same identifier (taking into account the altloc
identifier)
\layout Standard
These errors indicate real problems in the PDB file (for details see the
Bioinformatics article).
In the restrictive state, PDB files with errors cause an exception to occur.
This is useful to find errors in PDB files.
\layout Standard
Some errors however are automatically corrected.
Normally each disordered atom should have a non-blanc altloc identifier.
However, there are many structures that do not follow this convention,
and have a blank and a non-blank identifier for two disordered positions
of the same atom.
This is automatically interpreted in the right way.
\layout Standard
Sometimes a structure contains a list of residues belonging to chain A,
followed by residues belonging to chain B, and again followed by residues
belonging to chain A, i.e.
the chains are 'broken'.
This is also correctly interpreted.
\layout Subsubsection*
Can I write PDB files?
\layout Standard
Use the PDBIO class for this.
It's easy to write out specific parts of a structure too, of course.
\layout Standard
Example: saving a structure
\layout LyX-Code
io=PDBIO()
\layout LyX-Code
io.set_structure(s)
\layout LyX-Code
io.save('out.pdb')
\layout Standard
If you want to write out a part of the structure, make use of the
\family typewriter
Select
\family default
class (also in
\family typewriter
PDBIO
\family default
).
Select has four methods:
\layout LyX-Code
accept_model(model)
\layout LyX-Code
accept_chain(chain)
\layout LyX-Code
accept_residue(residue)
\layout LyX-Code
accept_atom(atom)
\layout Standard
By default, every method returns 1 (which means the model/\SpecialChar \-
chain/\SpecialChar \-
residue/\SpecialChar \-
atom
is included in the output).
By subclassing
\family typewriter
Select
\family default
and returning 0 when appropriate you can exclude models, chains, etc.
from the output.
Cumbersome maybe, but very powerful.
The following code only writes out glycine residues:
\layout LyX-Code
class GlySelect(Select):
\layout LyX-Code
def accept_residue(self, residue):
\layout LyX-Code
if residue.get_name()=='GLY':
\layout LyX-Code
return 1
\layout LyX-Code
else:
\layout LyX-Code
return 0
\layout LyX-Code
\layout LyX-Code
io=PDBIO()
\layout LyX-Code
io.set_structure(s)
\layout LyX-Code
io.save('gly_only.pdb', GlySelect())
\layout Standard
If this is all too complicated for you, the
\family typewriter
Dice
\family default
module contains a handy
\family typewriter
extract
\family default
function that writes out all residues in a chain between a start and end
residue.
\layout Subsubsection*
Can I write mmCIF files?
\layout Standard
No, and I also don't have plans to add that functionality soon (or ever
- I don't need it at all, and it's a lot of work, plus no-one has ever
asked for it).
People who want to add this can contact me.
\layout Subsection
The Structure object
\begin_inset LatexCommand \label{sub:The-Structure-object}
\end_inset
\layout Subsubsection*
What's the overall layout of a Structure object?
\layout Standard
The
\family typewriter
Structure
\family default
object follows the so-called
\family typewriter
SMCRA
\family default
(Structure/\SpecialChar \-
Model/\SpecialChar \-
Chain/\SpecialChar \-
Residue/\SpecialChar \-
Atom) architecture :
\layout Itemize
A structure consists of models
\layout Itemize
A model consists of chains
\layout Itemize
A chain consists of residues
\layout Itemize
A residue consists of atoms
\layout Standard
This is the way many structural biologists/bioinformaticians think about
structure, and provides a simple but efficient way to deal with structure.
Additional stuff is essentially added when needed.
A UML diagram of the
\family typewriter
Structure
\family default
object (forget about the
\family typewriter
Disordered
\family default
classes for now) is shown in Fig.
\begin_inset LatexCommand \ref{cap:SMCRA}
\end_inset
.
\layout Standard
\begin_inset Float figure
placement tbh
wide false
collapsed false
\layout Standard
\align center
\begin_inset Graphics
filename images/smcra.png
lyxscale 50
width 100mm
keepAspectRatio
\end_inset
\layout Caption
\begin_inset LatexCommand \label{cap:SMCRA}
\end_inset
UML diagram of SMCRA architecture of the
\family typewriter
Structure
\family default
object.
Full lines with diamonds denote aggregation, full lines with arrows denote
referencing, full lines with triangles denote inheritance and dashed lines
with triangles denote interface realization.
\end_inset
\layout Subsubsection*
How do I navigate through a Structure object?
\layout Standard
The following code iterates through all atoms of a structure:
\layout LyX-Code
p=PDBParser()
\layout LyX-Code
structure=p.get_structure('X', 'pdb1fat.ent')
\layout LyX-Code
for model in structure:
\layout LyX-Code
for chain in model:
\layout LyX-Code
for residue in chain:
\layout LyX-Code
for atom in residue:
\layout LyX-Code
print atom
\layout Standard
There are also some shortcuts:
\layout LyX-Code
# Iterate over all atoms in a structure
\layout LyX-Code
for atom in structure.get_atoms():
\layout LyX-Code
print atom
\layout LyX-Code
# Iterate over all residues in a model
\layout LyX-Code
for residue in model.get_residues():
\layout LyX-Code
print residue
\layout Standard
Structures, models, chains, residues and atoms are called
\family typewriter
Entities
\family default
in Biopython.
You can always get a parent
\family typewriter
Entity
\family default
from a child
\family typewriter
Entity
\family default
, eg.:
\layout LyX-Code
residue=atom.get_parent()
\layout LyX-Code
chain=residue.get_parent()
\layout Standard
You can also test wether an
\family typewriter
Entity
\family default
has a certain child using the
\family typewriter
has_id
\family default
method.
\layout Subsubsection*
Can I do that a bit more conveniently?
\layout Standard
You can do things like:
\layout LyX-Code
atoms=structure.get_atoms()
\layout LyX-Code
residue=structure.get_residues()
\layout LyX-Code
atoms=chain.get_atoms()
\layout Standard
You can also use the
\family typewriter
Selection.unfold_entities
\family default
function:
\layout LyX-Code
# Get all residues from a structure
\layout LyX-Code
res_list=Selection.unfold_entities(structure, 'R')
\layout LyX-Code
# Get all atoms from a chain
\layout LyX-Code
atom_list=Selection.unfold_entities(chain, 'A')
\layout Standard
Obviously,
\family typewriter
A=atom, R=residue, C=chain, M=model, S=structure
\family default
.
You can use this to go up in the hierarchy, eg.
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
\end_inset
to get a list of (unique)
\family typewriter
Residue
\family default
or
\family typewriter
Chain
\family default
parents from a list of
\family typewriter
Atoms
\family default
:
\layout LyX-Code
residue_list=Selection.unfold_entities(atom_list, 'R')
\layout LyX-Code
chain_list=Selection.unfold_entities(atom_list, 'C')
\layout Standard
For more info, see the API documentation.
\layout Subsubsection*
How do I extract a specific
\family typewriter
Atom/\SpecialChar \-
Residue/\SpecialChar \-
Chain/\SpecialChar \-
Model
\family default
from a Structure?
\layout Standard
Easy.
Here are some examples:
\layout LyX-Code
model=structure[0]
\layout LyX-Code
chain=model['A']
\layout LyX-Code
residue=chain[100]
\layout LyX-Code
atom=residue['CA']
\layout Standard
Note that you can use a shortcut:
\layout LyX-Code
atom=structure[0]['A'][100]['CA']
\layout Subsubsection*
What is a model id?
\layout Standard
The model id is an integer which denotes the rank of the model in the PDB/mmCIF
file.
The model is starts at 0.
Crystal structures generally have only one model (with id 0), while NMR
files usually have several models.
\layout Subsubsection*
What is a chain id?
\layout Standard
The chain id is specified in the PDB/mmCIF file, and is a single character
(typically a letter).
\layout Subsubsection*
What is a residue id?
\layout Standard
This is a bit more complicated, due to the clumsy PDB format.
A residue id is a tuple with three elements:
\layout Itemize
The
\series bold
hetero-flag
\series default
: this is
\family typewriter
'H_'
\family default
plus the name of the hetero-residue (eg.
\family typewriter
'H_GLC'
\family default
in the case of a glucose molecule), or
\family typewriter
'W'
\family default
in the case of a water molecule.
\layout Itemize
The
\series bold
sequence identifier
\series default
in the chain, eg.
100
\layout Itemize
The
\series bold
insertion code
\series default
, eg.
'A'.
The insertion code is sometimes used to preserve a certain desirable residue
numbering scheme.
A Ser 80 insertion mutant (inserted e.g.
between a Thr 80 and an Asn 81 residue) could e.g.
have sequence identifiers and insertion codes as follows: Thr 80 A, Ser
80 B, Asn 81.
In this way the residue numbering scheme stays in tune with that of the
wild type structure.
\layout Standard
The id of the above glucose residue would thus be
\family typewriter
('H_GLC', 100, 'A')
\family default
.
If the hetero-flag and insertion code are blanc, the sequence identifier
alone can be used:
\layout LyX-Code
# Full id
\layout LyX-Code
residue=chain[(' ', 100, ' ')]
\layout LyX-Code
# Shortcut id
\layout LyX-Code
residue=chain[100]
\layout Standard
The reason for the hetero-flag is that many, many PDB files use the same
sequence identifier for an amino acid and a hetero-residue or a water,
which would create obvious problems if the hetero-flag was not used.
\layout Subsubsection*
What is an atom id?
\layout Standard
The atom id is simply the atom name (eg.
\family typewriter
'CA'
\family default
).
In practice, the atom name is created by stripping all spaces from the
atom name in the PDB file.
\layout Standard
However, in PDB files, a space can be part of an atom name.
Often, calcium atoms are called
\family typewriter
'CA..'
\family default
in order to distinguish them from C
\begin_inset Formula $\alpha$
\end_inset
atoms (which are called
\family typewriter
'.CA.'
\family default
).
In cases were stripping the spaces would create problems (ie.
two atoms called
\family typewriter
'CA'
\family default
in the same residue) the spaces are kept.
\layout Subsubsection*
How is disorder handled?
\layout Standard
This is one of the strong points of Bio.PDB.
It can handle both disordered atoms and point mutations (ie.
a Gly and an Ala residue in the same position).
\layout Standard
Disorder should be dealt with from two points of view: the atom and the
residue points of view.
In general, I have tried to encapsulate all the complexity that arises
from disorder.
If you just want to loop over all C
\begin_inset Formula $\alpha$
\end_inset
atoms, you do not care that some residues have a disordered side chain.
On the other hand it should also be possible to represent disorder completely
in the data structure.
Therefore, disordered atoms or residues are stored in special objects that
behave as if there is no disorder.
This is done by only representing a subset of the disordered atoms or residues.
Which subset is picked (e.g.
which of the two disordered OG side chain atom positions of a Ser residue
is used) can be specified by the user.
\layout Standard
\series bold
Disordered atom positions
\series default
are represented by ordinary
\family typewriter
Atom
\family default
objects, but all
\family typewriter
Atom
\family default
objects that represent the same physical atom are stored in a
\family typewriter
Disordered\SpecialChar \-
Atom
\family default
object (see Fig.
\begin_inset LatexCommand \ref{cap:SMCRA}
\end_inset
).
Each
\family typewriter
Atom
\family default
object in a
\family typewriter
Disordered\SpecialChar \-
Atom
\family default
object can be uniquely indexed using its altloc specifier.
The
\family typewriter
Disordered\SpecialChar \-
Atom
\family default
object forwards all uncaught method calls to the selected Atom object,
by default the one that represents the atom with the highest occupancy.
The user can of course change the selected
\family typewriter
Atom
\family default
object, making use of its altloc specifier.
In this way atom disorder is represented correctly without much additional
complexity.
In other words, if you are not interested in atom disorder, you will not
be bothered by it.
\layout Standard
Each disordered atom has a characteristic altloc identifier.
You can specify that a
\family typewriter
Disordered\SpecialChar \-
Atom
\family default
object should behave like the
\family typewriter
Atom
\family default
object associated with a specific altloc identifier:
\layout LyX-Code
atom.disordered_select('A') # select altloc A atom
\layout LyX-Code
atom.disordered_select('B') # select altloc B atom
\layout Standard
A special case arises when disorder is due to
\series bold
point mutations
\series default
, i.e.
when two or more point mutants of a polypeptide are present in the crystal.
An example of this can be found in PDB structure 1EN2.
\layout Standard
Since these residues belong to a different residue type (e.g.
let's say Ser 60 and Cys 60) they should not be stored in a single
\family typewriter
Residue
\family default
object as in the common case.
In this case, each residue is represented by one
\family typewriter
Residue
\family default
object, and both
\family typewriter
Residue
\family default
objects are stored in a single
\family typewriter
Disordered\SpecialChar \-
Residue
\family default
object (see Fig.
\begin_inset LatexCommand \ref{cap:SMCRA}
\end_inset
).
\layout Standard
The
\family typewriter
Dis\SpecialChar \-
ordered\SpecialChar \-
Residue
\family default
object forwards all un\SpecialChar \-
caught methods to the selected
\family typewriter
Residue
\family default
object (by default the last
\family typewriter
Residue
\family default
object added), and thus behaves like an ordinary residue.
Each
\family typewriter
Residue
\family default
object in a
\family typewriter
Disordered\SpecialChar \-
Residue
\family default
object can be uniquely identified by its residue name.
In the above example, residue Ser 60 would have id 'SER' in the
\family typewriter
Disordered\SpecialChar \-
Residue
\family default
object, while residue Cys 60 would have id 'CYS'.
The user can select the active
\family typewriter
Residue
\family default
object in a
\family typewriter
Disordered\SpecialChar \-
Residue
\family default
object via this id.
\layout Standard
Example: suppose that a chain has a point mutation at position 10, consisting
of a Ser and a Cys residue.
Make sure that residue 10 of this chain behaves as the Cys residue.
\layout LyX-Code
residue=chain[10]
\layout LyX-Code
residue.disordered_select('CYS')
\layout Standard
In addition, you can get a list of all
\family typewriter
Atom
\family default
objects (ie.
all
\family typewriter
DisorderedAtom
\family default
objects are 'unpacked' to their individual
\family typewriter
Atom
\family default
objects) using the
\family typewriter
get_unpacked_list
\family default
method of a
\family typewriter
(Disordered)\SpecialChar \-
Residue
\family default
object.
\layout Subsubsection*
Can I sort residues in a chain somehow?
\layout Standard
Yes, kinda, but I'm waiting for a request for this feature to finish it
:-).
\layout Subsubsection*
How are ligands and solvent handled?
\layout Standard
See 'What is a residue id?'.
\layout Subsubsection*
What about B factors?
\layout Standard
Well, yes! Bio.PDB supports isotropic and anisotropic B factors, and also
deals with standard deviations of anisotropic B factor if present (see
\begin_inset LatexCommand \ref{sub:Analysis}
\end_inset
).
\layout Subsubsection*
What about standard deviation of atomic positions?
\layout Standard
Yup, supported.
See section
\begin_inset LatexCommand \ref{sub:Analysis}
\end_inset
.
\layout Subsubsection*
I think the SMCRA data structure is not flexible/\SpecialChar \-
sexy/\SpecialChar \-
whatever enough...
\layout Standard
Sure, sure.
Everybody is always coming up with (mostly vaporware or partly implemented)
data structures that handle all possible situations and are extensible
in all thinkable (and unthinkable) ways.
The prosaic truth however is that 99.9% of people using (and I mean really
using!) crystal structures think in terms of models, chains, residues and
atoms.
The philosophy of Bio.PDB is to provide a reasonably fast, clean, simple,
but complete data structure to access structure data.
The proof of the pudding is in the eating.
\layout Standard
Moreover, it is quite easy to build more specialised data structures on
top of the
\family typewriter
Structure
\family default
class (eg.
there's a
\family typewriter
Polypeptide
\family default
class).
On the other hand, the
\family typewriter
Structure
\family default
object is built using a Parser/\SpecialChar \-
Consumer approach (called
\family typewriter
PDBParser/\SpecialChar \-
MMCIFParser
\family default
and
\family typewriter
Structure\SpecialChar \-
Builder
\family default
, respectively).
One can easily re-use the PDB/mmCIF parsers by implementing a specialised
\family typewriter
Structure\SpecialChar \-
Builder
\family default
class.
It is of course also trivial to add support for new file formats by writing
new parsers.
\layout Subsection
\begin_inset LatexCommand \label{sub:Analysis}
\end_inset
Analysis
\layout Subsubsection*
How do I extract information from an
\family typewriter
Atom
\family default
object?
\layout Standard
Using the following methods:
\layout LyX-Code
a.get_name() # atom name (spaces stripped, e.g.
'CA')
\layout LyX-Code
a.get_id() # id (equals atom name)
\layout LyX-Code
a.get_coord() # atomic coordinates
\layout LyX-Code
a.get_vector() # atomic coordinates as Vector object
\layout LyX-Code
a.get_bfactor() # isotropic B factor
\layout LyX-Code
a.get_occupancy() # occupancy
\layout LyX-Code
a.get_altloc() # alternative location specifier
\layout LyX-Code
a.get_sigatm() # std.
dev.
of atomic parameters
\layout LyX-Code
a.get_siguij() # std.
dev.
of anisotropic B factor
\layout LyX-Code
a.get_anisou() # anisotropic B factor
\layout LyX-Code
a.get_fullname() # atom name (with spaces, e.g.
'.CA.')
\layout Subsubsection*
How do I extract information from a
\family typewriter
Residue
\family default
object?
\layout Standard
Using the following methods:
\layout LyX-Code
r.get_resname() # return the residue name (eg.
'GLY')
\layout LyX-Code
r.is_disordered() # 1 if the residue has disordered atoms
\layout LyX-Code
r.get_segid() # return the SEGID
\layout LyX-Code
r.has_id(name) # test if a residue has a certain atom
\layout Subsubsection*
How do I measure distances?
\layout Standard
That's simple: the minus operator for atoms has been overloaded to return
the distance between two atoms.
\layout Standard
Example:
\layout LyX-Code
# Get some atoms
\layout LyX-Code
ca1=residue1['CA']
\layout LyX-Code
ca2=residue2['CA']
\layout LyX-Code
# Simply subtract the atoms to get their distance
\layout LyX-Code
distance=ca1-ca2
\layout Subsubsection*
How do I measure angles?
\layout Standard
This can easily be done via the vector representation of the atomic coordinates,
and the
\family typewriter
calc_angle
\family default
function from the
\family typewriter
Vector
\family default
module:
\layout LyX-Code
vector1=atom1.get_vector()
\layout LyX-Code
vector2=atom2.get_vector()
\layout LyX-Code
vector3=atom3.get_vector()
\layout LyX-Code
angle=calc_angle(vector1, vector2, vector3)
\layout Subsubsection*
How do I measure torsion angles?
\layout Standard
Again, this can easily be done via the vector representation of the atomic
coordinates, this time using the
\family typewriter
calc_dihedral
\family default
function from the
\family typewriter
Vector
\family default
module:
\layout LyX-Code
vector1=atom1.get_vector()
\layout LyX-Code
vector2=atom2.get_vector()
\layout LyX-Code
vector3=atom3.get_vector()
\layout LyX-Code
vector4=atom4.get_vector()
\layout LyX-Code
angle=calc_dihedral(vector1, vector2, vector3, vector4)
\layout Subsubsection*
How do I determine atom-atom contacts?
\layout Standard
Use
\family typewriter
NeighborSearch
\family default
.
This uses a KD tree data structure coded in C++ behind the screens, so
it's pretty darn fast (see
\family typewriter
Bio.KDTree
\family default
).
\layout Subsubsection*
How do I extract polypeptides from a
\family typewriter
Structure
\family default
object?
\layout Standard
Use
\family typewriter
PolypeptideBuilder
\family default
.
You can use the resulting
\family typewriter
Polypeptide
\family default
object to get the sequence as a
\family typewriter
Seq
\family default
object or to get a list of C
\begin_inset Formula $\alpha$
\end_inset
atoms as well.
Polypeptides can be built using a C-N or a C
\begin_inset Formula $\alpha$
\end_inset
-C
\begin_inset Formula $\alpha$
\end_inset
distance criterion.
\layout Standard
Example:
\layout LyX-Code
# Using C-N
\layout LyX-Code
ppb=PPBuilder()
\layout LyX-Code
for pp in ppb.build_peptides(structure):
\layout LyX-Code
print pp.get_sequence()
\layout LyX-Code
# Using CA-CA
\layout LyX-Code
ppb=CaPPBuilder()
\layout LyX-Code
for pp in ppb.build_peptides(structure):
\layout LyX-Code
print pp.get_sequence()
\layout Standard
Note that in the above case only model 0 of the structure is considered
by
\family typewriter
PolypeptideBuilder
\family default
.
However, it is possible to use
\family typewriter
PolypeptideBuilder
\family default
to build
\family typewriter
Polypeptide
\family default
objects from
\family typewriter
Model
\family default
and
\family typewriter
Chain
\family default
objects as well.
\layout Subsubsection*
How do I get the sequence of a structure?
\layout Standard
The first thing to do is to extract all polypeptides from the structure
(see previous entry).
The sequence of each polypeptide can then easily be obtained from the
\family typewriter
Polypeptide
\family default
objects.
The sequence is represented as a Biopython
\family typewriter
Seq
\family default
object, and its alphabet is defined by a
\family typewriter
ProteinAlphabet
\family default
object.
\layout Standard
Example:
\layout LyX-Code
>>> seq=polypeptide.get_sequence()
\layout LyX-Code
>>> print seq
\layout LyX-Code
Seq('SNVVE...', <class Bio.Alphabet.ProteinAlphabet>)
\layout Subsubsection*
How do I determine secondary structure?
\layout Standard
For this functionality, you need to install DSSP (and obtain a license for
it - free for academic use, see
\begin_inset LatexCommand \url{http://www.cmbi.kun.nl/gv/dssp/}
\end_inset
).
Then use the
\family typewriter
DSSP
\family default
class, which maps
\family typewriter
Residue
\family default
objects to their secondary structure (and accessible surface area).
The DSSP codes are listed in Table
\begin_inset LatexCommand \ref{cap:DSSP-codes}
\end_inset
.
Note that DSSP (the program, and thus by consequence the class) cannot
handle multiple models!
\layout Standard
\begin_inset Float table
wide false
collapsed false
\layout Subsubsection*
\begin_inset Tabular
<lyxtabular version="3" rows="9" columns="2">
<features>
<column alignment="center" valignment="top" leftline="true" width="0">
<column alignment="center" valignment="top" leftline="true" rightline="true" width="0">
<row topline="true" bottomline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\layout Standard
Code
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\layout Standard
Secondary structure
\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\layout Standard
H
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\layout Standard
\begin_inset Formula $\alpha$
\end_inset
-helix
\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\layout Standard
B
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\layout Standard
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\noun off
\color none
Isolated
\family default
\series default
\shape default
\size default
\emph default
\bar default
\noun default
\color default
\begin_inset Formula $\beta$
\end_inset
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\noun off
\color none
-bridge resid
\family default
\series default
\shape default
\size default
\emph default
\bar default
\noun default
\color default
ue
\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\layout Standard
E
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\layout Standard
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\noun off
\color none
Strand
\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\layout Standard
G
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\layout Standard
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\noun off
\color none
3-10 helix
\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\layout Standard
I
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\layout Standard
\begin_inset Formula $\Pi$
\end_inset
-
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\noun off
\color none
helix
\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\layout Standard
T
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\layout Standard
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\noun off
\color none
Turn
\end_inset
</cell>
</row>
<row topline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\layout Standard
S
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\layout Standard
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\noun off
\color none
Bend
\end_inset
</cell>
</row>
<row topline="true" bottomline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\layout Standard
-
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\layout Standard
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\noun off
\color none
Other
\end_inset
</cell>
</row>
</lyxtabular>
\end_inset
\layout Caption
\begin_inset LatexCommand \label{cap:DSSP-codes}
\end_inset
DSSP codes in Bio.PDB.
\end_inset
\layout Subsubsection*
How do I calculate the accessible surface area of a residue?
\layout Standard
Use the
\family typewriter
DSSP
\family default
class (see also previous entry).
But see also next entry.
\layout Subsubsection*
How do I calculate residue depth?
\layout Standard
Residue depth is the average distance of a residue's atoms from the solvent
accessible surface.
It's a fairly new and very powerful parameterization of solvent accessibility.
For this functionality, you need to install Michel Sanner's MSMS program
(
\begin_inset LatexCommand \url{http://www.scripps.edu/pub/olson-web/people/sanner/html/msms_home.html}
\end_inset
).
Then use the
\family typewriter
ResidueDepth
\family default
class.
This class behaves as a dictionary which maps
\family typewriter
Residue
\family default
objects to corresponding (residue depth, C
\begin_inset Formula $\alpha$
\end_inset
depth) tuples.
The C
\begin_inset Formula $\alpha$
\end_inset
depth is the distance of a residue's C
\begin_inset Formula $\alpha$
\end_inset
atom to the solvent accessible surface.
\layout Standard
Example:
\layout LyX-Code
model=structure[0]
\layout LyX-Code
rd=ResidueDepth(model, pdb_file)
\layout LyX-Code
residue_depth, ca_depth=rd[some_residue]
\layout Standard
You can also get access to the molecular surface itself (via the
\family typewriter
get_surface
\family default
function), in the form of a Numeric python array with the surface points.
\layout Subsubsection*
How do I calculate Half Sphere Exposure?
\layout Standard
Half Sphere Exposure (HSE) is a new, 2D measure of solvent exposure.
Basically, it counts the number of C
\begin_inset Formula $\alpha$
\end_inset
atoms around a residue in the direction of its side chain, and in the opposite
direction (within a radius of 13 ).
Despite its simplicity, it outperforms many other measures of solvent exposure.
An article describing this novel 2D measure has been submitted.
\layout Standard
HSE comes in two flavors: HSE
\begin_inset Formula $\alpha$
\end_inset
and HSE
\begin_inset Formula $\beta$
\end_inset
.
The former only uses the C
\begin_inset Formula $\alpha$
\end_inset
atom positions, while the latter uses the C
\begin_inset Formula $\alpha$
\end_inset
and C
\begin_inset Formula $\beta$
\end_inset
atom positions.
The HSE measure is calculated by the
\family typewriter
HSExposure
\family default
class, which can also calculate the contact number.
The latter class has methods which return dictionaries that map a
\family typewriter
Residue
\family default
object to its corresponding HSE
\begin_inset Formula $\alpha$
\end_inset
, HSE
\begin_inset Formula $\beta$
\end_inset
and contact number values.
\layout Standard
Example:
\layout LyX-Code
model=structure[0]
\layout LyX-Code
hse=HSExposure()
\layout LyX-Code
# Calculate HSEalpha
\layout LyX-Code
exp_ca=hse.calc_hs_exposure(model, option='CA3')
\layout LyX-Code
# Calculate HSEbeta
\layout LyX-Code
exp_cb=hse.calc_hs_exposure(model, option='CB')
\layout LyX-Code
# Calculate classical coordination number exp_fs=hse.calc_fs_exposure(model)
\layout LyX-Code
# Print HSEalpha for a residue
\layout LyX-Code
print exp_ca[some_residue]
\layout Subsubsection*
How do I map the residues of two related structures onto each other?
\layout Standard
First, create an alignment file in FASTA format, then use the
\family typewriter
StructureAlignment
\family default
class.
This class can also be used for alignments with more than two structures.
\layout Subsubsection*
How do I test if a Residue object is an amino acid?
\layout Standard
Use
\family typewriter
is_aa(residue)
\family default
.
\layout Subsubsection*
Can I do vector operations on atomic coordinates?
\layout Standard
\family typewriter
Atom
\family default
objects return a
\family typewriter
Vector
\family default
object representation of the coordinates with the
\family typewriter
get_vector
\family default
method.
\family typewriter
Vector
\family default
implements the full set of 3D vector operations, matrix multiplication
(left and right) and some advanced rotation-related operations as well.
See also next question.
\layout Subsubsection*
How do I put a virtual C
\begin_inset Formula $\beta$
\end_inset
on a Gly residue?
\layout Standard
OK, I admit, this example is only present to show off the possibilities
of Bio.PDB's
\family typewriter
Vector
\family default
module (though this code is actually used in the
\family typewriter
HSExposure
\family default
module, which contains a novel way to parametrize residue exposure - publicatio
n underway).
Suppose that you would like to find the position of a Gly residue's C
\begin_inset Formula $\beta$
\end_inset
atom, if it had one.
How would you do that? Well, rotating the N atom of the Gly residue along
the C
\begin_inset Formula $\alpha$
\end_inset
-C bond over -120 degrees roughly puts it in the position of a virtual C
\begin_inset Formula $\beta$
\end_inset
atom.
Here's how to do it, making use of the
\family typewriter
rotaxis
\family default
method (which can be used to construct a rotation around a certain axis)
of the
\family typewriter
Vector
\family default
module:
\layout LyX-Code
# get atom coordinates as vectors
\layout LyX-Code
n=residue['N'].get_vector()
\layout LyX-Code
c=residue['C'].get_vector()
\layout LyX-Code
ca=residue['CA'].get_vector()
\layout LyX-Code
# center at origin
\layout LyX-Code
n=n-ca
\layout LyX-Code
c=c-ca
\layout LyX-Code
# find rotation matrix that rotates n
\layout LyX-Code
# -120 degrees along the ca-c vector
\layout LyX-Code
rot=rotaxis(-pi*120.0/180.0, c)
\layout LyX-Code
# apply rotation to ca-n vector
\layout LyX-Code
cb_at_origin=n.left_multiply(rot)
\layout LyX-Code
# put on top of ca atom
\layout LyX-Code
cb=cb_at_origin+ca
\layout Standard
This example shows that it's possible to do some quite nontrivial vector
operations on atomic data, which can be quite useful.
In addition to all the usual vector operations (cross (use
\family typewriter
**
\family default
), and dot (use
\family typewriter
*
\family default
) product, angle, norm, etc.) and the above mentioned
\family typewriter
rotaxis
\family default
function, the
\family typewriter
Vector
\family default
module also has methods to rotate (
\family typewriter
rotmat
\family default
) or reflect (
\family typewriter
refmat
\family default
) one vector on top of another.
\layout Subsection
Manipulating the structure
\layout Subsubsection*
How do I superimpose two structures?
\layout Standard
Surprisingly, this is done using the
\family typewriter
Superimposer
\family default
object.
This object calculates the rotation and translation matrix that rotates
two lists of atoms on top of each other in such a way that their RMSD is
minimized.
Of course, the two lists need to contain the same amount of atoms.
The
\family typewriter
Superimposer
\family default
object can also apply the rotation/translation to a list of atoms.
The rotation and translation are stored as a tuple in the
\family typewriter
rotran
\family default
attribute of the
\family typewriter
Superimposer
\family default
object (note that the rotation is right multiplying!).
The RMSD is stored in the
\family typewriter
rmsd
\family default
attribute.
\layout Standard
The algorithm used by
\family typewriter
Superimposer
\family default
comes from
\shape italic
Matrix computations, 2nd ed.
Golub, G.
& Van Loan (1989)
\shape default
and makes use of singular value decomposition (this is implemented in the
general
\family typewriter
Bio.\SpecialChar \-
SVDSuperimposer
\family default
module).
\layout Standard
Example:
\layout LyX-Code
sup=Superimposer()
\layout LyX-Code
# Specify the atom lists
\layout LyX-Code
# 'fixed' and 'moving' are lists of Atom objects
\layout LyX-Code
# The moving atoms will be put on the fixed atoms
\layout LyX-Code
sup.set_atoms(fixed, moving)
\layout LyX-Code
# Print rotation/translation/rmsd
\layout LyX-Code
print sup.rotran
\layout LyX-Code
print sup.rms
\layout LyX-Code
# Apply rotation/translation to the moving atoms
\layout LyX-Code
sup.apply(moving)
\layout Subsubsection*
How do I superimpose two structures based on their active sites?
\layout Standard
Pretty easily.
Use the active site atoms to calculate the rotation/translation matrices
(see above), and apply these to the whole molecule.
\layout Subsubsection*
Can I manipulate the atomic coordinates?
\layout Standard
Yes, using the
\family typewriter
transform
\family default
method of the
\family typewriter
Atom
\family default
object, or directly using the
\family typewriter
set_coord
\family default
method.
\layout Section
Other Structural Bioinformatics modules
\layout Subsubsection*
Bio.SCOP
\layout Standard
Info coming soon.
\layout Subsubsection*
Bio.FSSP
\layout Standard
Info coming soon.
\layout Section
You haven't answered my question yet!
\layout Standard
Woah! It's late and I'm tired, and a glass of excellent
\shape italic
Pedro Ximenez
\shape default
sherry is waiting for me.
Just drop me a mail, and I'll answer you in the morning (with a bit of
luck...).
\layout Section
Contributors
\layout Standard
The main author/maintainer of Bio.PDB is yours truly.
Kristian Rother donated code to interact with the PDB database, and to
parse the PDB header.
Indraneel Majumdar sent in some bug reports and assisted in coding the
\family typewriter
Polypeptide
\family default
module.
Many thanks to Brad Chapman, Jeffrey Chang, Andrew Dalke and Iddo Friedberg
for suggestions, comments, help and/or biting criticism :-).
\layout Section
Can I contribute?
\layout Standard
Yes, yes, yes! Just send me an e-mail (thamelry@binf.ku.dk) if you have something
useful to contribute! Eternal fame awaits!
\layout Section
Biopython License Agreement
\layout Standard
Permission to use, copy, modify, and distribute this software and its documentat
ion with or without modifications and for any purpose and without fee is
hereby granted, provided that any copyright notices appear in all copies
and that both those copyright notices and this permission notice appear
in supporting documentation, and that the names of the contributors or
copyright holders not be used in advertising or publicity pertaining to
distribution of the software without specific prior permission.
\layout Standard
THE CONTRIBUTORS AND COPYRIGHT HOLDERS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILI
TY AND FITNESS, IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
\the_end
|