minfi::read.metharray.exp
1
0
Entering edit mode
clacarion • 0
@23b0716d
Last seen 4 months ago
France

Hello everyone, I am in trouble with the function read.metharray.exp with minfi

In my target, I have :

  • Sentrix_ID
  • Sentrix_position
  • Basename

As you can see the output :


> head(target)
     IID X.1 X Age SEXE MEREINDIFF MEREABUS MERECONTROL PEREINDIFF PEREABUS PERECONTROL
1  MTD01   1 1  45    1          2        6           6         12       14           9
2  MTD05   2 2  49    1          0        5           5         NA       NA          NA
3 MTD106   3 3  28    1          0        3           3          0        0           4
4 MTD111   4 4  42    2         NA       NA          NA          0        2           8
5 MTD114   5 5  32    1          4       10          10         NA       NA          NA
6 MTD117   6 6  41    1          2        5           5          5        3           5
  NBRUTURES        PC1         PC2        PC3          PC4         PC5         PC6 Sentrix_ID
1         0 -0.0106071 -0.00205327 0.01052250  1.88943e-03  0.00154025  0.00460366 8784241009
2         2  0.0923103 -0.00410025 0.00670523 -6.44133e-05  0.00682637 -0.00405648 8691803162
3         1 -0.0344855 -0.02255660 0.04747420 -6.52418e-02 -0.00276713  0.16696700 8784241009
4         2  0.1626150 -0.13081700 0.04439010  3.64958e-02  0.04077800  0.37383800 8784241009
5         1  0.1421090 -0.03179220 0.00279590 -8.31372e-02 -0.01745710  0.00318225 8784241009
6         0 -0.0287510 -0.00419953 0.13936300 -1.82299e-01  0.01224690 -0.06573900 8784241009
  Sentrix_Position     BARCODES
1           R06C02 86918031....
2           R01C01 86918031....
3           R01C02 86918031....
4           R02C01 86918031....
5           R02C02 86918031....
6           R03C01 86918031....
                                                                                 Basename
1 ~/Users/clarachretienneau/Desktop/clock epigenetic/PJ1209132_ScanData/8691803162_R01C01
2 ~/Users/clarachretienneau/Desktop/clock epigenetic/PJ1209132_ScanData/8691803162_R01C02
3 ~/Users/clarachretienneau/Desktop/clock epigenetic/PJ1209132_ScanData/8691803162_R02C01
4 ~/Users/clarachretienneau/Desktop/clock epigenetic/PJ1209132_ScanData/8691803162_R02C02
5 ~/Users/clarachretienneau/Desktop/clock epigenetic/PJ1209132_ScanData/8691803162_R03C01
6 ~/Users/clarachretienneau/Desktop/clock epigenetic/PJ1209132_ScanData/8691803162_R03C02

This is how i create the Basename :

IDATs_directory <- "~/Users/clarachretienneau/Desktop/clock epigenetic/PJ1209132_ScanData"
baseDirectory <- file.path(IDATs_directory, files_name_incomplete)
target$Basename<-file.path(baseDirectory)

When I try read.metharray.exp , this is the output : it's replicate the end of the path


rgset <- read.metharray.exp(base = baseDirectory,targets = target, extended + = TRUE) Error in read.metharray(basenames = files, 
extended = extended, verbose = verbose, : The following specified files do not exist:~/Users/clarachretienneau/Desktop/clock
 epigenetic/PJ1209132_ScanData/8691803162_R01C01/8691803162_R01C01_Grn.idat, ~/Users/clarachretienneau/Desktop/clock 
epigenetic/PJ1209132_ScanData/8691803162_R01C02/8691803162_R01C02_Grn.idat, ~/Users/clarachretienneau/Desktop/clock 
epigenetic/PJ1209132_ScanData/8691803162_R02C01/8691803162_R02C01_Grn.idat, ~/Users/clarachretienneau/Desktop/clock 
epigenetic/PJ1209132_ScanData/8691803162_R02C02/8691803162_R02C02_Grn.idat, ~/Users/clarachretienneau/Desktop/clock 
epigenetic/PJ1209132_ScanData/8691803162_R03C01/8691803162_R03C01_Grn.idat, ~/Users/clarachretienneau/Desktop/clock 
epigenetic/PJ1209132_ScanData/8691803162_R03C02/8691803162_R03C02_Grn.idat, ~/Users/clarachretienneau/Desktop/clock 
epigenetic/PJ1209132_ScanData/8691803162_R04C01/8691803162_R04C01_Grn.idat, ~/Users/clarachretienneau/Desktop/clock 
epigenetic/PJ1209132_ScanData/8691803162_R04C02/8691803162_R04C02_Grn.idat, ~/Users/clarachretie

I try to understand with chatgpt but it doesn't work....

Thank you very much Clara :)

sessionInfo( )


R version 4.2.3 (2023-03-15)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.3

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/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] parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] minfi_1.44.0                bumphunter_1.40.0           locfit_1.5-9.9             
 [4] iterators_1.0.14            foreach_1.5.2               Biostrings_2.66.0          
 [7] XVector_0.38.0              SummarizedExperiment_1.28.0 Biobase_2.58.0             
[10] MatrixGenerics_1.10.0       matrixStats_1.2.0           GenomicRanges_1.50.2       
[13] GenomeInfoDb_1.34.9         IRanges_2.32.0              S4Vectors_0.36.2           
[16] BiocGenerics_0.44.0        

loaded via a namespace (and not attached):
  [1] nlme_3.1-164              bitops_1.0-7              bit64_4.0.5              
  [4] filelock_1.0.3            RColorBrewer_1.1-3        progress_1.2.3           
  [7] httr_1.4.7                tools_4.2.3               doRNG_1.8.6              
 [10] nor1mix_1.3-2             utf8_1.2.4                R6_2.5.1                 
 [13] HDF5Array_1.26.0          DBI_1.2.2                 rhdf5filters_1.10.1      
 [16] tidyselect_1.2.1          prettyunits_1.2.0         base64_2.0.1             
 [19] preprocessCore_1.60.2     bit_4.0.5                 curl_5.2.1               
 [22] compiler_4.2.3            cli_3.6.2                 xml2_1.3.6               
 [25] DelayedArray_0.24.0       rtracklayer_1.58.0        readr_2.1.5              
 [28] quadprog_1.5-8            genefilter_1.80.3         askpass_1.2.0            
 [31] rappdirs_0.3.3            stringr_1.5.1             digest_0.6.35            
 [34] Rsamtools_2.14.0          illuminaio_0.40.0         siggenes_1.72.0          
 [37] GEOquery_2.66.0           pkgconfig_2.0.3           scrime_1.3.5             
 [40] sparseMatrixStats_1.10.0  limma_3.54.2              dbplyr_2.5.0             
 [43] fastmap_1.1.1             rlang_1.1.3               rstudioapi_0.15.0        
 [46] RSQLite_2.3.5             DelayedMatrixStats_1.20.0 BiocIO_1.8.0             
 [49] generics_0.1.3            mclust_6.0.1              BiocParallel_1.32.6      
 [52] dplyr_1.1.4               RCurl_1.98-1.14           magrittr_2.0.3           
 [55] GenomeInfoDbData_1.2.9    Matrix_1.6-5              Rcpp_1.0.12              
 [58] Rhdf5lib_1.20.0           fansi_1.0.6               lifecycle_1.0.4          
 [61] stringi_1.8.3             yaml_2.3.8                MASS_7.3-60.0.1          
 [64] zlibbioc_1.44.0           rhdf5_2.42.1              plyr_1.8.9               
 [67] BiocFileCache_2.6.1       grid_4.2.3                blob_1.2.4               
 [70] crayon_1.5.2              lattice_0.22-6            splines_4.2.3            
 [73] annotate_1.76.0           multtest_2.54.0           GenomicFeatures_1.50.4   
 [76] hms_1.1.3                 KEGGREST_1.38.0           beanplot_1.3.1           
 [79] pillar_1.9.0              rjson_0.2.21              rngtools_1.5.2           
 [82] codetools_0.2-19          biomaRt_2.54.1            XML_3.99-0.16.1          
 [85] glue_1.7.0                BiocManager_1.30.22       data.table_1.15.2        
 [88] tzdb_0.4.0                png_0.1-8                 vctrs_0.6.5              
 [91] purrr_1.0.2               tidyr_1.3.1               openssl_2.1.1            
 [94] reshape_0.8.9             cachem_1.0.8              xtable_1.8-4             
 [97] restfulr_0.0.15           survival_3.5-8            tibble_3.2.1             
[100] GenomicAlignments_1.34.1  AnnotationDbi_1.60.2      memoise_2.0.1
minfiData minfi • 496 views
ADD COMMENT
1
Entering edit mode
Basti ▴ 780
@7d45153c
Last seen 1 day ago
France

Could you show list.files("~/Users/clarachretienneau/Desktop/clock epigenetic/PJ1209132_ScanData") ? There may be a problem related to the structure of the folder containing all the necessary files

Usually, it is better not to create the Basename manually as it can lead to misleading folders/files reading, you should prefer to use read.metharray sheet : https://www.rdocumentation.org/packages/minfi/versions/1.18.4/topics/read.metharray.sheet

I would go with sheet <- read.metharray.sheet("~/Users/clarachretienneau/Desktop/clock epigenetic/PJ1209132_ScanData") with your folder containing the sample_sheet.csv formatted file and the different folders related to the arrays .idat files (not one folder by sample)

Then you will be able to use read.metharray.exp more easily, but this depends on how your folder has been created

ADD COMMENT
0
Entering edit mode

Thank you for your response Basti ! I add all the idat files in a unique folder called "idat" and add it in my path


> list.files("~/Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/")
character(0)

I dont't understand

I will try to create the basename with read.metharray.sheet because as you said I think i make mistake when i create them manually

ADD REPLY
0
Entering edit mode

I think its work with read.metharray.sheet

> sheet <- read.metharray.sheet("/Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat")
[read.metharray.sheet] Found the following CSV files:
[1] "/Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/target.csv"

> sheet
      IID X.1  X Age SEXE MEREINDIFF MEREABUS MERECONTROL PEREINDIFF PEREABUS PERECONTROL NBRUTURES
1   MTD01   1  1  45    1          2        6           6         12       14           9         0
2   MTD05   2  2  49    1          0        5           5         NA       NA          NA         2
3  MTD106   3  3  28    1          0        3           3          0        0           4         1
4  MTD111   4  4  42    2         NA       NA          NA          0        2           8         2
5  MTD114   5  5  32    1          4       10          10         NA       NA          NA         1
6  MTD117   6  6  41    1          2        5           5          5        3           5         0
7  MTD118   7  7  33    1         NA       NA          NA         NA       NA          NA         1
8  MTD122   8  8  56    1         13        3           3         16       12           9         4
9  MTD126   9  9  48    2          0        7           7          0        0           0         0
10 MTD129  10 10  51    2          0        8           8          1        2           8         0
11 MTD138  11 11  40    1          0        3           3          0        0           3         0
12  MTD23  12 12  43    1          0        2           2         14       15           9         1
13  MTD26  13 13  35    2          0        0           0         NA       NA          NA         6
14  MTD44  14 14  29    1          0        1           1          0        0           1         0
15  MTD47  15 15  27    2          0        1           1          0        1           7         0
16  MTD59  16 16  51    1          4       12          12         16       13           9         1
17  MTD61  17 17  42    2         17        9           9         17       15           9         1
18  MTD64  18 18  55    1          0        7           7          3        0           0         0
19  MTD66  19 19  39    1          2        8           8         11        6           8         4
20  MTD67  20 20  64    2          3        7           7          0        0           7         1
21  MTD68  21 21  42    1          0        1           1          0        0           1         0
22  MTD78  22 22  49    1         11        6           6         11        5           5         3
23  MTD92  23 23  46    2          0        8           8          0        1           3         0
24  MTD95  24 24  42    1          1        5           5          5        3           0         5
           PC1          PC2          PC3          PC4         PC5          PC6          BARCODES
1  -0.01060710 -2.05327e-03  1.05225e-02  1.88943e-03  0.00154025  4.60366e-03 8691803162_R01C01
2   0.09231030 -4.10025e-03  6.70523e-03 -6.44133e-05  0.00682637 -4.05648e-03 8691803162_R01C02
3  -0.03448550 -2.25566e-02  4.74742e-02 -6.52418e-02 -0.00276713  1.66967e-01 8691803162_R02C01
4   0.16261500 -1.30817e-01  4.43901e-02  3.64958e-02  0.04077800  3.73838e-01 8691803162_R02C02
5   0.14210900 -3.17922e-02  2.79590e-03 -8.31372e-02 -0.01745710  3.18225e-03 8691803162_R03C01
6  -0.02875100 -4.19953e-03  1.39363e-01 -1.82299e-01  0.01224690 -6.57390e-02 8691803162_R03C02
7   0.05834440 -9.09732e-02 -6.93473e-02  9.58069e-02 -0.17223000 -1.93364e-01 8691803162_R04C01
8   0.00106929  4.39192e-02 -3.06608e-02  4.54415e-02 -0.03140880  2.13641e-02 8691803162_R04C02
9  -0.02025540  1.90993e-03  2.50062e-03  1.07158e-03 -0.00266821  4.36155e-05 8691803162_R05C01
10 -0.00715061  1.98196e-02  1.62329e-02 -1.02712e-02 -0.01557550 -1.69893e-02 8691803162_R05C02
11  0.12245500 -2.05179e-03  6.26396e-03 -3.44199e-04  0.00402718 -3.15157e-03 8691803162_R06C01
12 -0.01980560 -1.07778e-05  1.08061e-03  1.73164e-03 -0.00103787  3.78151e-04 8691803162_R06C02
13 -0.02538370 -2.98525e-03 -2.26570e-03  2.36006e-03  0.00223278 -4.93219e-03 8784241009_R01C01
14 -0.02856010  3.06602e-02  4.02063e-02 -3.07371e-03 -0.04751600  3.68451e-02 8784241009_R01C02
15 -0.02277170 -3.38017e-03 -4.10308e-03  6.79712e-04 -0.00212491 -1.01010e-03 8784241009_R02C01
16 -0.02511470 -2.26348e-03  5.92317e-04 -3.41296e-03 -0.00384748 -6.06614e-05 8784241009_R02C02
17 -0.02136340  1.47660e-03 -5.11445e-03  6.63128e-03  0.00252088  1.35418e-03 8784241009_R03C01
18 -0.02512620  9.71643e-04 -4.41059e-03  4.48659e-04 -0.00621256  2.61580e-04 8784241009_R03C02
19 -0.02420970 -1.61088e-03 -7.87837e-05  6.23371e-04  0.00100446  3.70780e-04 8784241009_R04C01
20 -0.02479070  4.88050e-03 -2.62714e-03  2.39772e-03 -0.00286234  6.67770e-03 8784241009_R04C02
21 -0.00964249  9.22324e-03 -3.75416e-03 -4.24747e-03 -0.00436353 -3.28498e-03 8784241009_R05C01
22 -0.01645490  2.81442e-03 -2.47791e-03  1.13173e-03 -0.00245506 -4.12326e-04 8784241009_R05C02
23 -0.02147450 -4.37856e-04  1.31186e-03  3.63350e-03 -0.00109105 -5.78543e-04 8784241009_R06C01
24 -0.02100960 -1.26258e-03  6.55490e-05 -1.34219e-04 -0.00360933  3.50630e-03 8784241009_R06C02
                                                                                      Basename  Array
1  /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8784241009_R06C02 R06C02
2  /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8691803162_R01C01 R01C01
3  /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8784241009_R01C02 R01C02
4  /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8784241009_R02C01 R02C01
5  /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8784241009_R02C02 R02C02
6  /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8784241009_R03C01 R03C01
7  /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8784241009_R03C02 R03C02
8  /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8784241009_R04C01 R04C01
9  /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8784241009_R04C02 R04C02
10 /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8784241009_R05C01 R05C01
11 /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8784241009_R05C02 R05C02
12 /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8691803162_R01C02 R01C02
13 /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8691803162_R02C01 R02C01
14 /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8784241009_R06C01 R06C01
15 /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8691803162_R02C02 R02C02
16 /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8691803162_R03C01 R03C01
17 /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8691803162_R03C02 R03C02
18 /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8691803162_R04C01 R04C01
19 /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8691803162_R04C02 R04C02
20 /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8691803162_R05C01 R05C01
21 /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8691803162_R05C02 R05C02
22 /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8691803162_R06C01 R06C01
23 /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8691803162_R06C02 R06C02
24 /Users/clarachretienneau/Desktop/clock_epigenetic/PJ1209132_ScanData/idat/8784241009_R01C01 R01C01
        Slide
1  8784241009
2  8691803162
3  8784241009
4  8784241009
5  8784241009
6  8784241009
7  8784241009
8  8784241009
9  8784241009
10 8784241009
11 8784241009
12 8691803162
13 8691803162
14 8784241009
15 8691803162
16 8691803162
17 8691803162
18 8691803162
19 8691803162
20 8691803162
21 8691803162
22 8691803162
23 8691803162
24 8784241009

and after


> rgSet <- read.metharray.exp(targets=sheet)
> rgSet
class: RGChannelSet 
dim: 622399 24 
metadata(0):
assays(2): Green Red
rownames(622399): 10600313 10600322 ... 74810490 74810492
rowData names(0):
colnames(24): 8784241009_R06C02 8691803162_R01C01 ... 8691803162_R06C02 8784241009_R01C01
colData names(23): IID X.1 ... Slide filenames
Annotation
  array: IlluminaHumanMethylation450k
  annotation: ilmn12.hg19

Thank you !!!

ADD REPLY
0
Entering edit mode

This is indeed correct now !

ADD REPLY

Login before adding your answer.

Traffic: 772 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6