From 7654051aee0e8aa70f3b0253d3697b33b381bf94 Mon Sep 17 00:00:00 2001 From: chartl Date: Fri, 30 Oct 2009 16:59:17 +0000 Subject: [PATCH] Faster grepping git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1948 348d0f76-0448-11de-a6fe-93d51630548a --- python/expandedSummaryToGeli.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/expandedSummaryToGeli.py b/python/expandedSummaryToGeli.py index caa2bced6..b92a74973 100755 --- a/python/expandedSummaryToGeli.py +++ b/python/expandedSummaryToGeli.py @@ -13,7 +13,8 @@ def grep(string, list): return [elem for elem in list if expr.match(elem)] callFile = open(sys.argv[1]) -pileupFileName = sys.argv[2] +pileupFileLines = open(sys.argv[2]) +pileupFileLines = pileupFileLines.readlines() for line in callFile: # note: file is a .csv; so comma delimited with headers @@ -43,7 +44,7 @@ for line in callFile: g = chrompos.split(":"); chrompos = g.pop(0)+" "+g.pop(0) #print(chrompos) - pileupLine = grepFile(chrompos,open(pileupFileName)) + pileupLine = grep(chrompos,pileupFileLines) #print(pileupLine) # line is # chr pos ref num_A num_C num_G num_T