Question: Help needed with topGene function of RankProd package
0
gravatar for Gaurav Kumar
7.7 years ago by
Gaurav Kumar30
Gaurav Kumar30 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 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 • 625 views
ADD COMMENTlink modified 7.7 years ago by Steve Lianoglou12k • written 7.7 years ago by Gaurav Kumar30
Answer: Help needed with topGene function of RankProd package
0
gravatar for Steve Lianoglou
7.7 years ago by
Denali
Steve Lianoglou12k wrote:
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 COMMENTlink written 7.7 years ago by Steve Lianoglou12k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 140 users visited in the last hour