문제

I need to create an object of type ShortReadQ from Bioconductor's ShortRead library.

ShortReadQ 'signature(sread = "DNAStringSet", quality =
          "QualityScore", id = "BStringSet")'

The quality slot needs to be an object inheriting from QualityScore, of which I can easily determine from another ShortReadQ object that I wish to emulate.

> class(quality(anotherObject))
[1] "SFastqQuality"
attr(,"package")
[1] "ShortRead"

What is the best way to use that information ("SFastqQuality") in the contructor argument?

newObject<-ShortReadQ(sread=...,
             quality=SFastqQuality(...), 
             id=...)
도움이 되었습니까?

해결책 3

thanks for your responses. they lead me to a solution that works

newObject<-ShortReadQ(sread=...,
             quality=new(Class=class(quality(anotherObject)),theFirstParameter=...), 
             id=...)

다른 팁

Does this do what you want?

quality = new(class(old.quality.obj)[[1]]))

You might want the get function:

a <- get(class(object))
a(...)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top