Guillawme / rfret

Analyze FRET Binding Data with R
https://guillawme.github.io/rfret
Other
2 stars 5 forks source link

Error with using fit_binding_model function #48

Closed madhurimad closed 4 years ago

madhurimad commented 4 years ago

Hi, there first of all thanks for making this package. But I have few queries while processing the example data file (fret_binding_data).

I got the corrected file output from fret_correct_signal() and then ran fit_binding_model() and got this error:

fit_binding_model('./my_results/input_corrected.csv',binding_model = "quadratic", probe_concentration = 5) _Error in UseMethod("groupby") : no applicable method for 'groupby' applied to an object of class "character"_

Can you please tell if I did some mistake while running it.

Thanks, Maddy

Guillawme commented 4 years ago

Hello Maddy,

Thank you for your interest in this package, and sorry for this late answer (I was offline for most of August).

I stopped maintaining this package a while ago because of other work priorities, but I will see what I can do about this error. I will get to it (and get back to you) on Satuday.

madhurimad commented 4 years ago

Hi Guillaume,

Thanks for your reply.

It will be great if you can figure out the problem and I can use it to run my data.

Thanks once again for your help and looking forward to Saturday :)

best, Maddy

On Tue, Aug 27, 2019 at 1:04 PM Guillaume Gaullier notifications@github.com wrote:

Hello Maddy,

Thank you for your interest in this package, and sorry for this late answer (I was offline for most of August).

I stopped maintaining this package a while ago because of other work priorities, but I will see what I can do about this error. I will get to it (and get back to you) on Satuday.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Guillawme commented 4 years ago

To help me find out what could have caused this problem, can you run utils::sessionInfo() in your R console just after you get the error message, please? And post the output of this command here. Thank you in advance.

madhurimad commented 4 years ago

Hi Guillawme,

This is the info you asked for.

fit_binding_model('./my_results/input_corrected.csv',binding_model = "quadratic",probe_concentration = 5) Error in UseMethod("groupby") : no applicable method for 'groupby' applied to an object of class "character" utils::sessionInfo() R version 3.6.1 (2019-07-05) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS Mojave 10.14.5

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.6/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 base

other attached packages: [1] magrittr_1.5 rfret_0.0.0.9000 knitr_1.24

loaded via a namespace (and not attached): [1] minpack.lm_1.2-1 tidyselect_0.2.5 xfun_0.8 [4] remotes_2.1.0 purrr_0.3.2 lattice_0.20-38 [7] vctrs_0.2.0 colorspace_1.4-1 generics_0.0.2 [10] testthat_2.2.1 usethis_1.5.1 utf8_1.1.4 [13] rlang_0.4.0 pkgbuild_1.0.4 pillar_1.4.2 [16] glue_1.3.1 withr_2.1.2 RColorBrewer_1.1-2 [19] sessioninfo_1.1.1 stringr_1.4.0 munsell_0.5.0 [22] gtable_0.3.0 devtools_2.1.0 memoise_1.1.0 [25] evaluate_0.14 labeling_0.3 callr_3.3.1 [28] ps_1.3.0 curl_4.0 fansi_0.4.0 [31] highr_0.8 broom_0.5.2 Rcpp_1.0.2 [34] readr_1.3.1 backports_1.1.4 scales_1.0.0 [37] desc_1.2.0 pkgload_1.0.2 fs_1.3.1 [40] hms_0.5.0 ggplot2_3.2.1 digest_0.6.20 [43] stringi_1.4.3 processx_3.4.1 dplyr_0.8.3 [46] rprojroot_1.3-2 grid_3.6.1 cowplot_1.0.0 [49] cli_1.1.0 tools_3.6.1 lazyeval_0.2.2 [52] tibble_2.1.3 zeallot_0.1.0 crayon_1.3.4 [55] tidyr_0.8.3 pkgconfig_2.0.2 prettyunits_1.0.2 [58] assertthat_0.2.1 rstudioapi_0.10 R6_2.4.0 [61] nlme_3.1-141 compiler_3.6.1

Thanks, Maddy

On Thu, Aug 29, 2019 at 7:07 PM Guillaume Gaullier notifications@github.com wrote:

To help me find out what could have caused this problem, can you run utils::sessionInfo() just after you get the error message, please? Thank you in advance.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Guillawme/rfret/issues/48?email_source=notifications&email_token=AC2T5ETABY7MZOBUOPSK4E3QHB6EXA5CNFSM4IN3PN32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5QKFZQ#issuecomment-526426854, or mute the thread https://github.com/notifications/unsubscribe-auth/AC2T5ESNCB4VBIIYT35CEKDQHB6EXANCNFSM4IN3PN3Q .

Guillawme commented 4 years ago

Hello Maddy,

I haven't worked on this package for a while, so I needed some time to remind myself how things are supposed to work. It turns out everything works as it should. The fit_binding_model() function should be used on a dataset that's already loaded in memory, it won't be able to figure out what to do if you provide the path of a file on disk. Let me explain.

When you do

fit_binding_model("./my_results/input_corrected.csv", binding_model = "quadratic", probe_concentration = 5)

this function tries to do work on the character string "./my_results/input_corrected.csv" and of course fails because it expects a data frame containing numbers, not a character string.

So, what you need to do instead is to start by loading your data file in memory:

my_dataset <- readr::read_csv("./my_results/input_corrected.csv")

then an object called my_dataset should appear in your Environment panel (assuming you use RStudio; if not, type ls() at the R console and my_dataset should show up in the listing).

Typing the name of the object at the R console should give you an overview of the data frame:

my_dataset
## A tibble: 24 x 3
##   Experiment concentration signal
##   <chr>              <dbl>  <dbl>
## 1 input            1000    10102.
## 2 input             500    12146.
## 3 input             250    12148.
## 4 input             125    12154.
## 5 input              62.5  11581.
## 6 input              31.2  10242.
## 7 input              15.6   9773.
## 8 input               7.81  8722.
## 9 input               3.91  5599.
##10 input               1.95  3064.
## … with 14 more rows

You can now call the fit_binding_model() function on this object like this:

fit_binding_model(data = my_dataset, binding_model = "quadratic", probe_concentration = 5)

If your own datasets are already in the form of a concentration series and an associated signal value for each concentration, and stored in CSV files, you can skip the fret_format_data(), fret_average_replicates() and fret_correct_signal() steps. In this case, before loading them with readr::read_csv(), simply make sure that your datasets contain three columns named Experiment, concentration and signal (case sensitive), because this is what the fit_binding_model() function expects. The Experiment column should contain the same identifier for each row of a single experiment, and you can concatenate several experiments in one file by simply using distinct identifiers for each experiment. Here is an example (I did not change the numbers, and kept only a few rows for clarity, but you get the idea):

Experiment              concentration   signal
an_experiment           1000                10101.8679762724
an_experiment           500                     12146.1568034422
an_experiment           250                     12148.4413564894
an_experiment           125                     12154.4363132738
another_experiment  1000                10101.8679762724
another_experiment  500                     12146.1568034422
another_experiment  250                     12148.4413564894
another_experiment  125                     12154.4363132738

I hope this helps. Good luck with your research.