Help needed with topGene function of RankProd package
1
0
Entering edit mode
Gaurav Kumar ▴ 30
@gaurav-kumar-4619
Last seen 7.4 years ago
Hello, I'm using RankProd package to see the differential gene expression in two class of samples as given below: library(RankProd) RP.out <- RP(matrix,class.label,logged=TRUE,num.perm=100,rand=123) #print(RP.out) gene.list <- topGene(RP.out,gene.names=rownames(matrix), logged=TRUE,logbase=2,cutoff=0.05,method="pfp", num.gene=100) upRegulated <- file("./test.txt", open="wt") writeLines(gene.list$Table1,upRegulated) close(upRegulated) I can see the $Table1 result in R console but i can't print the same as an output file, showing Error in writeLines(gene.list$Table1, upRegulated) : invalid 'text' argument can anyone help me how to redirect the $Table1 results to an output file. Thanks in advance, cheers -- ---------------------- PhD Student (Bioinformatics/Computational Biology) Dept. of Chemistry and Biomolecular Sciences, Macquarie University, Sydney, Australia. URL:http://gauravkumar.org
RankProd RankProd • 858 views
ADD COMMENT
0
Entering edit mode
@steve-lianoglou-2771
Last seen 21 hours ago
United States
Hi, On Tue, Sep 6, 2011 at 8:48 PM, Gaurav Kumar <gaurav.kumar at="" mq.edu.au=""> wrote: > Hello, > > I'm using RankProd package to see the differential gene expression in > two class of samples > as given below: > > library(RankProd) > RP.out <- RP(matrix,class.label,logged=TRUE,num.perm=100,rand=123) > #print(RP.out) > gene.list <- topGene(RP.out,gene.names=rownames(matrix), > logged=TRUE,logbase=2,cutoff=0.05,method="pfp", num.gene=100) > upRegulated <- file("./test.txt", open="wt") > writeLines(gene.list$Table1,upRegulated) > close(upRegulated) > > I can see the $Table1 result in R console but i can't print the same > as an output file, > showing > Error in writeLines(gene.list$Table1, upRegulated) : > ?invalid 'text' argument It seems gene.list$Table1 is a matrix, with rownames having gene id's in some fashion (I'm going from the example code in ?topGene) I'd turn this into a data.frame and add a gene.id column to it, then write it out "as usual." Let's say the result of topGene() is stored in a var called gene.list, eg: R> x1 <- transform(as.data.frame(gene.list$Table1), gene.id=rownames(gene.list$Table1)) R> write.table(x1, '~/top.gene.1.txt', sep="\t", quote=FALSE, row.names=FALSE) You should have the txt file in your home directory after that. HTH, -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology ?| Memorial Sloan-Kettering Cancer Center ?| Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact
ADD COMMENT

Login before adding your answer.

Traffic: 505 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6