def main(): usage = ( 'usage: %prog [options] file1.xml file2.xml\n\n' '%prog takes in contiguous path statistics file(s)\n' 'and creates an image file.' ) data = Data() parser = OptionParser( usage=usage ) initOptions( parser ) las.initOptions( parser ) lpt.initOptions( parser ) options, args = parser.parse_args() checkOptions( args, options, parser ) las.checkOptions( options, parser ) lpt.checkOptions( options, parser ) if not options.outputRanks: fig, pdf = lpt.initImage( 11., 8.0, options, data ) # 8 axDict = establishAxes( fig, options, data ) data.statsList, data.xData = readFiles( options ) for i in xrange( 0, len( data.statsList )): # ensure that the buckets are all in order by their midpoint. data.statsList[i] = sorted( data.statsList[i], key=lambda x: x.mid, reverse=False ) if options.outputRanks: ranks = rankFiles( options, data ) printRanks( ranks, options, data ) sys.exit(0) drawData( axDict['main'], data.xData, data.statsList, options, data ) drawLegend( options, data ) drawAxisLabels( fig, options, data ) setAxisLimits( axDict['main'], data.xData, options, data ) establishTicks( axDict['main'], data.xData, options, data ) lpt.writeImage( fig, pdf, options )
def main(): usage = ( 'usage: %prog --maf=file.maf --referenceGenome=A --comparisonGenome=B --chrNames=c0,c1,... --chrLengths=N1,N2,... --outDir=path/to/dir/\n\n' '%prog takes in a maf filename ( --maf ), a reference genome name as\n' 'it appears in the maf ( --referenceGenome ), a genome name to compare against\n' '( --comparisonGenome ), a paired list of chromosome names ( --chrNames comma\n' 'separated ) and chromosome lengths ( --chrLengths comma separated ) and a path\n' 'to a directory where the maf pickles will be written ( --outDir ), one pickle\n' 'per chromosome.') data = Data() parser = OptionParser(usage=usage) initOptions(parser) options, args = parser.parse_args() checkOptions(options, parser, data) readMaf(options, data) switchToPositiveStrandCoordinates(options, data) for c in data.chroms: data.mafBlocksByChrom[c].sort(key=lambda x: x.refStart, reverse=False) trimDups(options, data) if options.verify: verifyDistinct(options, data) convertDataToWiggle(options, data) recordCoverage(options, data) if options.verify: verifyStacks(options, data) verifyElements(options, data) verifyLengths(options, data) packData(data.mafWigDict, options.filename, options)
def main(): usage = ( 'usage: %prog [options]\n\n' '%prog takes in a reference genome name ( --referenceGenome ),\n' 'optionally a directory where annotation wig pickles are stored ( --annotPickleDir [optional] ),\n' 'a directory where maf wig pickles are stored ( --mafPickleDir ), a paired set of chromosome names\n' '( --chrNames comma separated ) and chromosome lengths ( --chrLengths comma separated ) and \n' 'then various other options specifed below to draw a figure.') data = Data() parser = OptionParser( usage=usage ) initOptions( parser ) las.initOptions( parser ) lpt.initOptions( parser ) options, args = parser.parse_args() checkOptions( options, parser, data ) las.checkOptions( options, parser ) lpt.checkOptions( options, parser ) loadAnnots( options, data ) loadMafs( options, data ) normalizeData( options, data ) transformData( options, data ) figHeight = ( data.numberOfMafs + len( data.annotationOrder ) + 0.5 ) / 4.0 fig, pdf = lpt.initImage( 8.0, figHeight, options, data ) axDict = establishAxes( fig, options, data ) labelAxes( fig, axDict, options, data ) drawAnnotations( axDict, options, data ) drawMafs( axDict, options, data ) drawLegend( options, data ) setAxisLimits( axDict, options, data ) lpt.writeImage( fig, pdf, options )
def main(): usage = ('usage: %prog [options] --dir=path/to/dir/\n\n' '%prog takes in a copy statistics file\n' 'and creates an image file.') data = Data() parser = OptionParser(usage=usage) initOptions(parser) las.initOptions(parser) lpt.initOptions(parser) options, args = parser.parse_args() checkOptions(args, options, parser) las.checkOptions(options, parser) lpt.checkOptions(options, parser) if not options.outputRanks: fig, pdf = lpt.initImage(8.0, 10.0, options, data) stats = readFiles(options) sortedOrder = sorted(stats.values(), key=lambda x: x.sumLower, reverse=False) if options.outputRanks: rankings(sortedOrder, options, data) return axDict = establishAxes(fig, options, data) drawData(axDict, sortedOrder, options, data) drawLegend(options, data) drawAxisLabels(axDict, stats, options, data) setAxisLimits(axDict, options, data) lpt.writeImage(fig, pdf, options)
def main(): usage = ( 'usage: %prog --key=KEY file1.maf.pickle file2.maf.pickle ...\n\n' '%prog takes a valid key ( --key ) and one or more maf wiggle pickle(s)\n' 'and then pulls out all the counts stored in the numpy array for the key.' ) data = Data() parser = OptionParser(usage=usage) initOptions(parser) options, args = parser.parse_args() checkOptions(args, options, parser, data) loadPickles(args, options, data)
def main(): usage = ( '%prog --file=file.txt --mode=[scaffPaths|contigs|contigPaths|blocks|contamination] [options]\n\n' '%prog takes an aggregate text file ( --file ) and a mode \n' '( --mode ) and then produces a pretty picture.' ) data = Data() parser = OptionParser( usage=usage ) initOptions( parser ) lpt.initOptions( parser ) options, args = parser.parse_args() checkOptions( options, parser ) lpt.checkOptions( options, parser ) fig, pdf = lpt.initImage( 8.0, 10.0, options, data ) axDict = establishAxes( fig, options, data ) data.valuesDict = readFile( options.file, options ) data.xData = data.valuesDict['columnLength'] if options.mode != 'contamination': data.valuesDict = normalizeDataNormalMode( data.valuesDict, options, data ) else: normalizeDataContaminationMode( options, data ) setAxisLimits( axDict['main'], axDict['crazy'], axDict['blowUp'], data.xData, options, data ) drawData( axDict['main'], axDict['crazy'], axDict['blowUp'], data.xData, data.valuesDict, options, data ) drawLegend( options, data ) drawAxisLabels( fig, options, data ) setAxisLimits( axDict['main'], axDict['crazy'], axDict['blowUp'], data.xData, options, data ) establishTicks( axDict['main'], axDict['crazy'], axDict['blowUp'], options, data ) lpt.writeImage( fig, pdf, options )
def main(): usage = ( '%prog --file=file.txt --mode=[scaffPaths|contigs|contigPaths|blocks|contamination] [options]\n\n' '%prog takes an aggregate text file ( --file ) and a mode \n' '( --mode ) and then produces a pretty picture.') data = Data() parser = OptionParser(usage=usage) initOptions(parser) lpt.initOptions(parser) options, args = parser.parse_args() checkOptions(options, parser) lpt.checkOptions(options, parser) fig, pdf = lpt.initImage(8.0, 10.0, options, data) axDict = establishAxes(fig, options, data) data.valuesDict = readFile(options.file, options) data.xData = data.valuesDict['columnLength'] if options.mode != 'contamination': data.valuesDict = normalizeDataNormalMode(data.valuesDict, options, data) else: normalizeDataContaminationMode(options, data) setAxisLimits(axDict['main'], axDict['crazy'], axDict['blowUp'], data.xData, options, data) drawData(axDict['main'], axDict['crazy'], axDict['blowUp'], data.xData, data.valuesDict, options, data) drawLegend(options, data) drawAxisLabels(fig, options, data) setAxisLimits(axDict['main'], axDict['crazy'], axDict['blowUp'], data.xData, options, data) establishTicks(axDict['main'], axDict['crazy'], axDict['blowUp'], options, data) lpt.writeImage(fig, pdf, options)
def main(): usage = ( 'usage: %prog --gff=file.gff --outDir=path/to/dir/ --chrLengths=N1,N2,... --chrNames=A,B,...\n\n' '%prog takes in a gff file ( --gff ), an output directory ( --outDir ), and\n' 'pairs of chromosome names ( --chrNames comma separated ) and chromosome \n' 'lengths ( --chrLengths comma separated ) and returns one annotation wig\n' 'pickle per chromosome in the output directory.') data = Data() parser = OptionParser(usage=usage) initOptions(parser) options, args = parser.parse_args() checkOptions(options, parser, data) readGff(options, data) for c in data.chrNames: data.gffRecordsByChrom[c].sort(key=lambda x: x.start, reverse=False) convertDataToWiggle(options, data) packData(data.annotWigDict, options.filename, options)
def main(): usage = ( '%prog --dir=path/to/dir --mode=[scaffPaths|contigs|contigPaths|blocks|contamination] [options]\n\n' '%prog takes an aggregate directory ( --dir ) and a mode \n' '( --mode ) and then produces a pretty picture.') data = Data() parser = OptionParser(usage=usage) initOptions(parser) lpt.initOptions(parser) options, args = parser.parse_args() checkOptions(options, parser) lpt.checkOptions(options, parser) readFiles(options, data) lpt.initImage(7.0, 8.0, options, data) establishAxis(options, data) drawPlots(options, data) lpt.writeImage(options, data)
def main(): usage = ('usage: %prog [options] file1.xml\n\n' '%prog takes in a copy number statistics file\n' 'and creates an image file.') data = Data() parser = OptionParser(usage=usage) initOptions(parser) lpt.initOptions(parser) options, args = parser.parse_args() checkOptions(args, options, parser) lpt.checkOptions(options, parser) fig, pdf = lpt.initImage(11.0, 3.25, options, data) storedCategories = readFiles(options) establishGlobalMinMax(storedCategories, options, data) axDict = establishAxes(fig, storedCategories, options, data) drawData(axDict, storedCategories, options, data) drawLegend(options, data) drawAxisLabels(axDict, storedCategories, options, data) setAxisLimits(axDict, options, data) lpt.writeImage(fig, pdf, options)