Last data update: 2014.03.03

R: Calculate scores for permutated read-enriched regions
permutatedWinScoresR Documentation

Calculate scores for permutated read-enriched regions

Description

Calculate scores for permutated read-enriched regions

Usage

permutatedWinScores(nn = 1, control, sample, fileOutput, chr = c("chr1", "chr2", "chr3", "chr4", "chr5"), chrL = "TAIR9", w = 300L, considerStrand = "Minimum", uniquelyMapped = TRUE, uniquePosition = FALSE, norm = 3 * 10^9, backg = -1, t = 1, g = 100,times=1e6,digits=2,test="Ratio")

Arguments

nn

ID to identify each permutation

control

data.frame structure obtained by loading the mapped reads with the function LoadMappedReads()

sample

data.frame structure obtained by loading the mapped reads with the function LoadMappedReads()

fileOutput

Name of the file were the results will be written

chr

Character vector containing the chromosome names as identified on q.

chrL

Numeric vector containing the length (bp) of the chromosomes. It should be in the same order than chr

w

Integer corresponding to the desired length of the extended reads.

considerStrand

Character value.

"Minimum"=>Default value. Report the minimum number of hits at each nucleotide position for both strands.

"Foward"=> Report the number of hits at each nucleotide position for the "foward" strands (the one denoted as "+" in q).

"Reverse"=>Report the number of hits at each nucleotide position for the "reverse" strands (the one denoted as "-" in q).

"Sum"=>Report the sum of number of hits at each nucleotide position for both strands.

uniquelyMapped

Logic value, If TRUE, only consider unquely mapped reads.

uniquePosition

Logic value. If TRUE, only consider reads mapped in different positions.

norm

Integer value. Number of hits will be reported by number of hits per norm nucleotides

backg

Any region with a hit value lower than backg in the control will be set to the value of backg

t

Numeric value. Read-enriched regions are calculated as genomic regions with score values bigger than t

g

Integer value. The maximum gap allowed between regions. Regions that are less than g bps away will be merged.

times

To be memory efficient, CSAR will only upload to the RAM memory fragments of length times. A bigger value means more RAM memory needed but whole process will be faster

digits

Number of decimal digits used to report the score values

test

Use a score based on the poisson distribution ("Poisson") or in the ratio ("Ratio")

Details

The parameter values should be the same than the one used in sigWin, ChIPseqScore, and mappedReads2Nhits. The label "control" and "sample" is asigned to each read to identify from which group they came. Labels are randomly permutated, and read-enriched regions for this new permuated dataset are calculated.

Value

The file filePutput is created with its values being the permuated score values.

Author(s)

Jose M Muino, jose.muino@wur.nl

References

Muino et al. (submitted). Plant ChIP-seq Analyzer: An R package for the statistcal detection of protein-bound genomic regions.
Kaufmann et al.(2009).Target genes of the MADS transcription factor SEPALLATA3: integration of developmental and hormonal pathways in the Arabidopsis flower. PLoS Biology; 7(4):e1000090.

See Also

CSAR-package,getPermutatedWinScores

Examples


##For this example we will use the a subset of the SEP3 ChIP-seq data (Kaufmann, 2009)
data("CSAR-dataset");
##We calculate the number of hits for each nucleotide posotion for the control and sample. We do that just for chromosome chr1, and for positions 1 to 10kb
nhitsS<-mappedReads2Nhits(sampleSEP3_test,file="sampleSEP3_test",chr=c("CHR1v01212004"),chrL=c(10000))
nhitsC<-mappedReads2Nhits(controlSEP3_test,file="controlSEP3_test",chr=c("CHR1v01212004"),chrL=c(10000))


##We calculate two sets of read-enrichment scores through permutation
permutatedWinScores(nn=1,sample=sampleSEP3_test,control=controlSEP3_test,fileOutput="test",chr=c("CHR1v01212004"),chrL=c(100000))
permutatedWinScores(nn=2,sample=sampleSEP3_test,control=controlSEP3_test,fileOutput="test",chr=c("CHR1v01212004"),chrL=c(100000))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(CSAR)
Loading required package: S4Vectors
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit


Attaching package: 'S4Vectors'

The following objects are masked from 'package:base':

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: IRanges
Loading required package: GenomeInfoDb
Loading required package: GenomicRanges
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/CSAR/permutatedWinScores.Rd_%03d_medium.png", width=480, height=480)
> ### Name: permutatedWinScores
> ### Title: Calculate scores for permutated read-enriched regions
> ### Aliases: permutatedWinScores
> 
> ### ** Examples
> 
> 
> ##For this example we will use the a subset of the SEP3 ChIP-seq data (Kaufmann, 2009)
> data("CSAR-dataset");
> ##We calculate the number of hits for each nucleotide posotion for the control and sample. We do that just for chromosome chr1, and for positions 1 to 10kb
> nhitsS<-mappedReads2Nhits(sampleSEP3_test,file="sampleSEP3_test",chr=c("CHR1v01212004"),chrL=c(10000))
mappedReads2Nhits has just finished   CHR1v01212004 ...
> nhitsC<-mappedReads2Nhits(controlSEP3_test,file="controlSEP3_test",chr=c("CHR1v01212004"),chrL=c(10000))
mappedReads2Nhits has just finished   CHR1v01212004 ...
> 
> 
> ##We calculate two sets of read-enrichment scores through permutation
> permutatedWinScores(nn=1,sample=sampleSEP3_test,control=controlSEP3_test,fileOutput="test",chr=c("CHR1v01212004"),chrL=c(100000))
mappedReads2Nhits has just finished   CHR1v01212004 ...
mappedReads2Nhits has just finished   CHR1v01212004 ...
CHR1v01212004  done...
CHR1v01212004 done...
Win file for permutation 1 can be found at test-1.permutatedWin
> permutatedWinScores(nn=2,sample=sampleSEP3_test,control=controlSEP3_test,fileOutput="test",chr=c("CHR1v01212004"),chrL=c(100000))
mappedReads2Nhits has just finished   CHR1v01212004 ...
mappedReads2Nhits has just finished   CHR1v01212004 ...
Error in file(description = control$filenames[i], "rb") : 
  cannot open the connection
Calls: permutatedWinScores -> ChIPseqScore -> file
In addition: Warning message:
In file(description = control$filenames[i], "rb") :
  cannot open file 'CHR1v01212004_test-PermutatedSet2-Control.CSARNhits': No such file or directory
Execution halted