export.wig: Generates a WIG file containing the coverage values for a...

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/export.wig.R

Description

Write the coverage values calculated using the cov.interval function into a WIG format file

Usage

1
2
## S4 method for signature 'numeric'
export.wig(cov,outfile=NULL)

Arguments

cov

Numeric vector containing the coverage values generated by the function cov.interval

outfile

Where to write the .WIG format file that will contain the coverages

Details

This method is used to write the coverage values calculated by the cov.interval function into a WIG format file.

Author(s)

Ernesto Lowy <ernestolowy@gmail.com>

References

WIG format specification: https://genome.ucsc.edu/FAQ/FAQformat.html

See Also

cov.interval

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#get treatment and control test files
treat1file<-system.file("extdata","treat.bam",package="CoverageView")
control1file<-system.file("extdata","ctrl.bam",package="CoverageView")
  
#create two CoverageBamFile objects representing single-end alignments
trm1<-CoverageBamFile(treat1file,run_type="single")
ctl1<-CoverageBamFile(control1file,run_type="single")
  
#calculate the ratio of the coverages for the defined genomic interval using a bin_width equal to 10 nts
cov1=cov.interval(trm1,ctl1,chr="chrI",start=1,end=100,bin_width=10,do="ratio")
  
#create a WIG file with the obtained vector with the ratios
outfolder=system.file("extdata",package="CoverageView")
an_outfile1=paste(outfolder,"out.wig",sep="/")
export.wig(cov1,outfile=an_outfile1)

CoverageView documentation built on Nov. 8, 2020, 7:52 p.m.