Learn R Programming

SICtools (version 1.2.2)

snpDiff: main function to test point differences between the two bam files

Description

test base count (A,T,G,C) difference at a given position between the two bam files. The base count matrix is tested by fisher exact test and euclidean distance. If nothing difference, NULL will be returned.

Usage

snpDiff(bam1, bam2, refFsa, regChr, regStart, regEnd, minBaseQuality = 13, minMapQuality = 0, nCores = 1, pValueCutOff = 0.05, baseDistCutOff = 0.1,verbose = TRUE)

Arguments

bam1
the first bam file to be compared
bam2
the second bam file to be compared
refFsa
the reference fasta file used for bam1 and bam2 alignments
regChr
chromosome name of the region of interest, it should match the chromosome name in reference name
regStart
the start position (1-based) of the region of interest
regEnd
the end position (1-based) of the region of interest
minBaseQuality
the minimum base quality to be used for base count
minMapQuality
the minimum read mapping quality to be used for base count
nCores
number of thread used for calculate in parallel
pValueCutOff
p.value cutoff from fisher.test to display output. If there is no difference between two compared positions (p.value = 1 and d.value = 0), NULL will be returned even setting pValueCutOff = 1.
baseDistCutOff
euclidean distance cutoff from dist(,method='euclidean') to display output. If there is no difference between two compared positions (p.value = 1 and d.value = 0), NULL will be returned even setting baseDistCutOff = 0.
verbose
print progress on screen, default = TRUE.

Value

: returns a data.frame with difference information: chromosome, position, reference base, base count (A,C,G,T,N) for two bam files, p.value (fisher exact test of these base counts) and d.value (euclidean distance of these base counts)

References

Morgan M, Pages H, Obenchain V and Hayden N. Rsamtools: Binary alignment (BAM), FASTA, variant call (BCF), and tabix file import.

Examples

Run this code

bam1 <- system.file(package='SICtools','extdata','example1.bam')
bam2 <- system.file(package='SICtools','extdata','example2.bam')
refFsa <- system.file(package='SICtools','extdata','example.ref.fasta')

snpDiff(bam1,bam2,refFsa,'chr04',962501,1026983,pValueCutOff=1,baseDistCutOff=0)

Run the code above in your browser using DataLab