Created
February 15, 2012 15:26
-
-
Save brainstorm/1836676 to your computer and use it in GitHub Desktop.
Try to recover illumina dataset with missing .filter files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python | |
import os | |
import logging | |
import glob | |
import random | |
from collections import * | |
fters = defaultdict(set) | |
all = set(["%04d.filter" % x for x in range(1, 70)]) | |
for dotfilter in glob.glob("*.filter"): | |
(_, lane, tile) = dotfilter.split("_") | |
fters[lane].add(tile) | |
# symlink all missing filters to previous .filter files | |
for lane in fters: | |
miss_fters = all.difference(fters[lane]) | |
# take an existing .filter from the set... | |
src = random.sample(fters[lane],1) | |
for dst in miss_fters: | |
# ... and symlink the missing ones against it | |
print "creating symlink from %s to %s" % ("s_%s_%s" % (lane,src[0]), "s_%s_%s" % (lane,dst)) | |
os.symlink("s_%s_%s" % (lane,src[0]), "s_%s_%s" % (lane,dst)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment