# commands[:body_start_1] + # shift(commands[body_start_1:], int(self.x*40),int(self.y*40)) # ) start = body_start + int(self.percent/100.0*(body_end-body_start)) while True: if start == body_start: break if commands[start].startswith('Z'): pos = map(int,item[1:].split(',')) if pos[2] >= 2420: break start -= 1 print 'commands ', len(commands) print 'body_start', body_start print 'start ', start print 'body_end ', body_end execute(commands[:body_start], self.port) execute(shift(commands[body_start:],int(self.x*40),int(self.y*40)), self.port, start-body_start) if __name__ == '__main__': nesoni.run_tool(Send)
# whistle_jaw_space = self.working.bore.copy() # # whistle_jaw.rotate(1,0,0, 90) # whistle_jaw_space.rotate(1,0,0, 90) # # offset = -whistle_jaw.extent().zmin # whistle_jaw.move(0,0,offset) # whistle_jaw_space.move(0,0,offset) # # self.save(whistle_jaw, 'jaw') # jaw_packable = [ pack.Packable([ whistle_jaw, whistle_jaw_space ], 90, self.mill_diameter) ] # # self.working.bore.add(whistle_jaw_clipper) # self.working.outside.remove(whistle_jaw_clipper) # # pack.cut_and_pack( # self.working.outside, self.working.bore, # upper_segments, lower_segments, # xsize=self.mill_length, # ysize=self.mill_width, # zsize=self.mill_thickness, # bit_diameter=self.mill_diameter, # save=self.save, # # extra_packables=[ jaw_packable ], # ) if __name__ == '__main__': nesoni.run_tool(Make_whistle)
# see also max_hole_spacing # balance # Very simple fingering system initial_length = demakein.design.wavelength('D4') * 0.4 fingerings = [ ('D4', [1, 1, 1, 1, 1, 1]), ('E4', [0, 1, 1, 1, 1, 1]), ('F#4', [0, 0, 1, 1, 1, 1]), ('G4', [0, 0, 0, 1, 1, 1]), ('A4', [0, 0, 0, 0, 1, 1]), ('B4', [0, 0, 0, 0, 0, 1]), ('C#5', [0, 0, 0, 0, 0, 0]), ('D5', [1, 1, 1, 1, 1, 1]), ('E5', [0, 1, 1, 1, 1, 1]), ('F#5', [0, 0, 1, 1, 1, 1]), ('G5', [0, 0, 0, 1, 1, 1]), ('A5', [0, 0, 0, 0, 1, 1]), ('B5', [0, 0, 0, 0, 0, 1]), ('C#6', [0, 0, 0, 0, 0, 0]), ] if __name__ == '__main__': nesoni.run_tool(Design_simple_shawm) # or #nesoni.run_toolbox([ # Design_simple_shawm, # #... # ])
import nesoni class Tentacle(make.Make): def run(self): path = geom.path( geom.XYZ(0.0, 0.0, 0.0), geom.XYZ(0.0, 1.0, 0.0), geom.XYZ(1.0, 0.0, 0.0), geom.XYZ(0.0, 0.0, 100.0), geom.XYZ(0.0, 0.0, 1.0), geom.XYZ(1.0, 0.0, 0.0), ) #geom.plot(path.position) print path.get_length() print path.find(90.0) print path.get_point(90.0) l = path.get_length() prof = profile.make_profile([(0.0, 20.0), (l, 0.0)]) tentacle = shape.path_extrusion(path, shape.circle, prof) self.save(tentacle, 'tentacle') if __name__ == '__main__': nesoni.run_tool(Tentacle)
#min_hole_spacing = [ 5,5,5,20,20 ] # see also max_hole_spacing # balance # Very simple fingering system initial_length = demakein.design.wavelength('D4') * 0.4 fingerings = [ ('D4', [1,1,1,1,1,1]), ('E4', [0,1,1,1,1,1]), ('F#4', [0,0,1,1,1,1]), ('G4', [0,0,0,1,1,1]), ('A4', [0,0,0,0,1,1]), ('B4', [0,0,0,0,0,1]), ('C#5', [0,0,0,0,0,0]), ('D5', [1,1,1,1,1,1]), ('E5', [0,1,1,1,1,1]), ('F#5', [0,0,1,1,1,1]), ('G5', [0,0,0,1,1,1]), ('A5', [0,0,0,0,1,1]), ('B5', [0,0,0,0,0,1]), ('C#6', [0,0,0,0,0,0]), ] if __name__ == '__main__': nesoni.run_tool(Design_simple_shawm) # or #nesoni.run_toolbox([ # Design_simple_shawm, # #... # ])
def _find_spans(self, depth): result = [ ] i = 0 while i < len(depth): j = i+1 while j < len(depth) and depth[j] == depth[i]: j += 1 lap = max(0,self.lap-(j-i)+1) lap_back = lap//2 lap_forward = lap-lap_back if depth[i] >= self.min_depth: for k in xrange(max(0,i-self.radius),min(len(depth),j+self.radius)): if depth[k] > depth[i] or (depth[k] == depth[i] and k < i): #Resolve ties arbitrarily break else: result.append((i-lap_back,j+lap_forward)) i = j return result if __name__ == '__main__': nesoni.run_tool(Peaks)
class Reedpipe(demakein.design.Instrument_designer): closed_top = True inner_diameters = [ 6.0, 6.0 ] outer_diameters = [ 10.0, 10.0 ] min_hole_diameters = [ 3.0 ]*7 max_hole_diameters = [ 5.0 ]*7 #min_hole_spacing = [ 15.0 ]*6 #and/or balance = [ 0.07 ]*5 initial_length = demakein.design.wavelength('C4') * 0.25 fingerings = [ ('C4', [1,1,1,1,1,1,1]), ('D4', [0,1,1,1,1,1,1]), ('E4', [0,0,1,1,1,1,1]), ('F4', [0,0,0,1,1,1,1]), ('G4', [0,0,0,0,1,1,1]), ('A4', [0,0,0,0,0,1,1]), ('B4', [0,0,0,0,0,0,1]), ('C5', [0,0,0,0,0,1,0]), ] if __name__ == '__main__': nesoni.run_tool(Reedpipe)
#commands = ( # commands[:body_start_1] + # shift(commands[body_start_1:], int(self.x*40),int(self.y*40)) # ) start = body_start + int(self.percent / 100.0 * (body_end - body_start)) while True: if start == body_start: break if commands[start].startswith('Z'): pos = map(int, commands[start][1:].split(',')) if pos[2] >= 2400: break start -= 1 print 'commands ', len(commands) print 'body_start', body_start print 'start ', start print 'body_end ', body_end execute(commands[:body_start], self.port) execute( shift(commands[body_start:], int(self.x * 40), int(self.y * 40), self.v), self.port, start - body_start) if __name__ == '__main__': nesoni.run_tool(Send)
min_hole_diameters = [ 3.0 ]*6 max_hole_diameters = [ 8.0 ]*6 #min_hole_spacing = [ 15.0 ]*5 #and/or balance = [ 0.05, None, None, 0.05 ] initial_length = demakein.design.wavelength('D5') * 0.5 fingerings = [ ('D5', [1,1,1,1,1,1]), ('E5', [0,1,1,1,1,1]), ('F#5', [0,0,1,1,1,1]), ('G5', [0,0,0,1,1,1]), ('A5', [0,0,0,0,1,1]), ('B5', [0,0,0,0,0,1]), ('C#6', [0,0,0,0,0,0]), ('D6', [1,1,1,1,1,1]), ('E6', [0,1,1,1,1,1]), ('F#6', [0,0,1,1,1,1]), ('G6', [0,0,0,1,1,1]), ('A6', [0,0,0,0,1,1]), ('B6', [0,0,0,0,0,1]), ('C#7', [0,0,0,0,0,0]), ('D8', [1,1,1,1,1,1]), ] if __name__ == '__main__': nesoni.run_tool(Flute)
peak = analysis.peaks_asis[candidates[0][1]].copy() peak.attr['Parent'] = utr.attr['Parent'] peak.attr['Name'] = utr.attr.get('Name','') peak.attr['Product'] = utr.attr.get('Product','') called_peaks.append(peak) called_utr = utr.five_prime().span_with(peak.three_prime()) called_utr.attr['Peak'] = peak.get_id() called_utrs.append(called_utr) called_gene = ref.genes[utr.attr['Parent']].five_prime().span_with(peak.three_prime()) called_gene.attr['Peak'] = peak.get_id() called_genes.append(called_gene) n_good += 1 print n_good, 'UTR called' print n_bad, 'no UTR called' annotation.write_gff3(self.prefix + '-peaks.gff', called_peaks) annotation.write_gff3(self.prefix + '-utrs.gff', called_utrs) annotation.write_gff3(self.prefix + '-genes.gff', called_genes) if __name__ == '__main__': nesoni.run_tool(Call_utrs)
for accession in self.accessions: Fetch_sra(work / 'sra', accession).process_make(stage) nesoni.Make_reference( output_dir=work / 'TW20', filenames=[ work / ('genbank', accession + '.gbk') for accession in self.genbanks ], genome=True, bowtie=True, ls=True, snpeff=True, ).make() analyser = nesoni.Analyse_samples analyser(work / 'analysis', work / 'TW20', samples=[ nesoni.Analyse_sample( accession, pairs=[[ work / ('sra', accession + '_1.fastq.bz2'), work / ('sra', accession + '_2.fastq.bz2') ]]) for accession in self.accessions ]).make() if __name__ == '__main__': nesoni.run_tool(Test_analyse_samples(output_dir='output'))
import nesoni from demakein import make from design_horn import Design_horn class Make_horn(make.Make_millable_instrument): def run(self): spec = self.working.spec self.make_instrument(inner_profile=spec.inner, outer_profile=spec.outer, hole_positions=[], hole_diameters=[], hole_vert_angles=[], hole_horiz_angles=[], xpad=[], ypad=[], with_fingerpad=[]) self.make_parts(up=True, flip_top=True) #l = spec.length #self.segment([l*0.333,l*0.666], spec.length, up=True) if __name__ == '__main__': nesoni.run_tool(Make_horn)
#!/usr/bin/env python import demakein, nesoni class Design_my_whistle(demakein.Design_folk_whistle): transpose = 12 # ... and any other things you want to change ... if __name__ == '__main__': nesoni.run_tool(Design_my_whistle)
for item in inner_diameters[1:-1] ] outer_diameters = [ 8.0, 8.0 ] outer_add = True initial_length = demakein.design.wavelength('C4') * 0.5 fingerings = [ ('C4', []), ('C4*2', []), ('C4*3', []), ('C4*4', []), ('C4*5', []), ('C4*6', []), ('C4*7', []), ('C4*8', []), ('C4*9', []), #('C4*10', []), #('C4*11', []), #('C4*12', []), ] divisions = [ #[(-1,0.333),(-1,0.6666)], #[(-1,0.25),(-1,0.5),(-1,0.75)], [(-1,i/8.0) for i in xrange(1,8) ], ] if __name__ == '__main__': nesoni.run_tool(Design_horn)
# whistle_jaw_space.rotate(1,0,0, 90) # # offset = -whistle_jaw.extent().zmin # whistle_jaw.move(0,0,offset) # whistle_jaw_space.move(0,0,offset) # # self.save(whistle_jaw, 'jaw') # jaw_packable = [ pack.Packable([ whistle_jaw, whistle_jaw_space ], 90, self.mill_diameter) ] # # self.working.bore.add(whistle_jaw_clipper) # self.working.outside.remove(whistle_jaw_clipper) # # pack.cut_and_pack( # self.working.outside, self.working.bore, # upper_segments, lower_segments, # xsize=self.mill_length, # ysize=self.mill_width, # zsize=self.mill_thickness, # bit_diameter=self.mill_diameter, # save=self.save, # # extra_packables=[ jaw_packable ], # ) if __name__ == '__main__': nesoni.run_tool(Make_whistle)
import nesoni from demakein import make from design_horn import Design_horn class Make_horn(make.Make_millable_instrument): def run(self): spec = self.working.spec self.make_instrument( inner_profile=spec.inner, outer_profile=spec.outer, hole_positions=[], hole_diameters=[], hole_vert_angles=[], hole_horiz_angles=[], xpad=[], ypad=[], with_fingerpad=[], ) self.make_parts(up=True, flip_top=True) # l = spec.length # self.segment([l*0.333,l*0.666], spec.length, up=True) if __name__ == "__main__": nesoni.run_tool(Make_horn)
for accession in self.accessions: Fetch_sra( work/'sra', accession ).process_make(stage) nesoni.Make_reference( output_dir=work/'TW20', filenames=[ work/('genbank',accession+'.gbk') for accession in self.genbanks ], genome=True, bowtie=True, ls=True, snpeff=True, ).make() analyser = nesoni.Analyse_samples analyser( work/'analysis', work/'TW20', samples=[ nesoni.Analyse_sample( accession, pairs=[[ work/('sra',accession+'_1.fastq.bz2'),work/('sra',accession+'_2.fastq.bz2') ]] ) for accession in self.accessions ] ).make() if __name__ == '__main__': nesoni.run_tool(Test_analyse_samples(output_dir='output'))
min_hole_diameters = [3.0] * 6 max_hole_diameters = [8.0] * 6 #min_hole_spacing = [ 15.0 ]*5 #and/or balance = [0.05, None, None, 0.05] initial_length = demakein.design.wavelength('D5') * 0.5 fingerings = [ ('D5', [1, 1, 1, 1, 1, 1]), ('E5', [0, 1, 1, 1, 1, 1]), ('F#5', [0, 0, 1, 1, 1, 1]), ('G5', [0, 0, 0, 1, 1, 1]), ('A5', [0, 0, 0, 0, 1, 1]), ('B5', [0, 0, 0, 0, 0, 1]), ('C#6', [0, 0, 0, 0, 0, 0]), ('D6', [1, 1, 1, 1, 1, 1]), ('E6', [0, 1, 1, 1, 1, 1]), ('F#6', [0, 0, 1, 1, 1, 1]), ('G6', [0, 0, 0, 1, 1, 1]), ('A6', [0, 0, 0, 0, 1, 1]), ('B6', [0, 0, 0, 0, 0, 1]), ('C#7', [0, 0, 0, 0, 0, 0]), ('D8', [1, 1, 1, 1, 1, 1]), ] if __name__ == '__main__': nesoni.run_tool(Flute)
from demakein import shape, geom, make, profile import nesoni class Tentacle(make.Make): def run(self): path = geom.path( geom.XYZ(0.0,0.0,0.0), geom.XYZ(0.0,1.0,0.0), geom.XYZ(1.0,0.0,0.0), geom.XYZ(0.0,0.0,100.0), geom.XYZ(0.0,0.0,1.0), geom.XYZ(1.0,0.0,0.0), ) #geom.plot(path.position) print path.get_length() print path.find(90.0) print path.get_point(90.0) l = path.get_length() prof = profile.make_profile([(0.0,20.0),(l,0.0)]) tentacle = shape.path_extrusion(path,shape.circle,prof) self.save(tentacle, 'tentacle') if __name__ == '__main__': nesoni.run_tool(Tentacle)