This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to convert the data from .wig file to .table or .csv?

Hi, all I read a data from wig file with import.wig function of rtracklayer package. The class() of this data showed :"UCSCdata". I am failed to write the data to other format with "write.table/csv(XXX,file="XX",sep=" ")". Could you tell me which funtion/methods can convert the data to other format(.txt, .csv or excel)?

r next-gen chip-seq

3 answers

Use export.wig from rtracklayer with dataFormat to BED. BED format is text based.

Does this bed format contain the signal intensity column?

This question is not directly related to parent thread. You should have asked it in a new thread.
As indicated in this link BED format is plain text and only requires three columns by default (chromosome, chromStart, chromEnd). You could include signal intensity as an optional additional column.

You can convert to BED with wig2bed. BED is a tab-delimited text file:

$ wig2bed < in.wig > out.bed

From there, you can bring it into Excel and re-save as CSV, if you need a different delimiter.

Add the --keep-header option if you want that metadata in the output.

Log in to answer this question.