This is a test version of Biostars. For the public version, visit https://www.biostars.org.
mutually add a tab in the beggining of the header to make it a valid RMA format

Hello friends, please help me

i entered these codes, but whenever i use the output as input to geworkbench, it says that" could not parse line #1, line should have 12 columns but has 13 columns, which need manually add a tab at the beggining of the header to make it a valid RMA format"

library(affy)

> data <- ReadAffy()
> exp <- rma(data)

Background correcting
Normalizing
Calculating Expression
> control <- grep("AFFX",rownames(exp))
> exp <- exp[-control,]
> e <- exprs(exp)
> e <- apply(e,1,function(x) x-median(x))
> e.scaled <- t(scale(t(e),center=FALSE))
> write.exprs(exp, file="output.txt", sep="\t")

where i did wrong please??

r software error

Hi Sarah, just a point: you've applied changes to exp and saved it to a new variable e.scaled, so write.exprs(exp, ... ) will not reflect either centreing on the median or the scaling you've done. For your output file to reflect these changes, you will need to do something to the effect of:

write.table(e.scaled,file="scaled.output.txt",sep="\t")

sorry Alexander I did so but the result was a messy output file in which nothing is arranged while I need a tab-delimited text file in which the first column is probsets, header are arrays name and in between there are measures but with

write.table(e.scaled,file="scaled.output.txt",sep="\t")

a format was produced that can't be used as text anymore..

anyway thank you

1 answer

Change:

write.exprs(exp, file="output.txt", sep="\t")

to:

write.exprs(exp, file="output.txt", sep="\t", row.names=FALSE)

sorry Sean, when I did so it said that:

> write.exprs(exp, file="damn.txt", sep="\t", row.names=FALSE)
Error in write.table(exprs(x), file = file, quote = quote, sep = sep,  :
  'col.names = NA' makes no sense when 'row.names = FALSE'
>

hey Sarah, you should type:

write.exprs(exp, file="output.txt", quote = FALSE, sep="\t", row.names=TRUE)

after that you should open output file and write a column name for column one for example write ID because the column 1 would not have any header that I don't know the reason yet!

Because the first column is considered the column for row names, R does not include a column name for it.

Log in to answer this question.