text
stringlengths 0
828
|
---|
INSERT OR IGNORE INTO {} |
(sample_id) VALUES (""{}"") |
'''.format(table, sampleid)) |
# Add the data to the table |
try: |
# Find the data for each table/column |
for item in sorted(sample[table].datastore.items()): |
# Clean the names |
cleanedcolumn = self.columnclean(str(item[0])) |
# Add the data to the column of the appropriate table, |
# where the sample_id matches the current strain |
cursor.execute(''' |
UPDATE {} |
SET {} = ? |
WHERE sample_id = {} |
'''.format(table, cleanedcolumn, sampleid), (str(item[1]), )) |
except KeyError: |
pass |
# Commit the changes to the database |
db.commit()" |
20,"def columnclean(column): |
"""""" |
Modifies column header format to be importable into a database |
:param column: raw column header |
:return: cleanedcolumn: reformatted column header |
"""""" |
cleanedcolumn = str(column) \ |
.replace('%', 'percent') \ |
.replace('(', '_') \ |
.replace(')', '') \ |
.replace('As', 'Adenosines') \ |
.replace('Cs', 'Cytosines') \ |
.replace('Gs', 'Guanines') \ |
.replace('Ts', 'Thymines') \ |
.replace('Ns', 'Unknowns') \ |
.replace('index', 'adapterIndex') |
return cleanedcolumn" |
21,"def getLabel(self, key): |
""""""Gets the label assigned to an axes |
:param key:??? |
:type key: str |
"""""" |
axisItem = self.getPlotItem().axes[key]['item'] |
return axisItem.label.toPlainText()" |
22,"def updateData(self, axeskey, x, y): |
""""""Replaces the currently displayed data |
:param axeskey: name of data plot to update. Valid options are 'stim' or 'response' |
:type axeskey: str |
:param x: index values associated with y to plot |
:type x: numpy.ndarray |
:param y: values to plot at x |
:type y: numpy.ndarray |
"""""" |
if axeskey == 'stim': |
self.stimPlot.setData(x,y) |
# call manually to ajust placement of signal |
ranges = self.viewRange() |
self.rangeChange(self, ranges) |
if axeskey == 'response': |
self.clearTraces() |
if self._traceUnit == 'A': |
y = y * self._ampScalar |
if self.zeroAction.isChecked(): |
start_avg = np.mean(y[5:25]) |
y = y - start_avg |
self.tracePlot.setData(x,y*self._polarity)" |
23,"def appendData(self, axeskey, bins, ypoints): |
""""""Appends data to existing plotted data |
:param axeskey: name of data plot to update. Valid options are 'stim' or 'response' |
:type axeskey: str |
:param bins: bins to plot a point for |
:type bin: numpy.ndarray |
:param ypoints: iteration number of raster, *should* match bins dimension, but really takes the first value in array for iteration number and plot row at proper place for included bins |
:type ypoints: numpy.ndarray |
"""""" |
if axeskey == 'raster' and len(bins) > 0: |
x, y = self.rasterPlot.getData() |
# don't plot overlapping points |
bins = np.unique(bins) |
# adjust repetition number to response scale |
ypoints = np.ones_like(bins)*self.rasterYslots[ypoints[0]] |
x = np.append(x, bins) |
y = np.append(y, ypoints) |
self.rasterPlot.setData(x, y)" |
24,"def setThreshold(self, threshold): |
""""""Sets the current threshold |
:param threshold: the y value to set the threshold line at |
:type threshold: float |
"""""" |
self.threshLine.setValue(threshold) |
self.threshold_field.setValue(threshold)" |
25,"def setRasterBounds(self, lims): |
""""""Sets the raster plot y-axis bounds, where in the plot the raster will appear between |
:param lims: the (min, max) y-values for the raster plot to be placed between |
:type lims: (float, float) |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.