BED12toGRangesList: BED12toGRangesList

Usage Arguments Examples

View source: R/BED12toGRangesList.R

Usage

1

Arguments

filepath

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
25
26
27
28
29
30
31
32
33
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (filepath) 
{
    print("Converting BED12 to GRangesList")
    print("It may take a few minutes")
    a = read.table(filepath, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
    a = a[, 1:12]
    no_tx = length(a[, 1])
    tx_id = 1:no_tx
    tx_name = paste("line1", 1:no_tx, sep = "")
    tx_chrom = a[, 1]
    tx_strand = a[, 6]
    tx_start = a[, 2] + 1
    tx_end = a[, 3]
    transcripts = data.frame(tx_id, tx_name, tx_chrom, tx_strand, 
        tx_start, tx_end)
    head(transcripts)
    tx_name = tx_name
    gene_id = as.character(a[, 4])
    gene_id[is.na(gene_id)] = "NA"
    gene = data.frame(tx_name, gene_id)
    splicing <- lapply(1:no_tx, .spliceSingleTrans, a = a, tx_start = tx_start)
    splicing <- .combineListOfSplicing(splicing)
    peaks = suppressWarnings(makeTxDb(transcripts = transcripts, 
        splicings = splicing, genes = gene))
    tx <- exonsBy(peaks, "tx", use.names = TRUE)
    mcols(tx) <- a
    return(tx)
  }

lzcyzm/Travis_Dev documentation built on May 21, 2019, 9:16 a.m.