This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Problems with readBismark2DGE when uploading data

Hi! I am trying to analize some bisulfite sequencing data with edgeR after Bismark alingment and further steps. On the begining I am having some problems with the readBismark2DGE function. I will write the Rscript here:

library("edgeR")

targets<-read.delim("targets.txt)

targets
  X                                                   File Sample    Group
1 1 R1C_1_val_1_bismark_bt2_pe.deduplicated.bismark.cov.gz    R1C  Control
2 2 R2C_1_val_1_bismark_bt2_pe.deduplicated.bismark.cov.gz    R2C  Control
3 3 R1T_1_val_1_bismark_bt2_pe.deduplicated.bismark.cov.gz    R1T Morphine
4 4 R2T_1_val_1_bismark_bt2_pe.deduplicated.bismark.cov.gz    R2T Morphine

manu_1 <- targets$File

manu_1
[1] R1C_1_val_1_bismark_bt2_pe.deduplicated.bismark.cov.gz
[2] R2C_1_val_1_bismark_bt2_pe.deduplicated.bismark.cov.gz
[3] R1T_1_val_1_bismark_bt2_pe.deduplicated.bismark.cov.gz
[4] R2T_1_val_1_bismark_bt2_pe.deduplicated.bismark.cov.gz
4 Levels: R1C_1_val_1_bismark_bt2_pe.deduplicated.bismark.cov.gz ...

yall<- readBismark2DGE(manu_1, sample.names=targets$Sample)
Reading 1
Error: `file` must be a string, raw vector or a connection.

>sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-conda_cos6-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux

Matrix products: default
BLAS/LAPACK: /software/anaconda3/lib/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_US.utf8       LC_NUMERIC=C
 [3] LC_TIME=en_US.utf8        LC_COLLATE=en_US.utf8
 [5] LC_MONETARY=en_US.utf8    LC_MESSAGES=en_US.utf8
 [7] LC_PAPER=en_US.utf8       LC_NAME=C
 [9] LC_ADDRESS=C              LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] readr_1.4.0  edgeR_3.24.3 limma_3.38.3

loaded via a namespace (and not attached):
 [1] compiler_3.5.1  R6_2.4.1        hms_0.5.3       pillar_1.4.2
 [5] tibble_2.1.3    crayon_1.3.4    Rcpp_1.0.3      vctrs_0.2.2
 [9] grid_3.5.1      locfit_1.5-9.4  lifecycle_0.2.0 pkgconfig_2.0.3
[13] rlang_0.4.4     lattice_0.20-38

Does someone know how can I correct this error? Thanks in advance, Iraia

edger bisulfite sequencing

Hello, what is the content of the iraia variable?

sorry that variable name was wrong! I have changed the text to show it proprerly. Thanks!

1 answer

The error comes from the readr package that is used internally to read the files. Your variable is a factor but must be a vector, try to feed it to the function as as.character(), it should work then.

Thanks!!!!! That solved my problem!!!

Log in to answer this question.