bedgraph2norm: Import bedgraph to GRanges

Description Usage Arguments Value Author(s) See Also Examples

View source: R/bedgraph2norm.R

Description

Function importing data from bedgraph format compatible with UCSC Genome Browser to norm_GR data frame. Warning: Compatible only with bedgraph files generated by norm2bedgraph function (bedgraph needs to have 2 tracks, first for plus strand, second for minus strand). May be used for transforming normalized data to another different annotation sets.

Usage

1
2
bedgraph2norm(bedgraph_file, fasta_file, txDb, bed_file,
  column_name = "bedgraph_score", add_to, track_strand = "+")

Arguments

bedgraph_file

path to compatible bedgraph file

fasta_file

path to fasta file which is used for a) choosing which transcripts to use (transcripts absent from fasta are not reported), b) providing sequence for to display in GRanges metadata

txDb

TranscriptDb object with transcript definitions. Names must match those in fasta_file

bed_file

character containing file path to BED file with transcript definitions. Supply txDb XOR bedfile

column_name

How to name imported metadata in GRanges

add_to

GRanges object made by other normalization function (dtcr(), slograt(), swinsor(), compdata()) to which values from bedgraph should be added.

track_strand

specifies which genomic strand the supplied bedgraph describes ("+" or "-"). Used only if the bedgraph file is composed of only one track.

Value

Function creates GRanges object or (if add_to specified) adds metadata to already existing object

Author(s)

Lukasz Jan Kielpinski, Nikos Sidiropoulos

See Also

norm2bedgraph, GR2norm_df, plotRNA, BED2txDb, dtcr, slograt, swinsor, compdata

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
dummy_euc_GR_control <- GRanges(seqnames="DummyRNA",
IRanges(start=round(runif(100)*100), width=round(runif(100)*100+1)),
        strand="+", EUC=round(runif(100)*100))
dummy_euc_GR_treated <- GRanges(seqnames="DummyRNA",
                                IRanges(start=round(runif(100)*100),
                                        width=round(runif(100)*100+1)),
                                strand="+", EUC=round(runif(100)*100))
dummy_comp_GR_control <- comp(dummy_euc_GR_control)
dummy_comp_GR_treated <- comp(dummy_euc_GR_treated)
dummy_norm <- dtcr(control_GR=dummy_comp_GR_control,
                   treated_GR=dummy_comp_GR_treated)

write(paste(c("chr1", 134212702, 134229870, "DummyRNA", 0, "+", 134212806,
            134228958, 0, 8, "347,121,24,152,66,120,133,1973,",
            "0,8827,10080,11571,12005,13832,14433,15195,"), collapse = "\t"),
      file="dummy.bed")
norm2bedgraph(norm_GR = dummy_norm, bed_file = "dummy.bed")

write(c(">DummyRNA", paste(sample(c("A","C","G","T"), 100, replace=TRUE),
                           collapse="")), file="dummy.fa")
bedgraph2norm(bedgraph_file = "out_file.bedgraph", fasta_file = "dummy.fa",
              bed_file = "dummy.bed")

RNAprobR documentation built on Nov. 8, 2020, 5:57 p.m.