Last data update: 2014.03.03

R: Add a psuedoalignment as a placeholder for the chromosome...
addPseudoAlignmentR Documentation

Add a psuedoalignment as a placeholder for the chromosome (Internal function)

Description

Check whether chromosome has at least one alignment to prevent abnormal behaviour of the subsequent functions. In case no alignment is found on an entire chromosome, add a pseudo-alignment as a placeholder for that chromosome.

Usage

addPseudoAlignment(alignGR)

Arguments

alignGR

GRanges object containing the alignment information.

Details

In case no alignment is found on an entire chromosome, add an alignment with start 1 and end 20 as a placeholder for the chromosome. This step is necessary to maintian the chromosome information.

Value

alignGR

Original or augmented input GRanges object with pseudoreads, depending on whether there exists empty chromosome(s).

Author(s)

Yue Li

See Also

combineAlignGals, readGAlignments, readGAlignmentPairs, import

Examples

# Retrieve system files
extdata.dir <- system.file("extdata", package="RIPSeeker") 

bamFiles <- list.files(extdata.dir, ".bam$", recursive=TRUE, full.names=TRUE)

bamFiles <- grep("PRC2", bamFiles, value=TRUE)

alignGal <- getAlignGal(bamFiles[1], reverseComplement=TRUE, genomeBuild="mm9")

alignGR <- as(alignGal, "GRanges")

alignGR

x <- addPseudoAlignment(alignGR)

x

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(RIPSeeker)
Loading required package: S4Vectors
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


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: GenomeInfoDb
Loading required package: SummarizedExperiment
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: Rsamtools
Loading required package: Biostrings
Loading required package: XVector
Loading required package: GenomicAlignments
Loading required package: rtracklayer
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/RIPSeeker/addPseudoAlignment.Rd_%03d_medium.png", width=480, height=480)
> ### Name: addPseudoAlignment
> ### Title: Add a psuedoalignment as a placeholder for the chromosome
> ###   (Internal function)
> ### Aliases: addPseudoAlignment
> 
> ### ** Examples
> 
> # Retrieve system files
> extdata.dir <- system.file("extdata", package="RIPSeeker") 
> 
> bamFiles <- list.files(extdata.dir, ".bam$", recursive=TRUE, full.names=TRUE)
> 
> bamFiles <- grep("PRC2", bamFiles, value=TRUE)
> 
> alignGal <- getAlignGal(bamFiles[1], reverseComplement=TRUE, genomeBuild="mm9")
Processing /home/ddbj/local/lib64/R/library/RIPSeeker/extdata/PRC2/SRR039210_processed_tophat/accepted_hits_noDup_sel_chrX.bam ... All hits are returned with flags.
> 
> alignGR <- as(alignGal, "GRanges")
> 
> alignGR
GRanges object with 24992 ranges and 1 metadata column:
                    seqnames                 ranges strand | uniqueHit
                       <Rle>              <IRanges>  <Rle> | <logical>
  SRR039210.4322179     chrX     [3000326, 3000361]      + |     FALSE
  SRR039210.5524106     chrX     [3001293, 3001328]      - |     FALSE
  SRR039210.5069294     chrX     [3002790, 3002825]      - |     FALSE
  SRR039210.1476279     chrX     [3016328, 3016363]      - |      TRUE
   SRR039210.711491     chrX     [3021161, 3021196]      + |     FALSE
                ...      ...                    ...    ... .       ...
  SRR039210.5110638     chrX [166650097, 166650131]      + |      TRUE
  SRR039210.5237616     chrX [166650097, 166650132]      + |      TRUE
  SRR039210.4136452     chrX [166650206, 166650241]      + |     FALSE
   SRR039210.827125     chrX [166650227, 166650262]      + |      TRUE
  SRR039210.5317781     chrX [166650235, 166650270]      + |      TRUE
  -------
  seqinfo: 22 sequences from mm9 genome
> 
> x <- addPseudoAlignment(alignGR)
*** chr1 do not have any alignment.
*** chr10 do not have any alignment.
*** chr11 do not have any alignment.
*** chr12 do not have any alignment.
*** chr13 do not have any alignment.
*** chr14 do not have any alignment.
*** chr15 do not have any alignment.
*** chr16 do not have any alignment.
*** chr17 do not have any alignment.
*** chr18 do not have any alignment.
*** chr19 do not have any alignment.
*** chr2 do not have any alignment.
*** chr3 do not have any alignment.
*** chr4 do not have any alignment.
*** chr5 do not have any alignment.
*** chr6 do not have any alignment.
*** chr7 do not have any alignment.
*** chr8 do not have any alignment.
*** chr9 do not have any alignment.
*** chrM do not have any alignment.
*** chrY do not have any alignment.

*** 21 pseudoreads are appended to the end.
> 
> x
GRanges object with 25013 ranges and 1 metadata column:
                    seqnames             ranges strand | uniqueHit
                       <Rle>          <IRanges>  <Rle> | <logical>
  SRR039210.4322179     chrX [3000326, 3000361]      + |     FALSE
  SRR039210.5524106     chrX [3001293, 3001328]      - |     FALSE
  SRR039210.5069294     chrX [3002790, 3002825]      - |     FALSE
  SRR039210.1476279     chrX [3016328, 3016363]      - |      TRUE
   SRR039210.711491     chrX [3021161, 3021196]      + |     FALSE
                ...      ...                ...    ... .       ...
      pseudoreads17     chr7            [1, 20]      + |     FALSE
      pseudoreads18     chr8            [1, 20]      + |     FALSE
      pseudoreads19     chr9            [1, 20]      + |     FALSE
      pseudoreads20     chrM            [1, 20]      + |     FALSE
      pseudoreads21     chrY            [1, 20]      + |     FALSE
  -------
  seqinfo: 22 sequences from mm9 genome
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>