From fc39377e6cc56d9d17478bd9bee8bbf330a2cd0a Mon Sep 17 00:00:00 2001 From: depristo Date: Thu, 4 Nov 2010 20:34:43 +0000 Subject: [PATCH] Simple pre-processing script for soapsnp files git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4627 348d0f76-0448-11de-a6fe-93d51630548a --- python/fixSoapSnp.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 python/fixSoapSnp.py diff --git a/python/fixSoapSnp.py b/python/fixSoapSnp.py new file mode 100644 index 000000000..dbd0b545c --- /dev/null +++ b/python/fixSoapSnp.py @@ -0,0 +1,23 @@ +import os.path +import sys +from optparse import OptionParser + + +def main(): + global OPTIONS + usage = "usage: %prog [options] cmap input.soapsnp" + parser = OptionParser(usage=usage) + + (OPTIONS, args) = parser.parse_args() + if len(args) != 2: + parser.error("Requires exactly 2 arguments") + + cmap = dict([reversed(line.split()) for line in open(args[0])]) + #print cmap + for line in open(args[1]): + parts = line.split() + mapped = cmap[parts[0]] + print "\t".join([mapped] + parts[1:]) + +if __name__ == "__main__": + main() \ No newline at end of file