countsPlot: Graphs of sample read counts (quality assesment)

Description Usage Arguments Value Examples

View source: R/countsPlot.R

Description

Graphs of sample read counts (quality assesment)

Usage

1
countsPlot(listCounts, ixCounts, log2Bool)

Arguments

listCounts

a list of data.frame objects. It contains the counts on the genomic features. Each data.frame in the list should have the same number of columns.

ixCounts

a numeric (a vector of integers). It contains the index of the columns containing counts in the dataFrame.

log2Bool

a numeric, either 0 or 1. 0 (default) for no log2 transformation and 1 for log2 transformation.

Value

A list of pairs and boxplots between the counts data in each data.frame.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#read the BAM file into a GAlignments object using
#GenomicAlignments::readGAlignments
#the GAlignments object should be similar to ctrlGAlignments
data(ctrlGAlignments)
aln <- ctrlGAlignments

#transform the GAlignments object into a GRanges object (faster processing)
alnGRanges <- readsToStartOrEnd(aln, what="start")

#make a txdb object containing the annotations for the specified species.
#In this case hg19.
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene::TxDb.Hsapiens.UCSC.hg19.knownGene
#Please make sure that seqnames of txdb correspond to
#the seqnames of the alignment files ("chr" particle)
#if not rename the txdb seqlevels
#renameSeqlevels(txdb, sub("chr", "",seqlevels(txdb)))
#get the flanking region around the promoter of the best expressed CDSs

#get all CDSs by transcript
cds <- GenomicFeatures::cdsBy(txdb,by="tx",use.names=TRUE)

#get all exons by transcript
exonGRanges <- GenomicFeatures::exonsBy(txdb,by="tx",use.names=TRUE)

#get the per transcript relative position of start and end codons
cdsPosTransc <- orfRelativePos(cds, exonGRanges)

#compute the counts on the different features after applying
#the specified shift value on the read start along the transcript
countsData <-
   countShiftReads(
         exonGRanges[names(cdsPosTransc)],
         cdsPosTransc,
         alnGRanges,
         -14
     )

#now make the plots
listCountsPlots <- countsPlot(
   list(countsData[[1]]),
   grep("_counts$", colnames(countsData[[1]])),
   1
)
listCountsPlots

RiboProfiling documentation built on Nov. 8, 2020, 5:26 p.m.