Hello again,
Please ignore this thread. It turns out that I was using a Biostrings
version where Views was in the process of being modified. I just
re-installed Biostrings and Views works correctly using R 2.14.0devel.
Sorry for the spam >.<
Leonardo
R 2.14.0devel code with today's packages from biocLite()
> library(Biostrings)
Loading required package: IRanges
Attaching package: IRanges
The following object(s) are masked from package:base:
cbind, eval, intersect, Map, mapply, order, paste, pmax, pmax.int,
pmin, pmin.int, rbind, rep.int, setdiff, table, union
> dna <- DNAString("ATCG")
> ir <- IRanges(1:2, width=2)
> ir
IRanges of length 2
start end width
[1] 1 2 2
[2] 2 3 2
> Views(dna, ir)
Views on a 4-letter DNAString subject
subject: ATCG
views:
start end width
[1] 1 2 2 [AT]
[2] 2 3 2 [TC]
> DNAStringSet(Views(dna, ir))
A DNAStringSet instance of length 2
width seq
[1] 2 AT
[2] 2 TC
### What I want to do works well now in R 2.14.0devel :D
### The examples for XStringViews have warnings but those are intended!
> example(XStringViews)
XStrnV> v12 <- Views(DNAString("TAATAATG"), start=-2:9, end=0:11)
XStrnV> ## Do not do this anymore:
XStrnV> if (interactive()) {
XStrnV+ XStringViews(v12, subjectClass="RNAString") # DEPRECATED!
XStrnV+ }
Views on a 8-letter RNAString subject
subject: UAAUAAUG
views:
start end width
[1] -2 0 3 [ ]
[2] -1 1 3 [ U]
[3] 0 2 3 [ UA]
[4] 1 3 3 [UAA]
[5] 2 4 3 [AAU]
[6] 3 5 3 [AUA]
[7] 4 6 3 [UAA]
[8] 5 7 3 [AAU]
[9] 6 8 3 [AUG]
[10] 7 9 3 [UG ]
[11] 8 10 3 [G ]
[12] 9 11 3 [ ]
XStrnV> ## Do this instead:
XStrnV> xsbasetype(v12) <- "RNA"
XStrnV> ## Do not do this anymore:
XStrnV> if (interactive()) {
XStrnV+ XStringViews(AAString("MARKSLEMSIR*")) # DEPRECATED!
XStrnV+ }
Views on a 12-letter AAString subject
subject: MARKSLEMSIR*
views:
start end width
[1] 1 12 12 [MARKSLEMSIR*]
XStrnV> ## Do this instead:
XStrnV> as(AAString("MARKSLEMSIR*"), "Views")
Views on a 12-letter AAString subject
subject: MARKSLEMSIR*
views:
start end width
[1] 1 12 12 [MARKSLEMSIR*]
XStrnV> x <- c("abcdefghij", "KLMN")
XStrnV> ## Do not do this anymore:
XStrnV> if (interactive()) {
XStrnV+ XStringViews(x, subjectClass="BString") # DEPRECATED!
XStrnV+ }
Views on a 14-letter BString subject
subject: abcdefghijKLMN
views:
start end width
[1] 1 10 10 [abcdefghij]
[2] 11 14 4 [KLMN]
XStrnV> ## Do this instead (if you really want views):
XStrnV> as(BStringSet(x), "Views")
Views on a 14-letter BString subject
subject: abcdefghijKLMN
views:
start end width
[1] 1 10 10 [abcdefghij]
[2] 11 14 4 [KLMN]
XStrnV> ## otherwise just do:
XStrnV> BStringSet(x)
A BStringSet instance of length 2
width seq
[1] 10 abcdefghij
[2] 4 KLMN
Warning messages:
1: Using XStringViews(..., subjectClass="RNAString") on an XStringViews
object is deprecated. Please use 'xsbasetype(x) <- "RNA"' instead.
2: Using XStringViews() on a AAString object is deprecated.
Please use 'as(x, "Views")' instead.
3: Using XStringViews() on a character vector is deprecated.
Please use instead something like:
as(BStringSet(x)), "Views")
if you really want views, otherwise just:
BStringSet(x)
> ?XStringViews
starting httpd help server ... done
> sessionInfo()
R version 2.14.0 Under development (unstable) (2011-06-09 r56106)
Platform: i386-pc-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Biostrings_2.21.6 IRanges_1.11.10
loaded via a namespace (and not attached):
[1] tools_2.14.0
>
On Mon, Jun 20, 2011 at 11:24 AM, Leonardo Collado Torres <
[email protected]> wrote:
> Hello Bioc-sig list,
>
> I am unable to use Views on a DNAString object using R 2.14.0devel I
> believe that the error is unintended because it pops up when running the
> XStringViews examples. The same code works well in R 2.12.0 and 2.13.0
>
> If the error is not intended, then please teach me how to solve it.
>
> Thank you and greetings,
> Leonardo
>
>
> 2.14.0devel code:
>
>
> > library(Biostrings)
> Loading required package: IRanges
>
> Attaching package: IRanges
>
> The following object(s) are masked from package:base:
>
> cbind, eval, intersect, Map, mapply, order, paste, pmax, pmax.int,
> pmin, pmin.int, rbind, rep.int, setdiff, table, union
>
> > dna <- DNAString("ATCG")
> > ir <- IRanges(1:2, width=2)
> > ir
> IRanges of length 2
> start end width
> [1] 1 2 2
> [2] 2 3 2
> >
> > Views(dna, start = start(ir), end = end(ir))
> Error in initialize(value, ...) :
> invalid names for slots of class "XStringViews": ranges
> > Views(dna, ir)
> Error in initialize(value, ...) :
> invalid names for slots of class "XStringViews": ranges
>
> ### From the error message I thought that maybe it was a matter of adding
> "names" After all, Views does have a "names" argument.
> ### However, the error is still there.
>
> > args(Views)
> function (subject, start = NULL, end = NULL, width = NULL, names = NULL)
> NULL
> > Views(dna, start = start(ir), end = end(ir), names = letters[1:2])
> Error in initialize(value, ...) :
> invalid names for slots of class "XStringViews": ranges
> >
> > ?XStringViews
> starting httpd help server ... done
> > example(XStringViews)
>
> XStrnV> v12 <- Views(DNAString("TAATAATG"), start=-2:9, end=0:11)
> Error in initialize(value, ...) :
> invalid names for slots of class "XStringViews": ranges
> > sessionInfo()
> R version 2.14.0 Under development (unstable) (2011-06-09 r56106)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252
> [2] LC_CTYPE=English_United States.1252
> [3] LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] Biostrings_2.21.4 IRanges_1.11.8
>
> loaded via a namespace (and not attached):
> [1] tools_2.14.0
> >
>
>
>
>
>
> R 2.12.0 code:
>
>
>
>
> > library(Biostrings)
> Loading required package: IRanges
>
> Attaching package: 'IRanges'
>
> The following object(s) are masked from 'package:base':
>
> cbind, eval, Map, mapply, order, paste, pmax, pmax.int, pmin,
> pmin.int, rbind, rep.int, table
>
> > dna <- DNAString("ATCG")
> > ir <- IRanges(1:2, width=2)
> > ir
> IRanges of length 2
> start end width
> [1] 1 2 2
> [2] 2 3 2
> > Views(dna, start = start(ir), end = end(ir))
> Views on a 4-letter DNAString subject
> subject: ATCG
> views:
> start end width
> [1] 1 2 2 [AT]
> [2] 2 3 2 [TC]
> > DNAStringSet(Views(dna, start = start(ir), end = end(ir)))
> A DNAStringSet instance of length 2
> width seq
> [1] 2 AT
> [2] 2 TC
> > Views(dna, ir)
> Views on a 4-letter DNAString subject
> subject: ATCG
> views:
> start end width
> [1] 1 2 2 [AT]
> [2] 2 3 2 [TC]
> > example(XStringViews)
>
> XStrnV> v12 <- Views(DNAString("TAATAATG"), start=-2:9, end=0:11)
>
> XStrnV> XStringViews(v12, subjectClass="RNAString")
> Views on a 8-letter RNAString subject
> subject: UAAUAAUG
> views:
> start end width
> [1] -2 0 3 [ ]
> [2] -1 1 3 [ U]
> [3] 0 2 3 [ UA]
> [4] 1 3 3 [UAA]
> [5] 2 4 3 [AAU]
> [6] 3 5 3 [AUA]
> [7] 4 6 3 [UAA]
> [8] 5 7 3 [AAU]
> [9] 6 8 3 [AUG]
> [10] 7 9 3 [UG ]
> [11] 8 10 3 [G ]
> [12] 9 11 3 [ ]
>
> XStrnV> XStringViews(AAString("MARKSLEMSIR*"))
> Views on a 12-letter AAString subject
> subject: MARKSLEMSIR*
> views:
> start end width
> [1] 1 12 12 [MARKSLEMSIR*]
>
> XStrnV> XStringViews("abcdefghij", subjectClass="BString")
> Views on a 10-letter BString subject
> subject: abcdefghij
> views:
> start end width
> [1] 1 10 10 [abcdefghij]
> > sessionInfo()
> R version 2.12.0 (2010-10-15)
> Platform: x86_64-pc-mingw32/x64 (64-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252
> [2] LC_CTYPE=English_United States.1252
> [3] LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] Biostrings_2.18.0 IRanges_1.8.0
>
> loaded via a namespace (and not attached):
> [1] Biobase_2.10.0 tools_2.12.0
> >
>
>
>
>
>
>
>
>
> R 2.13.0 code
>
>
> > library(Biostrings)
> Loading required package: IRanges
>
> Attaching package: 'IRanges'
>
> The following object(s) are masked from 'package:base':
>
> cbind, eval, intersect, Map, mapply, order, paste, pmax, pmax.int,
> pmin, pmin.int, rbind, rep.int, setdiff, table, union
>
> > dna <- DNAString("ATCG")
> > ir <- IRanges(1:2, width=2)
> > ir
> IRanges of length 2
> start end width
> [1] 1 2 2
> [2] 2 3 2
> > Views(dna, ir)
> Views on a 4-letter DNAString subject
> subject: ATCG
> views:
> start end width
> [1] 1 2 2 [AT]
> [2] 2 3 2 [TC]
> > DNAStringSet(Views(dna, ir))
> A DNAStringSet instance of length 2
> width seq
> [1] 2 AT
> [2] 2 TC
> > example(XStringViews)
>
> XStrnV> v12 <- Views(DNAString("TAATAATG"), start=-2:9, end=0:11)
>
> XStrnV> XStringViews(v12, subjectClass="RNAString")
> Views on a 8-letter RNAString subject
> subject: UAAUAAUG
> views:
> start end width
> [1] -2 0 3 [ ]
> [2] -1 1 3 [ U]
> [3] 0 2 3 [ UA]
> [4] 1 3 3 [UAA]
> [5] 2 4 3 [AAU]
> [6] 3 5 3 [AUA]
> [7] 4 6 3 [UAA]
> [8] 5 7 3 [AAU]
> [9] 6 8 3 [AUG]
> [10] 7 9 3 [UG ]
> [11] 8 10 3 [G ]
> [12] 9 11 3 [ ]
>
> XStrnV> XStringViews(AAString("MARKSLEMSIR*"))
> Views on a 12-letter AAString subject
> subject: MARKSLEMSIR*
> views:
> start end width
> [1] 1 12 12 [MARKSLEMSIR*]
>
> XStrnV> XStringViews("abcdefghij", subjectClass="BString")
> Views on a 10-letter BString subject
> subject: abcdefghij
> views:
> start end width
> [1] 1 10 10 [abcdefghij]
> > sessionInfo()
> R version 2.13.0 (2011-04-13)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252
> [2] LC_CTYPE=English_United States.1252
> [3] LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] Biostrings_2.20.1 IRanges_1.10.4
>
> loaded via a namespace (and not attached):
> [1] tools_2.13.0
> >
>
>
[[alternative HTML version deleted]]
_______________________________________________
Bioc-sig-sequencing mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing