returns the bam data.frame with an additional column counts. Only relevant if the fasta file used for mapping input was previously collapsed via fastx_toolkit to return a fasta read name in the format of readnumber-totalcounts
Usage
getCountMatrix(bam_file,pseudo=FALSE)
Arguments
bam_file
An object of class DataFrame (from IRanges). Can be generated from readBam.
pseudo
Logical. If TRUE, assume the reads in the bam file does not have a count record and sets all counts to 1.
Value
An object of class data.frame having the values from the original bam file with an additional 'count' column.
Author(s)
Diana H.P. Low
See Also
readBam
Examples
data(ssviz)
getCountMatrix(ctrlbam)
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(ssviz)
Loading required package: Rsamtools
Loading required package: GenomeInfoDb
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
Loading required package: S4Vectors
Attaching package: 'S4Vectors'
The following objects are masked from 'package:base':
colMeans, colSums, expand.grid, rowMeans, rowSums
Loading required package: IRanges
Loading required package: GenomicRanges
Loading required package: Biostrings
Loading required package: XVector
Loading required package: reshape
Attaching package: 'reshape'
The following objects are masked from 'package:S4Vectors':
expand, rename
Loading required package: ggplot2
Loading required package: RColorBrewer
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/ssviz/getCountMatrix.Rd_%03d_medium.png", width=480, height=480)
> ### Name: getCountMatrix
> ### Title: getCountMatrix
> ### Aliases: getCountMatrix
>
> ### ** Examples
>
> data(ssviz)
> getCountMatrix(ctrlbam)
DataFrame with 9976 rows and 14 columns
qname flag rname strand pos qwidth mapq
<character> <integer> <factor> <factor> <integer> <integer> <integer>
1 74300-21 16 chr1 - 3005526 24 NA
2 95290-16 16 chr1 - 3005696 23 NA
3 114695-13 0 chr1 + 3005832 24 NA
4 97521-15 16 chr1 - 3008048 30 NA
5 100554-15 16 chr1 - 3008818 29 NA
... ... ... ... ... ... ... ...
9972 111742-13 16 chr1 - 16828975 27 NA
9973 24886-63 0 chr1 + 16833561 27 NA
9974 102926-15 16 chr1 - 16834169 25 NA
9975 122260-12 0 chr1 + 16838393 29 NA
9976 108613-14 16 chr1 - 16838446 26 NA
cigar mrnm mpos isize seq
<character> <factor> <integer> <integer> <DNAStringSet>
1 24M NA 0 0 CATATTGTGC...TCCTTTGTGA
2 23M NA 0 0 GGTTCTTTCCAGCTTCTGGCTAT
3 24M NA 0 0 AATTTTCTGA...CCGCCAGACT
4 30M NA 0 0 TTCCAGTTTT...GCCTTTTGTA
5 29M NA 0 0 GTTTCACTGT...TAGTTTCTGT
... ... ... ... ... ...
9972 27M NA 0 0 AAACAACACC...ATAGTCACAA
9973 27M NA 0 0 TTTGTCTCTG...TTCCATGGGT
9974 25M NA 0 0 GACTGATTTC...TGGTTGTACA
9975 29M NA 0 0 TAGGACGTGT...ATTGGCTGCA
9976 26M NA 0 0 GAGGAAGGCA...ATGGAGTGAA
qual counts
<PhredQuality> <numeric>
1 IIIIIIIIII...IIIIIIIIII 21
2 IIIIIIIIIIIIIIIIIIIIIII 16
3 IIIIIIIIII...IIIIIIIIII 13
4 IIIIIIIIII...IIIIIIIIII 15
5 IIIIIIIIII...IIIIIIIIII 15
... ... ...
9972 IIIIIIIIII...IIIIIIIIII 13
9973 IIIIIIIIII...IIIIIIIIII 63
9974 IIIIIIIIII...IIIIIIIIII 15
9975 IIIIIIIIII...IIIIIIIIII 12
9976 IIIIIIIIII...IIIIIIIIII 14
>
>
>
>
>
> dev.off()
null device
1
>