"trim"(xyz, row.inds = NULL, col.inds = NULL, ...)
read.pdb
, read.ncdf
. Produce a new smaller XYZ object, containing a subset of atoms.
This function provides basic functionality for subsetting a matrix of class xyz while also maintaining the class attribute.
xyz
with the Cartesian coordinates
stored in a matrix object with dimensions M x 3N, where N is the
number of atoms, and M number of frames.
Grant, B.J. et al. (2006) Bioinformatics 22, 2695--2696.
## Read a PDB file from the RCSB online database pdb <- read.pdb("1bg2")Note: Accessing on-line PDB file## Select calpha atoms sele <- atom.select(pdb, "calpha") ## Trim XYZ trim(pdb$xyz, col.inds=sele$xyz)Total Frames#: 1 Total XYZs#: 969, (Atoms#: 323) [1] 45.053 -2.661 39.856 <...> 34.614 -8.456 52.042 [969] + attr: Matrix DIM = 1 x 969## Equals to pdb$xyz[, sele$xyz, drop=FALSE][,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 45.053 -2.661 39.856 44.791 -1.079 43.319 42.451 -3.691 44.79 40.334 [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [1,] -4.572 41.737 36.711 -3.532 42.171 36.94 -0.636 44.62 33.152 -0.588 44.615 [,22] [,23] [,24] [,25] [,26] [,27] [,28] [,29] [,30] [,31] [,32] [1,] 31.266 0.469 47.719 27.506 0.284 47.954 25.354 2.275 50.357 21.595 1.825 [,33] [,34] [,35] [,36] [,37] [,38] [,39] [,40] [,41] [,42] [,43] [1,] 50.574 19.617 4.96 51.359 15.989 4.748 52.418 13.92 7.911 52.278 10.894 [,44] [,45] [,46] [,47] [,48] [,49] [,50] [,51] [,52] [,53] [,54] [1,] 8.753 54.461 7.477 7.518 53.373 5.891 10.279 51.322 2.412 11.716 51.731 [,55] [,56] [,57] [,58] [,59] [,60] [,61] [,62] [,63] [,64] [,65] [1,] 1.163 9.793 48.697 2.306 6.499 50.214 0.802 7.315 53.612 -2.376 8.511 [,66] [,67] [,68] [,69] [,70] [,71] [,72] [,73] [,74] [,75] [,76] [1,] 51.867 -2.53 5.223 49.959 -2.208 3.346 53.252 1.271 1.904 52.679 3.297 [,77] [,78] [,79] [,80] [,81] [,82] [,83] [,84] [,85] [,86] [,87] [1,] 0.553 55.566 6.979 0.859 56.414 8.392 -2.592 55.637 12.135 -1.969 56.044 [,88] [,89] [,90] [,91] [,92] [,93] [,94] [,95] [,96] [,97] [1,] 13.661 -3.274 59.292 17.222 -2.392 60.288 20.131 -4.137 62.012 23.583 [,98] [,99] [,100] [,101] [,102] [,103] [,104] [,105] [,106] [,107] [1,] -2.724 62.629 24.857 0.088 60.425 24.951 -2.048 57.289 21.969 -4.383 [,108] [,109] [,110] [,111] [,112] [,113] [,114] [,115] [,116] [,117] [1,] 57.131 18.355 -3.955 56.054 15.747 -6.71 56.306 12.973 -7.085 53.743 [,118] [,119] [,120] [,121] [,122] [,123] [,124] [,125] [,126] [,127] [1,] 10.523 -10.008 53.9 12.735 -11.689 56.518 15.743 -11.691 54.17 18.828 [,128] [,129] [,130] [,131] [,132] [,133] [,134] [,135] [,136] [,137] [1,] -9.708 55.288 20.864 -7.574 52.864 24.156 -6.145 54.072 25.986 -3.327 [,138] [,139] [,140] [,141] [,142] [,143] [,144] [,145] [,146] [,147] [1,] 52.281 28.836 -0.956 53.091 26.187 1.076 54.913 22.439 1.423 55.268 [,148] [,149] [,150] [,151] [,152] [,153] [,154] [,155] [,156] [,157] [1,] 21.006 4.913 55.838 17.668 5.14 57.598 14.919 7.608 56.555 16.251 [,158] [,159] [,160] [,161] [,162] [,163] [,164] [,165] [,166] [,167] [1,] 10.67 58.419 19.91 10.495 57.427 21.251 13.911 56.459 22.727 15.043 [,168] [,169] [,170] [,171] [,172] [,173] [,174] [,175] [,176] [,177] [1,] 53.171 25.87 15.674 55.233 26.056 12.064 56.466 25.563 10.726 52.927 [,178] [,179] [,180] [,181] [,182] [,183] [,184] [,185] [,186] [,187] [1,] 28.308 12.99 51.582 30.817 12.148 54.331 30.245 8.411 54.022 29.755 [,188] [,189] [,190] [,191] [,192] [,193] [,194] [,195] [,196] [,197] [1,] 8.195 50.25 31.784 10.933 48.496 34.253 12.741 50.777 37.111 10.242 [,198] [,199] [,200] [,201] [,202] [,203] [,204] [,205] [,206] [,207] [1,] 50.274 36.54 9.97 46.515 36.902 13.765 46.227 40.24 13.449 48.016 [,208] [,209] [,210] [,211] [,212] [,213] [,214] [,215] [,216] [,217] [1,] 41.32 10.78 45.523 40.411 13.011 42.576 42.52 15.8 44.066 45.141 [,218] [,219] [,220] [,221] [,222] [,223] [,224] [,225] [,226] [,227] [1,] 13.097 44.633 45.014 12.582 40.863 42.766 9.52 40.571 39.46 8.938 [,228] [,229] [,230] [,231] [,232] [,233] [,234] [,235] [,236] [,237] [1,] 38.776 36.188 7.987 40.379 32.494 7.434 39.877 29.455 7.86 42.113 [,238] [,239] [,240] [,241] [,242] [,243] [,244] [,245] [,246] [,247] [1,] 26.018 6.597 41.065 22.486 7.057 42.404 20.443 3.943 41.55 16.802 [,248] [,249] [,250] [,251] [,252] [,253] [,254] [,255] [,256] [,257] [1,] 3.137 42.223 13.211 3.286 41.082 11.589 6.598 40.181 10.892 8.739 [,258] [,259] [,260] [,261] [,262] [,263] [,264] [,265] [,266] [,267] [1,] 43.249 13.318 6.688 45.344 15.586 9.633 46.049 18.269 9.671 43.333 [,268] [,269] [,270] [,271] [,272] [,273] [,274] [,275] [,276] [,277] [1,] 18.144 13.392 42.452 17.626 14.417 46.09 20.805 12.462 46.825 22.952 [,278] [,279] [,280] [,281] [,282] [,283] [,284] [,285] [,286] [,287] [1,] 13.606 43.879 21.948 17.27 43.912 19.154 18.032 46.38 18.65 21.79 [,288] [,289] [,290] [,291] [,292] [,293] [,294] [,295] [,296] [,297] [1,] 46.855 21.621 23.121 44.899 21.912 26.316 46.93 20.654 25.301 50.362 [,298] [,299] [,300] [,301] [,302] [,303] [,304] [,305] [,306] [,307] [1,] 23.66 24.686 52.673 21.664 22.048 54.578 19.595 20.558 51.768 22.227 [,308] [,309] [,310] [,311] [,312] [,313] [,314] [,315] [,316] [,317] [1,] 20.414 49.03 23.16 16.971 47.683 26.444 15.252 46.84 27.35 17.372 [,318] [,319] [,320] [,321] [,322] [,323] [,324] [,325] [,326] [,327] [1,] 43.813 27.082 20.798 45.52 29.07 19.503 48.499 31.761 18.078 46.193 [,328] [,329] [,330] [,331] [,332] [,333] [,334] [,335] [,336] [,337] [1,] 32.183 21.362 44.291 32.346 23.16 47.615 35.103 20.854 48.871 37.132 [,338] [,339] [,340] [,341] [,342] [,343] [,344] [,345] [,346] [,347] [1,] 21.013 45.679 37.352 24.797 45.672 37.877 24.993 49.455 40.804 22.615 [,348] [,349] [,350] [,351] [,352] [,353] [,354] [,355] [,356] [,357] [1,] 49.093 42.154 24.732 46.217 41.903 27.88 48.36 43.97 26.185 51.079 [,358] [,359] [,360] [,361] [,362] [,363] [,364] [,365] [,366] [,367] [1,] 46.583 25.245 48.486 47.021 28.397 46.372 50.796 28.344 46.876 52.765 [,368] [,369] [,370] [,371] [,372] [,373] [,374] [,375] [,376] [,377] [1,] 26.45 44.223 49.835 24.556 42.704 48.091 25.795 39.552 44.595 24.339 [,378] [,379] [,380] [,381] [,382] [,383] [,384] [,385] [,386] [,387] [1,] 39.176 42.296 24.004 36.171 38.744 22.702 36.534 36.619 21.774 33.521 [,388] [,389] [,390] [,391] [,392] [,393] [,394] [,395] [,396] [,397] [1,] 33.088 20.403 33.635 30.826 18.584 31.181 27.136 17.824 31.556 25.353 [,398] [,399] [,400] [,401] [,402] [,403] [,404] [,405] [,406] [,407] [1,] 15.373 29.266 22.47 12.91 29.275 21.839 9.447 27.851 18.361 8.691 [,408] [,409] [,410] [,411] [,412] [,413] [,414] [,415] [,416] [,417] [1,] 26.55 17.694 5.594 24.407 21.455 4.961 24.391 21.952 8.31 22.618 [,418] [,419] [,420] [,421] [,422] [,423] [,424] [,425] [,426] [,427] [1,] 24.092 11.106 24.104 22.94 14.746 24.169 25.011 17.703 25.391 23.099 [,428] [,429] [,430] [,431] [,432] [,433] [,434] [,435] [,436] [,437] [1,] 19.524 28.125 25.359 22.559 27.637 24.643 22.696 23.887 21.33 21.309 [,438] [,439] [,440] [,441] [,442] [,443] [,444] [,445] [,446] [,447] [1,] 22.632 22.601 21.17 19.027 25.082 18.436 20.045 22.701 15.49 19.814 [,448] [,449] [,450] [,451] [,452] [,453] [,454] [,455] [,456] [,457] [1,] 23.439 11.761 19.387 27.134 12.212 20.132 29.596 9.326 19.878 32.236 [,458] [,459] [,460] [,461] [,462] [,463] [,464] [,465] [,466] [,467] [1,] 7.899 22.205 35.83 7.796 21.019 39.166 6.818 22.509 42.096 9.221 [,468] [,469] [,470] [,471] [,472] [,473] [,474] [,475] [,476] [,477] [1,] 22.226 45.777 8.673 21.427 46.246 7.24 24.924 43.113 5.034 25.109 [,478] [,479] [,480] [,481] [,482] [,483] [,484] [,485] [,486] [,487] [1,] 41.246 7.555 27.3 37.596 7.682 26.147 35.677 10.902 25.438 32.383 [,488] [,489] [,490] [,491] [,492] [,493] [,494] [,495] [,496] [,497] [1,] 12.119 24.008 33.21 13.553 20.564 32.262 17.232 20.47 30.949 17.421 [,498] [,499] [,500] [,501] [,502] [,503] [,504] [,505] [,506] [,507] [1,] 24.027 31.204 20.854 25.606 33.972 21.19 28.179 33.605 24.326 30.302 [,508] [,509] [,510] [,511] [,512] [,513] [,514] [,515] [,516] [,517] [1,] 36.333 25.842 32.49 34.92 26.806 35.868 36.598 28.989 38.485 34.157 [,518] [,519] [,520] [,521] [,522] [,523] [,524] [,525] [,526] [,527] [1,] 29.028 41.384 31.341 27.06 43.04 28.851 29.582 41.688 30.057 29.031 [,528] [,529] [,530] [,531] [,532] [,533] [,534] [,535] [,536] [,537] [1,] 38.113 29.55 25.287 38.515 26.056 25.635 39.985 25.164 28.012 37.147 [,538] [,539] [,540] [,541] [,542] [,543] [,544] [,545] [,546] [,547] [1,] 26.4 25.33 34.735 24.24 22.685 36.413 21.318 25.104 36.345 21.833 [,548] [,549] [,550] [,551] [,552] [,553] [,554] [,555] [,556] [,557] [1,] 25.751 32.635 22.029 22.031 31.899 18.805 21.518 33.817 17.066 24.227 [,558] [,559] [,560] [,561] [,562] [,563] [,564] [,565] [,566] [,567] [1,] 31.785 18.537 23.049 28.487 17.181 19.562 29.255 13.606 20.721 28.538 [,568] [,569] [,570] [,571] [,572] [,573] [,574] [,575] [,576] [,577] [1,] 14.49 21.422 24.916 12.624 19.093 22.55 11.121 17.256 25.529 7.332 [,578] [,579] [,580] [,581] [,582] [,583] [,584] [,585] [,586] [,587] [1,] 17.27 25.813 7.109 15.473 29.153 9.994 16.265 31.502 8.724 13.907 [,588] [,589] [,590] [,591] [,592] [,593] [,594] [,595] [,596] [,597] [1,] 34.22 8.712 10.977 31.815 12.019 12.097 30.293 13.852 12.597 33.585 [,598] [,599] [,600] [,601] [,602] [,603] [,604] [,605] [,606] [,607] [1,] 12.782 9.243 35.006 13.853 7.446 31.8 17.222 9.138 31.186 20.67 [,608] [,609] [,610] [,611] [,612] [,613] [,614] [,615] [,616] [,617] [1,] 9.294 32.775 22.326 12.587 33.796 26.109 12.632 33.838 28.134 15.453 [,618] [,619] [,620] [,621] [,622] [,623] [,624] [,625] [,626] [,627] [1,] 35.347 31.912 15.375 34.897 34.406 17.304 36.998 37.973 17.256 35.711 [,628] [,629] [,630] [,631] [,632] [,633] [,634] [,635] [,636] [,637] [1,] 40.502 18.607 38.21 43.948 19.278 36.796 46.849 20.725 38.748 50.531 [,638] [,639] [,640] [,641] [,642] [,643] [,644] [,645] [,646] [,647] [1,] 21.475 38.276 52.984 22.412 41.009 55.011 25.198 39.394 58.061 24.146 [,648] [,649] [,650] [,651] [,652] [,653] [,654] [,655] [,656] [,657] [1,] 41.422 57.772 20.347 41.665 56.391 20.206 38.107 54.503 16.984 38.861 [,658] [,659] [,660] [,661] [,662] [,663] [,664] [,665] [,666] [,667] [1,] 51.129 17.268 37.113 47.909 15.592 38.247 44.532 15.105 36.611 41.461 [,668] [,669] [,670] [,671] [,672] [,673] [,674] [,675] [,676] [,677] [1,] 13.427 37.993 37.989 12.934 36.587 34.988 12.425 38.82 31.797 11.326 [,678] [,679] [,680] [,681] [,682] [,683] [,684] [,685] [,686] [,687] [1,] 37.088 28.602 12.012 39 25.719 9.945 37.634 21.992 10.206 38.308 [,688] [,689] [,690] [,691] [,692] [,693] [,694] [,695] [,696] [,697] [1,] 20.696 7.081 36.565 17.341 6.39 34.908 14.646 4.696 36.98 15.401 [,698] [,699] [,700] [,701] [,702] [,703] [,704] [,705] [,706] [,707] [1,] 1.012 37.499 11.695 0.181 37.499 10.822 -1.049 34.007 7.406 -2.376 [,708] [,709] [,710] [,711] [,712] [,713] [,714] [,715] [,716] [,717] [1,] 35.095 4.091 -0.474 34.788 4.746 1.229 31.439 1.426 2.904 30.622 [,718] [,719] [,720] [,721] [,722] [,723] [,724] [,725] [,726] [,727] [1,] 0.492 4.108 27.143 -0.281 2.674 23.71 0.201 -1.066 23.099 -1.719 [,728] [,729] [,730] [,731] [,732] [,733] [,734] [,735] [,736] [,737] [1,] -4.266 23.858 -4.511 -2.832 26.016 -5.506 -5.903 28.029 -2.359 -7.783 [,738] [,739] [,740] [,741] [,742] [,743] [,744] [,745] [,746] [,747] [1,] 26.986 1.013 -6.274 27.86 4.169 -6.955 29.867 6.648 -5.923 27.184 [,748] [,749] [,750] [,751] [,752] [,753] [,754] [,755] [,756] [,757] [1,] 9.588 -3.821 28.397 13.237 -4.529 29.091 15.633 -3.341 31.771 17.319 [,758] [,759] [,760] [,761] [,762] [,763] [,764] [,765] [,766] [,767] [1,] -0.123 30.641 20.262 -0.836 28.349 22.719 1.19 30.423 21.546 -0.237 [,768] [,769] [,770] [,771] [,772] [,773] [,774] [,775] [,776] [,777] [1,] 33.744 21.924 -3.793 32.425 25.316 -2.859 30.962 26.286 -1.399 34.324 [,778] [,779] [,780] [,781] [,782] [,783] [,784] [,785] [,786] [,787] [1,] 25.1 -4.582 36.055 27.321 -6.735 33.852 30.269 -4.41 34.382 29.898 [,788] [,789] [,790] [,791] [,792] [,793] [,794] [,795] [,796] [,797] [1,] -4.453 38.179 29.415 -8.235 38.339 32.503 -8.707 36.157 34.574 -6.483 [,798] [,799] [,800] [,801] [,802] [,803] [,804] [,805] [,806] [,807] [1,] 38.444 33.158 -8.195 41.535 34.261 -11.555 40.046 37.81 -10.306 39.642 [,808] [,809] [,810] [,811] [,812] [,813] [,814] [,815] [,816] [,817] [1,] 37.527 -10.845 35.885 40.368 -9.558 33.732 37.855 -8.742 30.989 35.138 [,818] [,819] [,820] [,821] [,822] [,823] [,824] [,825] [,826] [,827] [1,] -6.211 31.839 32.278 -5.631 29.342 32.441 -1.804 29.09 31.392 -1.886 [,828] [,829] [,830] [,831] [,832] [,833] [,834] [,835] [,836] [,837] [1,] 25.435 27.916 -3.095 26.448 26.784 0.545 26.42 27.907 4.08 25.599 [,838] [,839] [,840] [,841] [,842] [,843] [,844] [,845] [,846] [,847] [1,] 27.709 4.914 29.305 30.02 2.139 30.453 32.375 2.924 27.563 32.689 [,848] [,849] [,850] [,851] [,852] [,853] [,854] [,855] [,856] [,857] [1,] 6.608 28.545 33.095 5.664 32.223 35.714 3.035 31.403 38.686 4.997 [,858] [,859] [,860] [,861] [,862] [,863] [,864] [,865] [,866] [,867] [1,] 32.763 36.846 5.888 35.986 34.955 2.686 36.822 36.813 -0.331 38.108 [,868] [,869] [,870] [,871] [,872] [,873] [,874] [,875] [,876] [,877] [1,] 40.558 -0.784 37.877 42.322 1.737 40.09 39.265 3.931 40.596 36.988 [,878] [,879] [,880] [,881] [,882] [,883] [,884] [,885] [,886] [,887] [1,] 4.287 43.595 33.297 3.819 42.957 30.34 4.398 45.217 26.872 3.322 [,888] [,889] [,890] [,891] [,892] [,893] [,894] [,895] [,896] [,897] [1,] 44.26 24.093 4.741 46.356 21.015 2.61 45.81 17.942 4.547 46.971 [,898] [,899] [,900] [,901] [,902] [,903] [,904] [,905] [,906] [,907] [1,] 14.699 2.925 48.09 11.186 3.772 49.179 10.374 1.975 52.461 6.835 [,908] [,909] [,910] [,911] [,912] [,913] [,914] [,915] [,916] [,917] [1,] 1.396 51.144 5.017 -1.919 51.234 3.806 -1.012 47.743 7.344 -0.889 [,918] [,919] [,920] [,921] [,922] [,923] [,924] [,925] [,926] [,927] [1,] 46.339 8.469 -4.085 48.052 9.291 -5.995 44.883 11.104 -3.025 43.317 [,928] [,929] [,930] [,931] [,932] [,933] [,934] [,935] [,936] [,937] [1,] 13.134 -2.495 46.475 14.145 -6.197 46.377 15.412 -5.641 42.815 17.382 [,938] [,939] [,940] [,941] [,942] [,943] [,944] [,945] [,946] [,947] [1,] -2.565 43.846 18.88 -4.358 46.825 19.801 -7.246 44.546 21.449 -4.913 [,948] [,949] [,950] [,951] [,952] [,953] [,954] [,955] [,956] [,957] [1,] 42.02 23.509 -3.354 44.785 24.545 -6.83 45.885 26.27 -7.439 42.535 [,958] [,959] [,960] [,961] [,962] [,963] [,964] [,965] [,966] [,967] [1,] 29.338 -5.942 44.202 30.022 -8.697 46.749 32.358 -7.093 49.297 34.614 [,968] [,969] [1,] -8.456 52.042