def main(): usage = "usage: %prog profile_fn [options]" parser = OptionParser(usage=usage, description="Make secondary structure prediction from a PSI-BLAST profile") parser.add_option("-o", "--outfile",action = "store", dest="outfile", type="string", help="outputfile, if not specfied output is stdout") parser.add_option("-v", "--verbose", action="store_true", dest="verbose") (options, args) = parser.parse_args() if len(args) != 1: parser.error("incorrect number of arguments, expected 1") profile_fn = args[0] if options.outfile: outfile = options.outfile voutfn = options.outfile else: outfile = None voutfn = 'stdout' if options.verbose: print "outfile: %s"%(str(voutfn)) assignment.assign(profile_fn, outfile)
def main(): usage = "usage: %prog profile_fn [options]" parser = OptionParser( usage=usage, description= "Make secondary structure prediction from a PSI-BLAST profile") parser.add_option("-o", "--outfile", action="store", dest="outfile", type="string", help="outputfile, if not specfied output is stdout") parser.add_option("-v", "--verbose", action="store_true", dest="verbose") (options, args) = parser.parse_args() if len(args) != 1: parser.error("incorrect number of arguments, expected 1") profile_fn = args[0] if options.outfile: outfile = options.outfile voutfn = options.outfile else: outfile = None voutfn = 'stdout' if options.verbose: print "outfile: %s" % (str(voutfn)) assignment.assign(profile_fn, outfile)
def test_assign(self): eligible_nurses = make_and_execute_sql_query(4, 0, 0, self.cursor) eligible_nurse_objects, assignments = to_object( eligible_nurses, self.assignments) sorted_eligible_nurses = sort_eligible_nurse_objects_acuity( eligible_nurse_objects) eligible_max_nurses = calculate_weights(eligible_nurse_objects, 'F', 0, self.patient_2, assignments, self.cursor) assignments = {1: {"num_patients": 2, "patients": []}} output = assign(sorted_eligible_nurses, eligible_max_nurses, assignments, 0, self.patient_1, 0, self.twins) self.assertEqual(output, {1: {'num_patients': 3, 'patients': [1]}})
from matplotlib.ticker import AutoMinorLocator import numpy as np import assignment as asm __author__ = 'Gerrit' colors = ["#1f77b4", "#d62728", "#2ca02c", "#414451"] plt.style.use("C:/Users/Gerrit/PycharmProjects/dis_style.mplstyle") #ind = np.arange(len(total_data["total"]))+0.5 fig, ax = plt.subplots(nrows=1, ncols=1, sharex=True) fig.set_figheight(12) fig.set_figwidth(14) profile_fn = "C:\Users\Gerrit\PycharmProjects\sparrow_res\example\T0515-D1.out" ret = asm.assign(profile_fn) x = range(1, 101, 1) len(x) len(ret.probability[0:100, 0]) #acc = plt.plot(x, ret.accuracy) #print ret.probability[:,0] he = ax.plot(x, ret.probability[0:100, 0], color=colors[0], linewidth=2, label="Helix") st = ax.plot(x, ret.probability[0:100, 1], color=colors[1], linewidth=2, label="Strand") co = ax.plot(x, ret.probability[0:100, 2], color=colors[2], linewidth=2, label="Coil") handles, labels = ax.get_legend_handles_labels() ax.legend(handles, labels, loc="lower right", numpoints=1) #ax[0].set_xlim(0, ind[-1]+.5) ax.set_xlim(1, x[-1]) start, end = ax.get_xlim()
def main(): spreadsheet_id = '1WydOez3OoBKLvxsdUaZQ8s9d5xBK7BY9dzBIyxJXzgk' sheet_range = 'A1:H10' table = sheets.get_data_for_range(spreadsheet_id, sheet_range) assignment.assign(table)
def decompose( inXd, inYd, inZd, xmind, xmaxd, ymind, ymaxd, zmind, zmaxd ): # inXd: list of x-coordinates \ inYd: list of y-coordinates \ inZd: list of z-coordinates # xmind: subdomain lower x boundary \ xmaxd: subdomain upper x boundary \ ymind: subdomain lower x boundary # ymaxd: subdomain upper y boundary \ zmind: subdomain lower x boundary \ zmaxd: subdomain upper z boundary # xybufd: spatial buffer \ zbufd: temporal buffer sett.sdNum += 1 xminDiff = xmind % sett.p3 xmaxDiff = xmaxd % sett.p3 yminDiff = ymind % sett.p3 ymaxDiff = ymaxd % sett.p3 zminDiff = zmind % sett.p4 zmaxDiff = zmaxd % sett.p4 xminP = xmind - xminDiff + sett.p3 xmaxP = xmaxd - xmaxDiff + sett.p3 yminP = ymind - yminDiff + sett.p3 ymaxP = ymaxd - ymaxDiff + sett.p3 zminP = zmind - zminDiff + sett.p4 zmaxP = zmaxd - zmaxDiff + sett.p4 xC, yC, zC = 0, 0, 0 xIter = xminP while xIter < xmaxP: xC += 1 xIter += sett.p3 yIter = yminP while yIter < ymaxP: yC += 1 yIter += sett.p3 zIter = zminP while zIter < zmaxP: zC += 1 zIter += sett.p4 xDim = xmaxd - xmind yDim = ymaxd - ymind zDim = zmaxd - zmind sdVolume = xDim * yDim * zDim bufVolume = (xDim + 2 * sett.p1) * (yDim + 2 * sett.p1) * (zDim + 2 * sett.p2) bufRatio = sdVolume / bufVolume if len( inXd ) is 0: # if there are no data points or no regular grid points within subdomain, pass pass elif xC is 0: pass elif yC is 0: pass elif zC is 0: pass elif len(inXd) <= sett.p5 or bufRatio <= sett.p6: fn = sett.dir1 + os.sep + "pts_" + str(sett.sdNum) + ".txt" fn1 = open(fn, "w") fn1.write( str(xmind) + ", " + str(xmaxd) + ", " + str(ymind) + ", " + str(ymaxd) + ", " + str(zmind) + ", " + str(zmaxd) + "\n") for x, y, z in list(zip(inXd, inYd, inZd)): fn1.write(str(x) + ", " + str(y) + ", " + str(z) + "\n") fn1.close() else: # if number of points in subdomain is higher than threshold, keep decomposing. sdXYZ = ass.assign(inXd, inYd, inZd, xmaxd, xmind, ymaxd, ymind, zmaxd, zmind) decompose(sdXYZ[0], sdXYZ[1], sdXYZ[2], xmind, sdXYZ[-3], ymind, sdXYZ[-2], zmind, sdXYZ[-1]) # recursive function call 1 decompose(sdXYZ[3], sdXYZ[4], sdXYZ[5], sdXYZ[-3], xmaxd, ymind, sdXYZ[-2], zmind, sdXYZ[-1]) # recursive function call 2 decompose(sdXYZ[6], sdXYZ[7], sdXYZ[8], xmind, sdXYZ[-3], sdXYZ[-2], ymaxd, zmind, sdXYZ[-1]) # recursive function call 3 decompose(sdXYZ[9], sdXYZ[10], sdXYZ[11], sdXYZ[-3], xmaxd, sdXYZ[-2], ymaxd, zmind, sdXYZ[-1]) # recursive function call 4 decompose(sdXYZ[12], sdXYZ[13], sdXYZ[14], xmind, sdXYZ[-3], ymind, sdXYZ[-2], sdXYZ[-1], zmaxd) # recursive function call 5 decompose(sdXYZ[15], sdXYZ[16], sdXYZ[17], sdXYZ[-3], xmaxd, ymind, sdXYZ[-2], sdXYZ[-1], zmaxd) # recursive function call 6 decompose(sdXYZ[18], sdXYZ[19], sdXYZ[20], xmind, sdXYZ[-3], sdXYZ[-2], ymaxd, sdXYZ[-1], zmaxd) # recursive function call 7 decompose(sdXYZ[21], sdXYZ[22], sdXYZ[23], sdXYZ[-3], xmaxd, sdXYZ[-2], ymaxd, sdXYZ[-1], zmaxd) # recursive function call 8
from matplotlib.ticker import AutoMinorLocator import numpy as np import assignment as asm __author__ = 'Gerrit' colors = ["#1f77b4", "#d62728", "#2ca02c", "#414451"] plt.style.use("C:/Users/Gerrit/PycharmProjects/dis_style.mplstyle") #ind = np.arange(len(total_data["total"]))+0.5 fig, ax = plt.subplots(nrows=1, ncols=1, sharex=True) fig.set_figheight(12) fig.set_figwidth(14) profile_fn = "C:\Users\Gerrit\PycharmProjects\sparrow_res\example\T0515-D1.out" ret = asm.assign(profile_fn) x = range(1, 101, 1) len(x) len(ret.probability[0:100, 0]) #acc = plt.plot(x, ret.accuracy) #print ret.probability[:,0] he = ax.plot(x, ret.probability[0:100, 0], color=colors[0], linewidth=2, label="Helix") st = ax.plot(x, ret.probability[0:100, 1], color=colors[1], linewidth=2, label="Strand")