Locator function getting stuck


#1

Hi everybody,

I am very new to R and I am trying to work with the package Fragman for Microsatellites analyses.

The problem is that my locator function get stuck and I need to shut down R every single time I try to use it (all my colleagues manage to use it without any problem).

this is my script

library(Fragman)
## ========================================================= ## 
## ========================================================= ## 
# Fragman: An R package for Fragment Analysis 1.0.9 (2018-02-01). 
# Author: Covarrubias-Pazaran et al.
# Published: BMC Genetics 17(62):1-8
# Supported and partially funded by:
#    + Council of Science and Technology (CONACYT)
#    + US Department of Agriculture (USDA-ARS)
# Type 'help(Fragman)' for summary information
# Type 'citation(Fragman)' to know how to cite this package
## ========================================================= ## 
## ========================================================= ## 
> 
> setwd("O:/ST_Bio-Spiderlab/Pisaura_Maria/FirstGenotyping")
> 
> Pisaura_Maria_trials <- storing.inds("O:/ST_Bio-Spiderlab/Pisaura_Maria/FirstGenotyping")

[1] "Reading FSA files"

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |====                                                                  |   5%
  |                                                                            
  |=======                                                               |  10%
  |                                                                            
  |==========                                                            |  15%
  |                                                                            
  |==============                                                        |  20%
  |                                                                            
  |==================                                                    |  25%
  |                                                                            
  |=====================                                                 |  30%
  |                                                                            
  |========================                                              |  35%
  |                                                                            
  |============================                                          |  40%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |===================================                                   |  50%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |==========================================                            |  60%
  |                                                                            
  |==============================================                        |  65%
  |                                                                            
  |=================================================                     |  70%
  |                                                                            
  |====================================================                  |  75%
  |                                                                            
  |========================================================              |  80%
  |                                                                            
  |============================================================          |  85%
  |                                                                            
  |===============================================================       |  90%
  |                                                                            
  |==================================================================    |  95%
  |                                                                            
  |======================================================================| 100%
[1] "Applying Fourier tranformation for smoothing..."

  |                                                                                                                 
  |                                                                                                           |   0%
  |                                                                                                                 
  |=====                                                                                                      |   5%
  |                                                                                                                 
  |===========                                                                                                |  10%
  |                                                                                                                 
  |================                                                                                           |  15%
  |                                                                                                                 
  |=====================                                                                                      |  20%
  |                                                                                                                 
  |===========================                                                                                |  25%
  |                                                                                                                 
  |================================                                                                           |  30%
  |                                                                                                                 
  |=====================================                                                                      |  35%
  |                                                                                                                 
  |===========================================                                                                |  40%
  |                                                                                                                 
  |================================================                                                           |  45%
  |                                                                                                                 
  |======================================================                                                     |  50%
  |                                                                                                                 
  |===========================================================                                                |  55%
  |                                                                                                                 
  |================================================================                                           |  60%
  |                                                                                                                 
  |======================================================================                                     |  65%
  |                                                                                                                 
  |===========================================================================                                |  70%
  |                                                                                                                 
  |================================================================================                           |  75%
  |                                                                                                                 
  |======================================================================================                     |  80%
  |                                                                                                                 
  |===========================================================================================                |  85%
  |                                                                                                                 
  |================================================================================================           |  90%
  |                                                                                                                 
  |======================================================================================================     |  95%
  |                                                                                                                 
  |===========================================================================================================| 100%
[1] "Checking and correcting for saturated peaks..."

  |                                                                                                                 
  |                                                                                                           |   0%
  |                                                                                                                 
  |=====                                                                                                      |   5%
  |                                                                                                                 
  |===========                                                                                                |  10%
  |                                                                                                                 
  |================                                                                                           |  15%
  |                                                                                                                 
  |=====================                                                                                      |  20%
  |                                                                                                                 
  |===========================                                                                                |  25%
  |                                                                                                                 
  |================================                                                                           |  30%
  |                                                                                                                 
  |=====================================                                                                      |  35%
  |                                                                                                                 
  |===========================================                                                                |  40%
  |                                                                                                                 
  |================================================                                                           |  45%
  |                                                                                                                 
  |======================================================                                                     |  50%
  |                                                                                                                 
  |===========================================================                                                |  55%
  |                                                                                                                 
  |================================================================                                           |  60%
  |                                                                                                                 
  |======================================================================                                     |  65%
  |                                                                                                                 
  |===========================================================================                                |  70%
  |                                                                                                                 
  |================================================================================                           |  75%
  |                                                                                                                 
  |======================================================================================                     |  80%
  |                                                                                                                 
  |===========================================================================================                |  85%
  |                                                                                                                 
  |================================================================================================           |  90%
  |                                                                                                                 
  |======================================================================================================     |  95%
  |                                                                                                                 
  |===========================================================================================================| 100%
[1] "Applying pull up correction to the samples to decrease noise from channel to channel"

  |                                                                                                                 
  |                                                                                                           |   0%
  |                                                                                                                 
  |=====                                                                                                      |   5%
  |                                                                                                                 
  |===========                                                                                                |  10%
  |                                                                                                                 
  |================                                                                                           |  15%
  |                                                                                                                 
  |=====================                                                                                      |  20%
  |                                                                                                                 
  |===========================                                                                                |  25%
  |                                                                                                                 
  |================================                                                                           |  30%
  |                                                                                                                 
  |=====================================                                                                      |  35%
  |                                                                                                                 
  |===========================================                                                                |  40%
  |                                                                                                                 
  |================================================                                                           |  45%
  |                                                                                                                 
  |======================================================                                                     |  50%
  |                                                                                                                 
  |===========================================================                                                |  55%
  |                                                                                                                 
  |================================================================                                           |  60%
  |                                                                                                                 
  |======================================================================                                     |  65%
  |                                                                                                                 
  |===========================================================================                                |  70%
  |                                                                                                                 
  |================================================================================                           |  75%
  |                                                                                                                 
  |======================================================================================                     |  80%
  |                                                                                                                 
  |===========================================================================================                |  85%
  |                                                                                                                 
  |================================================================================================           |  90%
  |                                                                                                                 
  |======================================================================================================     |  95%
  |                                                                                                                 
  |===========================================================================================================| 100%

     Output is a LIST where each element of the list is a DATAFRAME 
            with the channels in columns for each FSA file.

> 
> my.ladder <- c(35, 50, 75, 100, 139, 150, 160, 200, 250, 300, 340, 350, 400, 450, 490, 500)
> 
> ladder.info.attach(stored=Pisaura_Maria_trials, ladder=my.ladder)

  |                                                                                                                 
  |                                                                                                           |   0%
  |                                                                                                                 
  |=====                                                                                                      |   5%
  |                                                                                                                 
  |===========                                                                                                |  10%
  |                                                                                                                 
  |================                                                                                           |  15%
  |                                                                                                                 
  |=====================                                                                                      |  20%
  |                                                                                                                 
  |===========================                                                                                |  25%
  |                                                                                                                 
  |================================                                                                           |  30%
  |                                                                                                                 
  |=====================================                                                                      |  35%
  |                                                                                                                 
  |===========================================                                                                |  40%
  |                                                                                                                 
  |================================================                                                           |  45%
  |                                                                                                                 
  |======================================================                                                     |  50%
  |                                                                                                                 
  |===========================================================                                                |  55%
  |                                                                                                                 
  |================================================================                                           |  60%
  |                                                                                                                 
  |======================================================================                                     |  65%
  |                                                                                                                 
  |===========================================================================                                |  70%
  |                                                                                                                 
  |================================================================================                           |  75%
  |                                                                                                                 
  |======================================================================================                     |  80%
  |                                                                                                                 
  |===========================================================================================                |  85%
  |                                                                                                                 
  |================================================================================================           |  90%
  |                                                                                                                 
  |======================================================================================================     |  95%
  |                                                                                                                 
  |===========================================================================================================| 100%

Sizing process complete. Information has been stored in the environment for posterior functions.
For example to be used by the overview2() or score.markers() functions.> 

> overview2(my.inds=Pisaura_Maria_trials,n.inds = "123.fsa", ladder=my.ladder, channel = 1, xlim = c(110,380), ylim=c(0,20000))

  |                                                                                                                 
  |                                                                                                           |   0%
  |                                                                                                                 
  |===========================================================================================================| 100%

 THE PEAKS RETURNED ARE SUGGESTIONS. 
   What you should do: 
 a) Use the locator function, i.e. ''my.panel <- locator(type='p', pch=20, col='red')$x'' 
 b) Click over the peaks you want to include in your panel 
 c) Press the 'esc' key when done selecting peaks 
 d) Make sure to provide the panel vector in the score.easy() function 
 
$`channel_1`
numeric(0)

After this, if I run the locator function (either "my.panel <- locator(type='p', pch=20, col='red')$x" as suggested or "blueR1.panel <- locator(n=20,type="p")$x", R gets stuck loading and I need to shut everything down...

Anybody has a good suggestion what to do and what might be happening?

Many thanks already from now

Virginia


#2

Welcome to community.rstudio.com!

I'm not familiar with the fragman package, but it seems that turning your code into a reprex (reproducible example) would be your best bet at getting a helpful response. This will ensure we're all looking at the same data and code. A guide for creating a reprex can be found here.

Also, any more information you can share about what's happening when it gets "stuck" would be helpful to include.

One more thought - I did a quick Google search and found that the fragman package includes a sample dataset. Are you able to run through the tutorial using the sample dataset without trouble?


#3

locator() is part of the graphics package (it's not specific to Fragman), and depends to some extent on non-R system components. Can you provide some more system information? For example:

  • OS Version:
  • R Version:
  • Are you running R via RStudio? If so...
    • RStudio Edition: (Desktop or Server)
    • RStudio Version:
  • The output of running dev.capabilities() (to check whether your R thinks the default device can support locator())

Finally, can you use locator() on a basic plot, such as this?

plot(mtcars$cyl, mtcars$disp)
my.panel <- locator(type='p', pch=20, col='red')$x

Expected behavior:

  • The plot should appear in a plot window (in RStudio, this will be in the Plots pane).
  • When you run the locator() line, the console will be busy (no prompt) and you will be able to click on the plot (the mouse cursor will turn into a crosshair when you hover over the plot).
  • After clicking several times, exit locator() (usually Esc, but the way to exit can be system-specific — see the documentation linked above).
  • Red dots will show up on the plot in the places you clicked.
  • The console should be available again and you can inspect the values that were saved in my.panel.

Does all of that work as expected on the mtcars plot?