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

rbind fails in g.report.part6.R when f0 does not pass circadian rhythm QC #1240

Open
j262byuu opened this issue Dec 9, 2024 · 0 comments
Open

Comments

@j262byuu
Copy link

j262byuu commented Dec 9, 2024

Describe the bug
In part 6 of the circadian rhythm analysis g.report.part6.R, if the first file f0 does not pass the circadian rhythm analysis QC, then the corresponding f0_T5A5.RData file in meta/ms6.out will not contain any circadian rhythm analysis results. However, if the next file f0+1 successfully generates circadian rhythm analysis results, the following code:

outputfinal = as.data.frame(do.call(rbind,
                                    lapply(fnames.ms6[f0:f1], myfun, expectedCols)),
                            stringsAsFactors = FALSE)

in g.report.part6.R will fail since the base file f0_T5A5.RData only had 7 columns but f0+1_T5A5.RData has a larger number of columns.

To Reproduce
If necessary, I can find a way to upload the raw data (apologies, it's quite large)

  1. Sensor brand: ActiGraph GT3X+
  2. Data format: CSV from NHANES
  3. Approximate recording duration 7-9 days
  4. Are you using a sleep diary to guide the sleep detection: NO
  5. Copy of R command used:
save_ms5rawlevels        = TRUE,
part6CR                  = TRUE, # Circadian rhythm analysis, output IS/IV/phi
part6_threshold_combi    = "40_100_400",
part6DFA                 = TRUE, # Detrended Fluctuation Analysis
cosinor                  = TRUE,
frag.metrics             = "all",
part5_agg2_60seconds     = TRUE,

Screenshots
Error
image
f0 meta/ms6.out/f0_T5A5.RData:output_part6
image
f0+1 meta/ms6.out/f0+1_T5A5.RData:output_part6
image

Desktop (please complete the following information):

  • OS: [a custom ubuntu docker container]
  • GGIR Version [3.1.7]

Additional context
Here's my temporary fix

replace

out_try = myfun(fnames.ms6[f0])

with

all_files <- fnames.ms6[f0:f1]
file_info <- file.info(all_files)
file_sizes <- file_info$size

# Find the file with the largest size. Since the .RData files in ms6.out are processed, the largest file is likely to have the most column names.
largest_file <- all_files[which.max(file_sizes)]

# Extract column names from this file
out_try <- myfun(largest_file)

Before submitting

  • [X ] Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?
  • [X ] Have you tried this on the latest master branch from GitHub?
@j262byuu j262byuu changed the title rbind fails in g.report.part6.R when f0 does not contain circadian rhythm results rbind fails in g.report.part6.R when f0 does not pass circadian rhythm QC Dec 9, 2024
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