I have a .wig file with three columns (Columns: Pos, Positive Strand, Negative Strand). I am trying to use import.wig into R, however I get the error "data length [1545] is not a sub-multiple or multiple of the number of rows [2]". When opening the wig in R, the columns are shifted and incorrectly filled. How can I import this strand information and maintain the integrity of the columns?
1 answer
Perhaps you could convert with BEDOPS wig2bed and import the resulting BED file into R via usual means:
$ wig2bed < in.wig > out.bed
If it is a correctly-formatted Wiggle file, then it should convert correctly. If it is not a correctly-formatted Wiggle file, then some awk swiss-knifing may be needed, as well as a bug report to IGV.
Log in to answer this question.
How was the wig file generated?
The .wig file was generated using igvtools, exporting "counts" coverage information from a BAM file into the three columns.