al2na / methylKit

R package for DNA methylation analysis
https://bioconductor.org/packages/release/bioc/html/methylKit.html
210 stars 96 forks source link

methRead Problem as "the condition has length > 1" #299

Closed Ziwei-Liu closed 1 year ago

Ziwei-Liu commented 1 year ago

My code are as follow:

library(methylKit)
file.list2=list("/media/user/02_analysis/methylation/04_methylkit/N_K-1/N_K-1_CG_methylkit.txt","/media/user/02_analysis/methylation/04_methylkit/N_K-2/N_K-2_CG_methylkit.txt","/media/user/02_analysis/methylation/04_methylkit/N_K-3/N_K-3_CG_methylkit.txt","/media/user/02_analysis/methylation/04_methylkit/N_G-1/N_G-1_CG_methylkit.txt","/media/user/02_analysis/methylation/04_methylkit/N_G-2/N_G-2_CG_methylkit.txt","/media/user/02_analysis/methylation/04_methylkit/N_G-3/N_G-3_CG_methylkit.txt")
myobj=methRead(file.list2,sample.id=list("N_K-1","N_K-2","N_K-3","N_G-1","N_G-2","N_G-3"),treatment=c(1,1,1,0,0,0),context="CpG")

and then R reported errors as follow:

Received list of locations.
Error in if (is.na(treatment)) stop("Treatment vector is missing.") :
  the condition has length > 1

I completely followed the user guide, but bugs happened. Please tell me how to fix it.

My system Info:

R version 4.3.0 (2023-04-21)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 LTS
Matrix products: default
BLAS/LAPACK: /media/local/conda/miniconda3/envs/R4.3.0/lib/libopenblasp-r0.3.21.so;  LAPACK version 3.9.0
other attached packages:
[1] ggplot2_3.4.3        methylKit_1.26.0     GenomicRanges_1.52.0
[4] GenomeInfoDb_1.36.2  IRanges_2.34.1       S4Vectors_0.38.1
[7] BiocGenerics_0.46.0
Ziwei-Liu commented 1 year ago

It works after I added the missing "assembly" argument. Problem fixed.