findsentrix: Find file paths for IDAT files

Description Usage Arguments Details Value Examples

Description

findsentrix Search a directory for IDAT files matching to given set of sentrix IDs.

Usage

1
findsentrix(sentrix, directory, recursive = TRUE)

Arguments

sentrix

a vector of sentrix IDs.

directory

a directory to search for IDAT files.

recursive

whether to search recursively, defaults to TRUE

Details

This function takes a set of sentrix IDs, searches a given directory, and returns all unique IDAT filepaths that match to each sentrix ID.

A sentrix ID is a chip number provided by Illumina, followed by an underscore, folloewd by the row and column identifier. Example: "9285451000_R02C01".

Value

a [tibble][tibble::tibble-package] returns a tibble with the given sentrix IDs and each match. Will return multiple matched idats when present, and will not return unmatched sentrix IDs.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Example for robinson lab 

## Read in master sample sheet
ss <- readxl::read_xlsx('Z:/ROBLAB6 Infinium450k John/Master_Sample_Sheet.xlsx')

## specify idat directory
idat_dir <- 'Z:/ROBLAB6 Infinium450k John/EPIC Raw data/'

ss <- ss %>% 

  # Take the first 6 EPIC samples
  dplyr::arrange(desc(Platform)) %>% 
  dplyr::slice(1:6) %>% 
  dplyr::select(Sample_Name, Sentrix_ID, Sentrix_Position) %>%
  
  # create sentrix column
  dplyr::mutate(Sentrix = paste0(Sentrix_ID, '_', Sentrix_Position))
  
#join all matches, retaining unmatched and multiple matched IDs
ss <- ss %>%
  dplyr::full_join(findsentrix(sentrix = ss$Sentrix, directory = idat_dir))

## Now you can load in these samples with minfi::read.metharray.exp
rgset <- minfi::read.metharray.exp(targets = as.data.frame(ss), verbose = TRUE)

wvictor14/plomics documentation built on June 19, 2019, 12:45 a.m.