def build_tracks( param, conf, data_label, fit_label, pred_label, strand, show=False ): """ Builds tracks """ # gets all the labels for a fast lookup label_cache = atlas_label_cache( conf ) # get database handles for hdf and sql db, session = open_databases( conf ) # fetching x and y coordinates for bar and fit (line) for # each strand plus (p), minus (m), all (a) bix, bpy, bmy, bay = hdf_query( db=db, name=data_label, param=param ) fix, fpy, fmy, fay = hdf_query( db=db, name=fit_label, param=param ) # close the hdf database db.close() # get all features within the range all = feature_query( session=session, param=param ) # draws the barchart and the nucleosome chart below it if strand == 'composite': bar = prefab.composite_bartrack( fix=fix, fay=fay, bix=bix, bay=bay, param=param) else: bar = prefab.twostrand_bartrack( fix=fix, fmy=fmy, fpy=fpy, bix=bix, bmy=bmy, bpy=bpy, param=param) charts = list() charts.append( bar ) return charts
def feature_chart(param=None, session=None, label=None, label_dict={}, color=cycle( [LIGHT, WHITE] ) ): all = feature_filter(feature_query(session=session, param=param), name=label, kdict=label_dict) flipped = [] for feature in all: if feature.strand == "-": feature.start, feature.end = feature.end, feature.start flipped.append(feature) opts = track_options( xscale=param.xscale, w=param.width, fgColor=PURPLE, show_labels=param.show_labels, ylabel=str(label), bgColor=color.next() ) return [ tracks.split_tracks(features=flipped, options=opts, split=param.show_labels, track_type='vector') ]