Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using agcalibrate with agread #28

Open
bhelsel opened this issue Oct 4, 2023 · 0 comments
Open

Using agcalibrate with agread #28

bhelsel opened this issue Oct 4, 2023 · 0 comments

Comments

@bhelsel
Copy link
Owner

bhelsel commented Oct 4, 2023

Problem using the agcalibrate function if the data are read into R with agcounts::agread. Adding an issue as a reminder to look into this problem more.

library(read.gt3x)
library(agcounts)
library(magrittr)

path <- system.file("extdata/example.gt3x", package = "agcounts")

Currently, a user can read in the data without imputed zeros from the read.gt3x package and it can be passed to agcalibrate for GGIR autocalibration.

calibrated_data1 <-  
  read.gt3x::read.gt3x(path, asDataFrame = TRUE) %>%
  agcounts::agcalibrate()

However, it won’t work when you read it with agread. If you use the read.gt3x parser, it will give an error because of the imputed zeros argument set to TRUE. And when trying to use the pygt3x parser from agread, the time stamps are not merging correctly. Consequently, you get twice as many time stamps as the original file when using only the agread function and no autocalibration with agcalibrate.

pygt3x <- agcounts::agread(path, parser = "pygt3x")

calibrated_data3 <- agcounts::agcalibrate(pygt3x)
#> Loading chunk: 1
#> 
#>  There is not enough data to perform the GGIR calibration method. Returning data as read by read.gt3x.

nrow(calibrated_data3)
#> [1] 35721
nrow(pygt3x) 
#> [1] 18000
nrow(calibrated_data3) - nrow(pygt3x)
#> [1] 17721

Created on 2023-10-04 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant