def svilen(self, id=None, *args, **kwargs): from pyqlb.nstats.well import accepted_peaks from pyqlb.nstats.peaks import cluster_2d, peak_times, fam_widths from pyqlb.factory import QLNumpyObjectFactory from qtools.lib.mplot import svilen, cleanup, render as plt_render qlwell = self.__qlwell_from_threshold_form(id) self.__set_threshold_context(qlwell) well_path = self.__well_path() # oh shit factory = QLNumpyObjectFactory() raw_well = factory.parse_well(well_path) crap, crap, gold, crap = cluster_2d(accepted_peaks(qlwell), c.fam_threshold, c.vic_threshold) times = peak_times(gold) widths = fam_widths(gold) title = "VIC+/FAM- droplet traces (accepted events)" ranges = [(int(t-(w*2)), int(t+(w*2))) for t, w in zip(times, widths)] if c.fam_threshold == 0 or c.vic_threshold == 0: ranges = [] title = "%s (no events in quadrant)" % title elif len(ranges) > 100: ranges = ranges[:100] title = "%s (truncated at first 100)" % title fig = svilen(title, raw_well.samples, ranges, widths) response.content_type = 'image/png' imgdata = plt_render(fig, dpi=72) cleanup(fig) return imgdata
def stats_for_qlp_well_path(qlp_path, well_name, compute_clusters=False, override_thresholds=None): """ Return statistics about a well, given a path to a QLP file with the well metrics and the name of the well to look at in the plate. Structure is a bit legacy and can be massaged more. :param qlp_path: The path to the QLP file. :param well_name: The name of the :param compute_clusters: Whether to compute clusters in addition to basic statistics. :param override_thresholds: If not None, use the supplied thresholds to determine statistics, such as concentration, clusters, S-value, etc. :return: A 2-tuple (statistics, clusters). (TODO: document this more) """ from pyqlb.factory import QLNumpyObjectFactory factory = QLNumpyObjectFactory() plate = factory.parse_plate(qlp_path) well = plate.analyzed_wells.get(well_name.upper(), None) if not well: return None else: return stats_for_qlp_well(well, compute_clusters=compute_clusters, override_thresholds=override_thresholds)
import re import os import numpy from optparse import OptionParser from pyqlb.nstats.peaks import * def qlpdir(path): """ # Maybe this exists? # """ scQLPs = "c:/Users/rrymer/Documents/Data/" return "%s/%s" % (scQLPs, path) factory = QLNumpyObjectFactory() #plate = factory.parse_plate(qlpdir('EvaGreenPPEDNRwBGDNAAttempt3.qlp')) ##Lightweight plate class LWPlate(object): def add_well(self, well, fulldata): # Should throw an exception if wellname exists, but have not figure out perl exception handling yet if fulldata: self.well_list[well.name] = well else: self.well_list[well.name] = "" def wells(self): print self
import csv import argparse import matplotlib.pyplot as plt import matplotlib.mlab as mlab from scipy import optimize from pylab import * from pyqlb.nstats.peaks import * def qlpdir(path): """ # Maybe this exists? # """ scQLPs = "c:/Users/rrymer/Documents/Data/" return "%s/%s" % (scQLPs, path) factory = QLNumpyObjectFactory() #not sure what this does #Lightweight plate, collects all the wells to be analyzed by plate class LWPlate( object ): def add_well( self, well, fulldata ): # Should throw an exception if wellname exists, but have not figure out perl exception handling yet if fulldata: self.well_list[well.name] = well else: self.well_list[well.name] = "" def wells(self): print self return( self.well_list ) def __init__(self, filename, platename):
# -*- coding: utf-8 -*- """ Created on Wed Nov 20 13:44:44 2013 @author: rrymer """ from pyqlb.factory import QLNumpyObjectFactory from pyqlb.nstats.peaks import fam_amplitudes import numpy as np factory = QLNumpyObjectFactory() class LWPlate(object): def add_well(self, well, fulldata): # Should throw an exception if wellname exists, but have not figure out perl exception handling yet if fulldata: self.well_list[well.name] = well else: self.well_list[well.name] = "" def wells(self): print self return self.well_list def __init__(self, filename, platename): self.filename = filename self.platename = platename self.well_list = {}
def __init__(self, *args, **kwargs): super(TestColorCal, self).__init__(*args, **kwargs) factory = QLNumpyObjectFactory() self.vic = factory.parse_plate(local('colorcal_vic.qlp')) self.hex = factory.parse_plate(local('colorcal_hex.qlp'))
def setUp(self): factory = QLNumpyObjectFactory() self.plate = factory.parse_plate(local('colorcomp.qlp'))
# -*- coding: utf-8 -*- """ Created on Wed Nov 20 13:44:44 2013 @author: rrymer """ from pyqlb.factory import QLNumpyObjectFactory from pyqlb.nstats.peaks import fam_amplitudes import numpy as np factory = QLNumpyObjectFactory() class LWPlate(object): def add_well(self, well, fulldata): # Should throw an exception if wellname exists, but have not figure out perl exception handling yet if fulldata: self.well_list[well.name] = well else: self.well_list[well.name] = "" def wells(self): print self return (self.well_list) def __init__(self, filename, platename): self.filename = filename self.platename = platename self.well_list = {}