read.bismark-methods: Read from sorted Bismark SAM files

Description Usage Arguments Value Note Examples

Description

The function calls methylation percentage per base from sorted Bismark SAM files and reads methylation information as methylRaw or methylRawList object. Bismark is a popular aligner for high-throughput bisulfite sequencing experiments and it outputs its results in SAM format by default. Bismark SAM format contains aligner specific tags which are absolutely necessary for methylation percentage calling. SAM files from other aligners will not work with this function.

Usage

1
2
3
4
  read.bismark(location, sample.id, assembly,
    save.folder = NULL, save.context = c("CpG"),
    read.context = "CpG", nolap = FALSE, mincov = 10,
    minqual = 20, phred64 = FALSE, treatment)

Arguments

location

location of sam file(s). If multiple files are given this argument must be a list.

sample.id

the id(s) of samples in the same order as file. If multiple sam files are given this arugment must be a list.

save.folder

The folder which will be used to save methylation call files, if set to NULL no methylation call file will be saved as a text file. The files saved can be read into R in less time using read function in methylKit

save.context

A character vector consisting following strings: "CpG","CHG","CHH". The methylation percentages for these methylation contexts will be saved to save.folder

read.context

One of the 'CpG','CHG','CHH' or 'none' strings. Determines what type of methylation context will be read-in to the memory which can be immediately used for analysis. If given as 'none', read.bismark will not return any object, but if a save.folder argument given it will save the methylation percentage call files.

assembly

string that determines the genome assembly. Ex: mm9,hg18 etc.

nolap

if set to TRUE and the SAM file has paired-end reads, the one read of the overlapping paired-end read pair will be ignored for methylation calling.

mincov

minimum read coverage to call a methylation status for a base.

minqual

minimum phred quality score to call a methylation status for a base.

phred64

logical ( default: FALSE) you will not need to set this TRUE, Currently bismark gives only phred33 scale

treatment

treatment vector only to be used when location and sample.id parameters are lists and you are trying to read-in multiple samples that are related to eachother in down-stream analysis.

Value

methylRaw or methylRawList object

Note

SAM files should be sorted with samtools sort or unix sort. Other sorting methods can alter the order of fields(columns) in the SAM file and that will result in an error when using read.bismark().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# reading one bismark file:
my.file=system.file("extdata", "test.fastq_bismark.sorted.min.sam",
                                                       package = "methylKit")
obj=read.bismark(my.file,"test",assembly="hg18",save.folder=NULL,
                 save.context="CpG",read.context="CpG")

# reading multiple files
file.list2=list(system.file("extdata", "test.fastq_bismark.sorted.min.sam", package = "methylKit"),
               system.file("extdata", "test.fastq_bismark.sorted.min.sam", package = "methylKit"),
              system.file("extdata", "test.fastq_bismark.sorted.min.sam", package = "methylKit"),
               system.file("extdata", "test.fastq_bismark.sorted.min.sam", package = "methylKit"))

 objs=read.bismark(location=file.list2
             ,sample.id=list("test1","test2","ctrl1","ctrl1"),assembly="hg18",
             save.folder=NULL,save.context=NULL,read.context="CpG",
             nolap=FALSE,mincov=10,minqual=20,phred64=FALSE,treatment=c(1,1,0,0))

fortunatobianconi/methylkit documentation built on May 16, 2019, 1:51 p.m.