-def printStatusMessages(shiftValue, normalize, doRevBackground, ptype, doControl, withFlag, useMulti, rnaSettings, strandfilter):
- if shiftValue == "learn":
- print "Will try to learn shift"
-
- if normalize:
- print "Normalizing to RPM"
-
- if doRevBackground:
- print "Swapping IP and background to calculate FDR"
-
- if ptype != "":
- if ptype in ["NONE", "SELF"]:
- pass
- elif ptype == "BACK":
- if doControl and doRevBackground:
- pass
- else:
- print "must have a control dataset and -revbackground for pValue type 'back'"
- else:
- print "could not use pValue type : %s" % ptype
-
- if withFlag != "":
- print "restrict to flag = %s" % withFlag
-
- if not useMulti:
- print "using unique reads only"
-
- if rnaSettings:
- print "using settings appropriate for RNA: -nodirectionality -notrim -noshift"
-
- if strandfilter == "plus":
- print "only analyzing reads on the plus strand"
- elif strandfilter == "minus":
- print "only analyzing reads on the minus strand"
-
-
-def openRDSFile(filename, cachePages=None, doCache=False):
- rds = ReadDataset.ReadDataset(filename, verbose=True, cache=doCache)
- if cachePages > rds.getDefaultCacheSize():
- rds.setDBcache(cachePages)
-
- return rds
-
-
-def getHeader(normalize, doDirectionality, listPeak, reportshift, doPvalue):
- if normalize:
- countType = "RPM"
- else:
- countType = "COUNT"
-
- headerFields = ["#regionID\tchrom\tstart\tstop", countType, "fold\tmulti%"]
-
- if doDirectionality:
- headerFields.append("plus%\tleftPlus%")
-
- if listPeak:
- headerFields.append("peakPos\tpeakHeight")
-
- if reportshift:
- headerFields.append("readShift")
-
- if doPvalue:
- headerFields.append("pValue")
+def writeOutputFileHeader(regionFinder, outfile, hitfile, useMulti, pValueType):
+ print >> outfile, regionFinder.getAnalysisDescription(hitfile, useMulti, pValueType)
+ header = regionFinder.getHeader()
+ print >> outfile, header