Biostar Beta. Not for public use.
Extract a chromosome from a WIG file
0
Entering edit mode
2.3 years ago
Grinch • 60
@Grinch19016

I have a large WIG files which are difficult to run in IGV, due to the size. I am only interested in chromosome M so I would like to extract signal from that chromosome and thus have a smaller file size. I found one solution on Stackoverflow (https://stackoverflow.com/questions/17354962/pcregrep-a-wiggle-file-to-extract-chromosome-multiple-line-regex-search), but that doesn't work at all. Any other ideas? I check UCSC utils and extensively searched online. I am also open to suggestions on bedgraph or similar formats.

WIG • 514 views
0
Entering edit mode

but that doesn't work at all

The awksolution on stackoverflow looks fine to me.

fin swimmer

0
Entering edit mode

It produces an empty file. I checked with grep and the chromosome exists in the original file.

2
Entering edit mode
2.4 years ago
@Pierre Lindenbaum30

use one of the tools provided by the UCSC to extract a region of the chromosome : http://hgdownload.soe.ucsc.edu/admin/exe/linux.x86_64/

for example bigWigToWig :

   -chrom=chr1 - if set restrict output to given chromosome
-start=N - if set, restrict output to only that over start
-end=N - if set, restict output to only that under end
-udcDir=/dir/to/cache - place to put cache for remote bigBed/bigWigs


and then convert back to bigwig with wigToBigWig

0
Entering edit mode

Thank you. I knew there had to be a simple solution like this available.

0
Entering edit mode
2.3 years ago
EagleEye 6.4k
@EagleEye12958

Try IGV 'toTDF' to convert your 'WIG' files into binary tiled data (TDF). This loads into IGV lot faster than 'WIG' files.