<s> import multiprocessing <EOL> from matplotlib import pyplot as plt <EOL> import matplotlib <EOL> import numpy as np <EOL> import metaseq <EOL> import pybedtools <EOL> gs = metaseq . genomic_signal ( metaseq . example_filename ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> features = pybedtools . BedTool ( ) . window_maker ( <EOL> b = pybedtools . BedTool ( '<STR_LIT>' , <EOL> from_string = True ) . fn , <EOL> w = <NUM_LIT:1000> ) . shuffle ( seed = <NUM_LIT:1> , genome = { '<STR_LIT>' : ( <NUM_LIT:0> , <NUM_LIT> ) } ) <EOL> genes = [ ] <EOL> for i , f in enumerate ( features ) : <EOL> genes . append ( '<STR_LIT>' % i ) <EOL> genes = np . array ( genes ) <EOL> arr = gs . array ( features , processes = multiprocessing . cpu_count ( ) , bins = <NUM_LIT:100> ) <EOL> ind , breaks = metaseq . plotutils . clustered_sortind ( arr , k = <NUM_LIT:5> ) <EOL> cluster_1_inds = ind [ <NUM_LIT:0> : breaks [ <NUM_LIT:0> ] ] <EOL> cluster_1_genes = genes [ cluster_1_inds ] <EOL> gene_clusters = [ ] <EOL> start = <NUM_LIT:0> <EOL> for b in breaks : <EOL> gene_clusters . append ( genes [ ind [ start : b ] ] ) <EOL> start = b <EOL> fig = plt . figure ( ) <EOL> ax1 = fig . add_subplot ( <NUM_LIT> ) <EOL> ax1 . matshow ( arr , cmap = matplotlib . cm . hot ) <EOL> ax1 . set_title ( '<STR_LIT>' ) <EOL> ax1 . axis ( '<STR_LIT>' ) <EOL> ax2 = fig . add_subplot ( <NUM_LIT> ) <EOL> ax2 . matshow ( arr [ ind ] , cmap = matplotlib . cm . hot ) <EOL> ax2 . set_title ( '<STR_LIT>' ) <EOL> for b in breaks : <EOL> ax2 . axhline ( b , color = '<STR_LIT:b>' ) <EOL> ax2 . axis ( '<STR_LIT>' ) <EOL> plt . show ( ) </s>
