1
我有S4類的對象象下面這樣:如何分割,並寫入了S4對象的文件中的R
> gadem
Object of class 'gadem'
This object has the following slots:
motifs,pwm,consensus,align,name,seq,chr,start,end,strand,seqID,pos,pval,fastaHeader
> gadem[[1]] An object of class "motif" Slot "pwm": 1 2 3 4 5 6 7 8 9 10 11 A 0.3404 0 0.0000 0.6375 0.2723 0.3173 0 0.0002 0.3126 0 0.4969 C 0.4281 0 0.8708 0.1474 0.0767 0.1122 0 0.0000 0.0981 1 0.2558 G 0.1414 0 0.0000 0.0361 0.4153 0.5088 0 0.1134 0.0532 0 0.0000 T 0.0901 1 0.1292 0.1790 0.2357 0.0617 1 0.8864 0.5361 0 0.2473 Slot "consensus": [1] "mTCAnrTTwCm" Slot "alignList": [[1]] An object of class "align" Slot "seq": [1] "CTCAGGTTTCA" Slot "chr": [1] "chr12" Slot "start": [1] 29470324 Slot "end": [1] 29470423 Slot "strand": [1] "+" Slot "seqID": [1] 5239 Slot "pos": [1] 67 Slot "pval": [1] 1.862121e-09 Slot "fastaHeader": [1] 5239
[[2]] An object of class "align" Slot "seq": [1] "CTCAGGTTTCA" Slot "chr": [1] "chr18" Slot "start": [1] 4862453 Slot "end": [1] 4862571 Slot "strand": [1] "+" Slot "seqID": [1] 12645 Slot "pos": [1] 68 Slot "pval": [1] 1.862121e-09 Slot "fastaHeader": [1] 12645
從這個對象,我想生成一個文件與時隙Seq |列插槽chr |插槽開始|插槽結束|插槽鏈|插槽seqID |插槽pos |插槽pval |插槽fastaHeader。
如何從S4對象生成和寫入這樣的.txt文件?
可以提取使用'@'或'槽(對象,廣告位名稱)'槽。在這裏稍微介紹一下S4對象:http://cran.r-project.org/doc/contrib/Genolini-S4tutorialV0-5en.pdf –
更好的做法是使用軟件包作者提供的方法,或許在' class?gadem',來訪問數據。 –