~ubuntu-branches/ubuntu/wily/r-bioc-genomicranges/wily-proposed

« back to all changes in this revision

Viewing changes to inst/unitTests/test_GAlignments-class.R

  • Committer: Package Import Robot
  • Author(s): Andreas Tille
  • Date: 2013-11-26 19:52:13 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20131126195213-1zwbthnie0a7fdns
Tags: 1.14.3-1
* New upstream version
  Closes: #730574
* Build-Depends: r-bioc-xvector

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
test_GAlignments_constructor <- function()
 
2
{
 
3
    checkTrue(validObject(GAlignments()))
 
4
    checkTrue(validObject(GAlignments(seqnames=factor("A"),
 
5
                                      pos=1L, cigar="1M",
 
6
                                      strand=strand("-"))))
 
7
}
 
8
 
 
9
test_GAlignments_concat <- function() 
 
10
{
 
11
    galn <- GAlignments(seqnames=factor("A"),
 
12
                        pos=1L, cigar="1M",
 
13
                        strand=strand("-"))
 
14
    galn_c <- GAlignments(seqnames=rep(factor("A"), 2),
 
15
                          pos=rep(1L, 2), cigar=rep("1M", 2),
 
16
                          strand=rep(strand("-"), 2))
 
17
    checkIdentical(galn_c, c(galn, galn))
 
18
}
 
19
 
 
20
test_GAlignments_qnarrow <- function() 
 
21
{
 
22
    gal <- GAlignments(seqnames=rep(factor("A"), 8),
 
23
                       pos=10:17,
 
24
                       cigar=c("5M", "5X", "3M2I3M", "3M2D3M",
 
25
                               "3M2N3M", "3M2S3M", "3M2H3M", "3M2P3M"),
 
26
                       strand=Rle(strand(rep("+", 8))))
 
27
    n1 <- narrow(gal, start=3)
 
28
    q1 <- qnarrow(gal, start=3)
 
29
    checkIdentical(qwidth(n1), qwidth(q1)) 
 
30
    checkIdentical(width(n1), width(q1))
 
31
 
 
32
    n2 <- narrow(gal, start=4)
 
33
    q2 <- qnarrow(gal, start=4)
 
34
    checkIdentical(width(n2), width(q2))
 
35
    ## M and X 
 
36
    checkIdentical(qwidth(n2[1:2]), qwidth(q2[1:2]))
 
37
    ## I 
 
38
    checkIdentical(qwidth(q2[3]), width(q2[3]) + 2L)
 
39
    ## D, N and P
 
40
    checkIdentical(qwidth(q2[c(4,5,8)]), width(q2[c(4,5,8)]))
 
41
    ## S and H
 
42
    checkIdentical(qwidth(q2[6]), width(q2[6]) + 2L)
 
43
    checkIdentical(qwidth(q2[7]), width(q2[7]))
 
44
}