Description Usage Arguments Value Author(s) See Also Examples
Get the numbers of multi-hits for bam file
1 | getBamMultiMatching(bamFile, pairedMode = c("paired", "first", "second"))
|
bamFile |
The filenames of input bam file. The input bam files have to be sorted and indexed, which means ".bai" file must exit. |
pairedMode |
The |
It returns a integer vector that holds the numbers of unmapped reads (If the input read count cannot be retrieved from bam file), the reads that have exactly one hit, the reads that have exactly two hits, and so on.
Ge Tan
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
## This example is not tested because it requires external software "samtools"
### Prepare the bam files
bamfile <- system.file("extdata", "ex1.bam", package="Rsamtools",
mustWork=TRUE)
tempBamFile <- tempfile(fileext=".bam")
file.copy(bamfile, tempBamFile)
reads1 <- file.path(system.file("extdata", package="NGS"), "fastq",
"nanocage_ACAGAT_carp_embryo_R1.fastq")
addInputReadCounts(bamFiles=tempBamFile, reads1s=reads1, binary="samtools")
tempBamFile2 <- tempfile(fileext=".bam")
tempBamFile2 <- sortBam(tempBamFile,
sub("\\.bam$", "", tempBamFile2, ignore.case=TRUE))
file.copy(tempBamFile2, tempBamFile, overwrite=TRUE)
file.remove(tempBamFile2)
indexBam(tempBamFile)
### Get the multiMatching;
### Due to small reads number in the exmaples, we have negative counts for "0"
getBamMultiMatching(tempBamFile)
file.remove(tempBamFile)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.