def testZFlag(self): """This test looks at the l flag and determines if the dictionary reads the specified requested letter""" "" sys.argv = ['-z', 'text.txt'] print('testsys', sys.argv) result = count.main() print('testResult: ', result) check = { 'a': 2, 'b': 2, 'c': 2, 'd': 2, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0 } self.assertDictEqual(result, check)
def testCFlag(self): """This test looks at the l flag and determines if the dictionary reads the specified requested letter""" "" sys.argv = ['-c', 'text.txt'] print('testsys', sys.argv) result = count.main() print('testResult: ', result) check = {'A': 2, 'b': 2, 'C': 1, 'c': 1, 'D': 1, 'd': 1} self.assertDictEqual(result, check)
def main(): settings.init() flag = True count.main(0, 'detector') print("Starting Face Detection Technique") for i in trange(0, 10): time.sleep(0.01) print(" If Data Already Feeded.(Press Ctrl Z)") while (flag): count.main(1, 'face_dataset_creater') try: print( "Press Enter To Skip To Recognition Part or Any Key To Feed New Data :" ) flag = input() except: flag = False count.main(2, 'trainner') count.main(3, 'recogniser') count.main(4, 'detector') print("Completed") print(settings.myList)
def count_to_csv(): csvArgs = sys.argv csvFileArgs = [i for i in csvArgs if '.csv' in i] csvFileName = "" for i in csvFileArgs: csvFileName += i csvArgs.remove(csvFileName) ###Removes file name from args d={} d = count.main() a_file = open(csvFileName, "w") ###Writing the dictionary to CSV csvWriter = csv.writer(a_file) for key, value in d.items(): csvWriter.writerow([key,value]) a_file.close() print('Your file has been saved as a CSV: ', csvFileName)
async def end_election(ctx, seats): #print("Almost there") votelist = {} party = 1 party_list = list(find_parties(client).keys()) async for msg in ctx.channel.history(limit=100): message = await ctx.channel.fetch_message(msg.id) reaction = get(message.reactions, emoji='✅') if type(reaction) != type(None): votelist[party_list[len(party_list) - party]] = (reaction.count - 1) if len(party_list) - party == 0: break party += 1 print(votelist) seatlist = count.main(int(seats), votelist) await ctx.send(seatlist)
parser.add_argument('--coverage' , required=True,type=str, help="the tab file containing coverage tab files") parser.add_argument('--ploidy' , type=int,default = 2,help="the ploidy of the organism") parser.add_argument('--d' , type=float,default=0.1,help="minimum ratio deviation to call chromosomal abberation") parser.add_argument('--gc' , type=str,required= True, help="the tab file containing gc content") parser.add_argument('--c_cutoff' , type=int,default=200,help="bins having coverage higher than the cut off value are excluded from the ref calculations") parser.add_argument('--s_cutoff' , type=int,default=50,help="bins that have less than the s_cutoff value similar bins are discarded from copy nmber esitmation") parser.add_argument('--refQ' , type=int,default=30,help="Minimum average mapping quality of the bins used for constructing the reference = 30") parser.add_argument('--Q' , type=int,default=30,help="Minimum average mapping quality of the bins used for copy number estimation default = 30") args = parser.parse_args() Data = common.gc_tab(args.gc) #compute a gc content histogram Data=common.coverage_tab(args.coverage,Data) GC_hist=common.gc_hist(Data,args.c_cutoff,args.s_cutoff,args.refQ) count.main(Data,GC_hist,args) elif args.filt: parser = argparse.ArgumentParser("""AMYCNE-filter: filter the coverage tab file, prints it to stdout for later use""") parser.add_argument('--gc' , type=str,required= True, help="the tab file containing gc content") parser.add_argument('--coverage' , type=str,required= True,default=None, help="the tab file containing coverage") parser.add_argument('--c_cutoff' , type=int,default=100,help="bins having coverage higher than the cut off value are excluded from the ref calculations") parser.add_argument('--s_cutoff' , type=int,default=50,help="bins that have less than the s_cutoff value similar bins are discarded from copy nmber esitmation") parser.add_argument('--filter' , type=int,default=2000,help="size of the filters, default = 2000") parser.add_argument('--refQ' , type=int,default=30,help="Minimum average mapping quality of the bins used for constructing the reference = 30") parser.add_argument('--Q' , type=int,default=10,help="Minimum average mapping quality of the bins used for copy number estimation default = 10") parser.add_argument('--filt' , action="store_true" ,help="perform CNV calling") args = parser.parse_args() Data = common.gc_tab(args.gc)
def test_clz(self): #-c, -l, and -z flags sys.argv = ['count.py', '-c', '-l', 'Aabcz', '-z', path] self.assertEqual(c.main(), self.dclz)
def test_cz(self): #-c and -z flags sys.argv = ['count.py', '-c', '-z', path] self.assertEqual(c.main(), self.dcz)
def test_cl(self): #-c and -l flags sys.argv = ['count.py', '-c', '-l', 'Aabc', path] self.assertEqual(c.main(), self.dcl)
def test_z(self): #-z flag only sys.argv = ['count.py', '-z', path] self.assertEqual(c.main(), self.dz)
def test_l(self): #-l flag only sys.argv = ['count.py', '-l', 'Aabc', path] self.assertEqual(c.main(), self.dl)
def test_c(self): #-c flag only sys.argv = ['count.py', '-c', path] self.assertEqual(c.main(), self.dc)
def test_null(self): #no flags sys.argv = ['count.py', path] self.assertEqual(c.main(), self.d)
#!/usr/bin/env python3 ## Krista Miller ## Data Science 2, Project 02, Counting Characters -- Reference Implementation import count as c import sys import csv d = c.main() args = sys.argv CSV_name = None for a in args: if a.endswith(".csv"): CSV_name = a l=list(d.items()) with open(CSV_name, "w", encoding='utf8', newline="") as csvfile: writer = csv.writer(csvfile) writer.writerows(l)
def main2(): return count.main()