motifbincount: Count reads overlapping consecutive bins at motif sites

Description Usage Arguments Details Value Author(s) Examples

View source: R/DynaMO.R

Description

Count numbers of reads overlapping consecutive bins at motif sites.

Usage

1
motifbincount(motifbin, reads, core, seqL, format = "bam", name, ratio)

Arguments

motifbin

A list object where each element is a GRanges object storing locations of consecutive bins at motif sites of one motif.

reads

A list object where each element is a GRanges object storing read coordinates of one sample, or a data.frame object where each row is the path to a file storing aligned reads of one sample

core

The number of cores to use.

seqL

The length to be extended from the 5' ends of reads.

format

The format of aligned reads. The format can be a .txt file or a .bam file.

name

The id of histone modification or other marker. For example, for the first histone modification, name equals to 1. For the second histone modification, name equals to 2.

ratio

A vector of ratios normalized by total number of reads across samples.

Details

The function calculates the numbers of reads from each sample overlapping consecutive bins at motif sites of each motif. Two types of bin input are expected. For the first type, each element of the input list is a GRanges object storing bins at motif sites and the output is written in a .txt file named motifbin_name_sampleid_motifid.txt. For the second type, each element of the input list is still a list object containing three GRanges objects storing positive, negative and background bins for training purpose. The outputs are written in three .txt files names motifbin_name_sampleid_motifid_1.txt (positive), motifbin_name_sampleid_motifid_2.txt (negative), and motifbin_name _sampleid_motifid_3.txt (background).

Value

Each output is a vector of read counts at bins of each motif from each sample and written in a .txt file.

Author(s)

Zheng Kuang

Examples

1
2
3
4
5
6
readfile<-system.file("extdata","read1.txt",package="DynaMO",mustWork=TRUE)
read1<-get.reads(readfile,150,"txt")
readfile<-system.file("extdata","motif_1.txt",package="DynaMO",mustWork=TRUE)
motif1<-get.motif(readfile,300)
motifbin1<-get.motifbin(motif1,20)
motifbincount(list(motifbin1),list(read1),1,150,"txt",1,c(1,1,1,1))

spo111/DynaMO documentation built on May 30, 2019, 7:59 a.m.