readBedGraph: Put the content of a bedGraph (with or without header gzip or...

Description Usage Arguments Value Examples

View source: R/myBasicFunctions.R

Description

Put the content of a bedGraph (with or without header gzip or not) in a dataframe

Usage

1

Arguments

fn

the name of the bedgraph file (tab delimited file with 4 columns with optionnally headers). Each row of the table appears as one line of the file. If it does not contain an absolute path, the file name is relative to the current working directory, getwd().

Value

The dataframe with 4 columns (chr, start, end, score) containing the values of the file fn (the header is removed). The bedgraph format is 0-based half open and this remains true for the dataframe.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
tests_dir <- system.file("tests", package="usefulLDfunctions")
test_bedgraph <- file.path(tests_dir, "testNoHeader.bedgraph")

# Load the bedgraph with no header in a dataframe
test_bedgraph_as_df <- readBedGraph(test_bedgraph)

test_bedgraph <- file.path(tests_dir, "test1lineHeader.bedgraph")

# Load the bedgraph with 1 line header in a dataframe
test_bedgraph_as_df <- readBedGraph(test_bedgraph)

test_bedgraph <- file.path(tests_dir, "testmultiplelineHeader.bedgraph")

# Load the bedgraph with multiple lines header in a dataframe
test_bedgraph_as_df <- readBedGraph(test_bedgraph)

lldelisle/usefulLDfunctions documentation built on Nov. 29, 2021, 5:40 a.m.