R/test_data.R

Defines functions get_test_data get_haplotypr_example_data

get_test_data <- function(dirpath='./tests/testdata/') {

  sample_table <- readr::read_csv(file.path(dirpath, 'sample_tab.csv'), col_types = readr::cols())
  marker_table <- readr::read_csv(file.path(dirpath, 'marker_tab.csv'), col_types = readr::cols())
  reads_fwd <- normalizePath(file.path(dirpath, 'readsF.fastq.gz'))
  reads_rev <- normalizePath(file.path(dirpath, 'readsR.fastq.gz'))
  barcodes_fwd <- normalizePath(file.path(dirpath, 'barcodes_F.fasta'))
  barcodes_rev <- normalizePath(file.path(dirpath, 'barcodes_R.fasta'))

  as.list(environment())
}

#' @export
get_haplotypr_example_data <- function(){

  data_dir <- system.file(package="HaplotypR", "extdata")

  sample_table <-
    readr::read_tsv(file.path(data_dir, 'sampleFile.txt'), col_types = readr::cols()) %>%
    dplyr::select('SampleID', 'BarcodeID_F', 'BarcodeID_R', 'SampleName')

  marker_table <-
    readr::read_tsv(file.path(data_dir, 'markerFile.txt'), col_types = readr::cols()) %>%
    dplyr::mutate(ReferenceSequence =  substr(ReferenceSequence, 2, nchar(ReferenceSequence) - 1))

  reads_fwd <- normalizePath(file.path(data_dir, 'readsF.fastq.gz'))
  reads_rev <- normalizePath(file.path(data_dir, 'readsR.fastq.gz'))
  barcodes_fwd <- normalizePath(file.path(data_dir, 'barcode_Fwd.fasta'))
  barcodes_rev <- normalizePath(file.path(data_dir, 'barcode_Rev.fasta'))

  as.list(environment())
}
bahlolab/HaplotypReportR documentation built on Dec. 2, 2019, 7:36 p.m.