except:
print 'psyco not running'
-print 'version 3.6'
+print "altSpliceCounts: version 3.7"
-import sys, optparse
-from commoncode import readDataset
+import sys
+import optparse
+import ReadDataset
+from commoncode import getConfigParser, getConfigOption
def main(argv=None):
if not argv:
usage = "usage: python %s rdsfile outfilename [--cache pages]"
- parser = optparse.OptionParser(usage=usage)
- parser.add_option("--cache", type="int", dest="numCachePages",
- help="number of cache pages to use [default: 100000]")
- parser.set_defaults(numCachePages=None)
+ parser = makeParser(usage)
(options, args) = parser.parse_args(argv[1:])
if len(args) < 2:
altSpliceCounts(hitfile, outfilename, doCache, cachePages)
+def makeParser(usage=""):
+ parser = optparse.OptionParser(usage=usage)
+ parser.add_option("--cache", type="int", dest="numCachePages",
+ help="number of cache pages to use [default: 100000]")
+
+ configParser = getConfigParser()
+ section = "altSpliceCounts"
+ numCachePages = getConfigOption(configParser, section, "numCachePages", None)
+
+ parser.set_defaults(numCachePages=numCachePages)
+
+ return parser
+
+
def altSpliceCounts(hitfile, outfilename, doCache=False, cachePages=100000):
startDict = {}
stopDict = {}
resultDict = {}
- hitRDS = readDataset(hitfile, verbose = True, cache=doCache)
+ hitRDS = ReadDataset.ReadDataset(hitfile, verbose = True, cache=doCache)
if cachePages > hitRDS.getDefaultCacheSize():
hitRDS.setDBcache(cachePages)
index = 0
for chrom in hitDict:
- for (tagStart, lstop, rstart, tagStop) in hitDict[chrom]:
+ for read in hitDict[chrom]:
+ tagStart = read["startL"]
+ tagStop = read["stopR"]
index += 1
length = tagStop - tagStart
if length < readlen + 5: