questions_regarding_TUTORIAL: eNMA_Example 3A: Dihydrofolate reductase

Issue #531 resolved
karolk created an issue

Hi,

I have two questions, regarding the eNMA tutorial: Example 3A: Dihydrofolate reductase. (1) How to remove names of pdbs from the plot?

I want to leave only legend. I spend a lot time trying to google it out and I could not find an parameter, which controls this feature.

(2) How to fill the histogram with textile? When I work with tutorial files I get this nice plot, which is filled with textile, but I am not able to obtain a similar one when working with my own files. I checked all parameters, but there is none, at least in plot(), which would plot with textile. You can do it by barplot(). Still, in the tutorial, it is drawn by default. So, I don't get it, why it works in tutorial, but not with my files?

thanks

Comments (22)

  1. Xinqiu Yao

    Hi,

    (1) try plot(..., label=NULL) (See help(plot.fluct) for more detail).

    (2) Could you tell specifically what figure you are referring to?

  2. karolk reporter

    Hi,

    (1) Thanks, I could not find this flag when gooling, but I could see that is used in one of the tutorials. I will try...

    (2) PDF: Enhanced Normal Modes Analysis with Bio3D Lars Skjaerven, Xin-Qiu Yao, Guido Scarabelli & Barry J. Grant September 9, 2016 Figure 11. I could also see that all plots in this tutorial have that textile, instead monocolored histogram.

    thanks

  3. Xinqiu Yao

    When you say "textile", do you mean the 'black vertical lines below curves'? They are actually just lines that can be controlled by the type argument of the plot() function. For example, set type='l' will remove it.

    It is weird that you don't see it because it should show up by default. I've tested with R 3.4.1 on my Windows laptop and it works fine...

  4. karolk reporter

    Yes. This what I meant. I am familiar with the "type" flag, but it does not work.

    Yes. It is weird. I don't know. Looks like I will spend some time on fighting with this ...

  5. karolk reporter

    Just to systematise discussion:

    I can reproduce the plots from tutorial when working with tutorial files, so I don't think that it is a problem of R version or OS. I think that I should get this textile-like looking histogram by default, since in the tutorial you don't use any flags and you still get it.

    R version 3.4.1 (2017-06-30) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: OS X El Capitan 10.11.3

    Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

    locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

    attached base packages: [1] stats graphics grDevices utils datasets methods
    [7] base

    other attached packages: [1] bio3d_2.3-3

    loaded via a namespace (and not attached): [1] compiler_3.4.1 parallel_3.4.1 tools_3.4.1 Rcpp_0.12.12
    [5] grid_3.4.1

  6. karolk reporter

    Additional comments:

    (1) I am not able to get this textile-like plot on my local linux cluster as well. This cluster uses R.3.4.2.

    I think that is has something to do with presence of additional R libraries or with the way the current OS handles graphics.

    Can you paste the output of your sessionInfo() from your mac OS. I will try to reproduce your installation and see whether it will work.

    (2) Label=NULL worked.

  7. Xinqiu Yao

    Could you test following codes and see if you can get the same results? Please make sure you have a clean work space without any pre-loaded data or function (e.g. stored in .Rprofile under your home or current directory)

    attach(transducin)
    pdbs <- trim(pdbs, row.inds=1:2)
    modes <- nma(pdbs)
    plot(modes, pdbs=pdbs)
    

    Rplot02.png

  8. karolk reporter

    Yes and no. The image is similar, but the proportions of the plot and its size, are very much different to the one you presented. I had to specify 1600x1084 when exporting it (Export button in R studio; landscape) so that its size will be more less of the size of your plot. When I export to PDF it looks much better, but I am not able to paste it here.

    (1) 1600x1084 Rplot05.jpeg

    (2) 447x303

    Plot_447X303.jpeg

  9. Xinqiu Yao

    But here you can reproduce the black vertical lines under fluctuation lines (the "textile" you mentioned. Is that correct?)

  10. Xinqiu Yao

    Can you copy&paste the exact commands you used and all output you get including the figure and all warning/error messages (if applicable)?

    Alternatively, provide an example data that we can reproduce your errors.

  11. karolk reporter

    Sure:

    files <- list.files(path="path",pattern="^pdb_")
    files <- files[c(3,4,1,2,5)] 
    pdbsaln <- pdbaln(files, fit = FALSE)
    modes <- nma(pdbsaln,fit = FALSE,subspace = 30, mass = TRUE, ff="calpha", ncore=2)
    Warning in nma.pdbs(pdbsaln, fit = FALSE, subspace = 30, mass = TRUE, ff = "calpha",  :
      X.pdb, Y.pdb, Z.pdb, A.pdb, C.pdb might have missing residue(s) in structure:
       Fluctuations at neighboring positions may be affected.
    
  12. karolk reporter

    plot(modes)

    or

    plot(modes, pdbs = pdbsaln)

    or

    col <- c(1,2, 3, 4,5) # 5 pdbs

    plot(modes, pdbs=pdbsaln, col=col)

  13. Xinqiu Yao

    All commands look fine. It is possible something wrong in 'modes'. Have you checked the object with e.g. print(modes), modes$fluctuations, etc?

  14. karolk reporter
    > print(modes)
    
    Call:
      nma.pdbs(pdbs = pdbsaln, fit = FALSE, subspace = 30, ncore = 5, 
        mass = TRUE, ff = "calpha")
    
    Class:
      enma
    
    Number of structures:
      5
    
    Attributes stored:
      - Root mean square inner product (RMSIP)
      - Aligned atomic fluctuations
      - Aligned eigenvectors (gaps removed)
      - Dimensions of x$U.subspace: 13944x30x5
    
    Coordinates were NOT aligned prior to NMA calculations
    
    + attr: fluctuations, rmsip, U.subspace, L, full.nma, xyz,
            call
    
    modes$fluctuations
        [,1]     [,2]     [,3]      [,4]      [,5]
                         [,6]      [,7]     [,8]     [,9]    [,10]
                       [,11]     [,12]     [,13]     [,14]     [,15]...
    [ reached getOption("max.print") -- omitted 5 rows ]
    
  15. Xinqiu Yao

    It seems your modes$fluctuations was not calculated properly. Note that the object is what actually is plotted in calling plot(modes). Normally, it should look like:

    > modes$fluctuations
                [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]       [,8]      [,9]
    1TND_A 0.6118805 0.3561528 0.2141000 0.1413607 0.1193567 0.1118170 0.1002333 0.09665005 0.1064538
    1TND_B 0.7253518 0.4297158 0.2632614 0.1745356 0.1321386 0.1182503 0.1036705 0.10008398 0.1076405
                [,10]      [,11]     [,12]     [,13]      [,14]     [,15]     [,16]     [,17]
    1TND_A 0.09288760 0.09553938 0.1208109 0.1450431 0.09198061 0.1118963 0.1109128 0.1096117
    1TND_B 0.09690874 0.10061907 0.1247962 0.1510732 0.09525353 0.1142203 0.1141905 0.1136312
    

    Can you provide an example to let me reproduce your problems, such as the pdbsaln object you shown above? Otherwise, I can't figure out what's going on. You can attach files here or send them to xinqiu.yao@gmail.com.

  16. karolk reporter

    OK. Most likely because I read my PDBs as a list and later on I was working on that list.

    <- list.files(path="path",pattern="^pdb_")

    I don't have access to the files now. I will send you these tomorrow. Before doing this, maybe you can tell me what would be the correct way of accessing or performing NMA of PDBs, which are read as a list.

    thanks a lot

  17. karolk reporter

    I think that we can close this ticket.

    Commands, alignment, pdb objects etc...were all fine. The problem was the size of a pdb file. It stores thousands of residues, so the R was trying to pack thousands of data points into a graphic window of a given dimensions. Obviously, the window was to small, so these vertical lines were simply squeezed. So, I needed to stretch the plot like a loooot, in order to see that vertical lines, filing my histogram.

    Suggestion: I think that what could help would be to implement a simple function in bio3d or add one parameter to plot(), which would allow a user to fill in the histogram or the plotting area with a vertical lines, which will be spaced every X points. To be precise, I am talking about the modification/customization of "type=h" flag, where the user will be allowed to set spacing between the vertical lines e.g. every 50 data points. Having this parameter will be extremely useful for people, who work with large structures.

    Thanks a lot Yao

  18. Log in to comment