Best Python code snippet using lisa_python
3-Count.py
Source:3-Count.py
...128 combineList = []129 for rna_type in rna_type_list:130 combineList.append( statis[rna_type] )131 return combineList132def get_statistics(sample_name):133 smallBam = count_smallRNA_Bam(ROOT_1+sample_name+"/Aligned.out.bam")134 smallSTAR = read_STAR_Logfinalout(ROOT_1+sample_name)135 GenomeBam = count_Genome_bam(ROOT_2+sample_name+"/Aligned.out.bam", GAPer)136 GenomeSTAR = read_STAR_Logfinalout(ROOT_2+sample_name)137 statis = calculate_reads_distribution(smallSTAR, GenomeSTAR, smallBam, GenomeBam)138 combList = combine_list(statis, rna_type_list)139 return combList140rna_type_list = ['tRNA', 'chrM', 'rRNA', 'snRNA', 'snoRNA', 'miRNA', 'other', 'Y', 'intergene', 'lncRNA', 'vault', 'mRNA', 'intron', 'unmap']141ROOT_1 = "/Share/home/zhangqf7/lipan/precursor_SHAPEMAP/statisticalReadsDist/1.STAR_mapping/"142ROOT_2 = "/Share/home/zhangqf7/lipan/precursor_SHAPEMAP/statisticalReadsDist/2.mapGenome/"143###############144#### 20190514 data145###############146INPUT_rep1_20190514 = get_statistics("INPUT_rep1_20190514")147INPUT_rep2_20190514 = get_statistics("INPUT_rep2_20190514")148INPUT_rep3_20190514 = get_statistics("INPUT_rep3_20190514")149RIP_DMSO_rep1_20190514 = get_statistics("RIP_DMSO_rep1_20190514")150RIP_DMSO_rep2_20190514 = get_statistics("RIP_DMSO_rep2_20190514")151RIP_DMSO_rep3_20190514 = get_statistics("RIP_DMSO_rep3_20190514")152RIP_NAIN3_rep1_20190514 = get_statistics("RIP_NAIN3_rep1_20190514")153RIP_NAIN3_rep2_20190514 = get_statistics("RIP_NAIN3_rep2_20190514")154RIP_NAIN3_rep3_20190514 = get_statistics("RIP_NAIN3_rep3_20190514")155samples = ['INPUT_rep1_20190514', 'INPUT_rep2_20190514', 'INPUT_rep3_20190514', 156 'RIP_DMSO_rep1_20190514', 'RIP_DMSO_rep2_20190514', 'RIP_DMSO_rep3_20190514', 157 'RIP_NAIN3_rep1_20190514','RIP_NAIN3_rep2_20190514','RIP_NAIN3_rep3_20190514']158df = pd.DataFrame([eval(file) for file in samples], index=samples, columns=rna_type_list)159df.to_csv("/Share/home/zhangqf7/figs/Pan.csv", sep="\t")160df_ratio = df.divide(df.sum(axis=1), axis='rows') 161df_ratio.to_csv("/Share/home/zhangqf7/figs/Pan_ratio.csv", sep="\t")162###############163#### More More Data164###############165NAI_100mm_vivo_CIRL_CENR_SSII_rep1 = get_statistics("NAI_100mm_vivo_CIRL_CENR_SSII_rep1")166NAI_100mm_vivo_CIRL_CENR_SSII_rep2 = get_statistics("NAI_100mm_vivo_CIRL_CENR_SSII_rep2")167NAI_100mm_vivo_CIRL_SSII = get_statistics("NAI_100mm_vivo_CIRL_SSII")168NAI_100mm_vivo_CIRL_TGIII = get_statistics("NAI_100mm_vivo_CIRL_TGIII")169colnames = ['NAI_100mm_vivo_CIRL_CENR_SSII_rep1', 'NAI_100mm_vivo_CIRL_CENR_SSII_rep2', 'NAI_100mm_vivo_CIRL_SSII', 'NAI_100mm_vivo_CIRL_TGIII']170df = pd.DataFrame([NAI_100mm_vivo_CIRL_CENR_SSII_rep1,NAI_100mm_vivo_CIRL_CENR_SSII_rep2,NAI_100mm_vivo_CIRL_SSII,NAI_100mm_vivo_CIRL_TGIII], index=colnames, columns=rna_type_list)171df.to_csv("/Share/home/zhangqf7/figs/Pan.csv", sep="\t")172df_ratio = df.divide(df.sum(axis=1), axis='rows') 173df_ratio.to_csv("/Share/home/zhangqf7/figs/Pan_ratio.csv", sep="\t")174###############175#### 20190412 data176###############177DMSO_20190412 = get_statistics("DMSO_20190412")178NAI_100mm_10min_rep1_20190412 = get_statistics("NAI_100mm_10min_rep1_20190412")179NAI_100mm_10min_rep2_20190412 = get_statistics("NAI_100mm_10min_rep2_20190412")180NAI_100mm_5min_rep1_20190412 = get_statistics("NAI_100mm_5min_rep1_20190412")181NAI_100mm_5min_rep2_20190412 = get_statistics("NAI_100mm_5min_rep2_20190412")182NAI_50mm_10min_rep1_20190412 = get_statistics("NAI_50mm_10min_rep1_20190412")183NAI_50mm_10min_rep2_20190412 = get_statistics("NAI_50mm_10min_rep2_20190412")184NAI_50mm_5min_rep1_20190412 = get_statistics("NAI_50mm_5min_rep1_20190412")185NAI_50mm_5min_rep2_20190412 = get_statistics("NAI_50mm_5min_rep2_20190412")186colnames = ['DMSO_20190412', 'NAI_100mm_10min_rep1_20190412', 'NAI_100mm_10min_rep2_20190412', 'NAI_100mm_5min_rep1_20190412', 'NAI_100mm_5min_rep2_20190412', 'NAI_50mm_10min_rep1_20190412', 'NAI_50mm_10min_rep2_20190412','NAI_50mm_5min_rep1_20190412','NAI_50mm_5min_rep2_20190412']187df = pd.DataFrame([DMSO_20190412,NAI_100mm_10min_rep1_20190412,NAI_100mm_10min_rep2_20190412,NAI_100mm_5min_rep1_20190412,NAI_100mm_5min_rep2_20190412,NAI_50mm_10min_rep1_20190412,NAI_50mm_10min_rep2_20190412,NAI_50mm_5min_rep1_20190412,NAI_50mm_5min_rep2_20190412], index=colnames, columns=rna_type_list)188df.to_csv("/Share/home/zhangqf7/figs/Pan.csv", sep="\t")189df_ratio = df.divide(df.sum(axis=1), axis='rows') 190df_ratio.to_csv("/Share/home/zhangqf7/figs/Pan_ratio.csv", sep="\t")191###############192#### 20190422 data193###############194DMSO_20190422 = get_statistics("DMSO_20190422")195NAI_100mm_10min_rep1_20190422 = get_statistics("NAI_100mm_10min_rep1_20190422")196NAI_100mm_10min_rep2_20190422 = get_statistics("NAI_100mm_10min_rep2_20190422")197NAI_100mm_5min_rep1_20190422 = get_statistics("NAI_100mm_5min_rep1_20190422")198NAI_100mm_5min_rep2_20190422 = get_statistics("NAI_100mm_5min_rep2_20190422")199NAI_50mm_10min_rep1_20190422 = get_statistics("NAI_50mm_10min_rep1_20190422")200NAI_50mm_10min_rep2_20190422 = get_statistics("NAI_50mm_10min_rep2_20190422")201NAI_50mm_5min_rep1_20190422 = get_statistics("NAI_50mm_5min_rep1_20190422")202NAI_50mm_5min_rep2_20190422 = get_statistics("NAI_50mm_5min_rep2_20190422")203samples = ['DMSO_20190422', 'NAI_100mm_10min_rep1_20190422', 'NAI_100mm_10min_rep2_20190422', 204 'NAI_100mm_5min_rep1_20190422', 'NAI_100mm_5min_rep2_20190422', 'NAI_50mm_10min_rep1_20190422', 205 'NAI_50mm_10min_rep2_20190422','NAI_50mm_5min_rep1_20190422','NAI_50mm_5min_rep2_20190422']206df = pd.DataFrame([eval(file) for file in samples], index=samples, columns=rna_type_list)207df.to_csv("/Share/home/zhangqf7/figs/Pan.csv", sep="\t")208df_ratio = df.divide(df.sum(axis=1), axis='rows') 209df_ratio.to_csv("/Share/home/zhangqf7/figs/Pan_ratio.csv", sep="\t")210###############211#### 20190606 data212###############213INPUT_rep1_20190606 = get_statistics("INPUT_rep1_20190606")214INPUT_rep2_20190606 = get_statistics("INPUT_rep2_20190606")215RIP_rep1_20190606 = get_statistics("RIP_rep1_20190606")216RIP_rep2_20190606 = get_statistics("RIP_rep2_20190606")217samples = ['INPUT_rep1_20190606', 'INPUT_rep2_20190606', 'RIP_rep1_20190606', 'RIP_rep1_20190606'] 218df = pd.DataFrame([eval(file) for file in samples], index=samples, columns=rna_type_list)219df.to_csv("/Share/home/zhangqf7/figs/Pan.csv", sep="\t")220df_ratio = df.divide(df.sum(axis=1), axis='rows') ...
dto_service_tests.py
Source:dto_service_tests.py
...19 self.__stud_repo.generate_students()20 self.__grade_repo.generate_grades()21 self.__service.create_medie_list()22 self.__service.sort_medii()23 self.assertGreaterEqual(self.__service.get_statistics(0).getMedie(),24 self.__service.get_statistics(1).getMedie())25 self.assertGreaterEqual(self.__service.get_statistics(1).getMedie(),26 self.__service.get_statistics(2).getMedie())27 self.assertGreaterEqual(self.__service.get_statistics(2).getMedie(),28 self.__service.get_statistics(3).getMedie())29 self.assertGreaterEqual(self.__service.get_statistics(3).getMedie(),30 self.__service.get_statistics(4).getMedie())31 self.assertGreaterEqual(self.__service.get_statistics(4).getMedie(),32 self.__service.get_statistics(5).getMedie())33 self.assertGreaterEqual(self.__service.get_statistics(5).getMedie(),34 self.__service.get_statistics(6).getMedie())35 self.assertGreaterEqual(self.__service.get_statistics(6).getMedie(),36 self.__service.get_statistics(7).getMedie())37 self.assertGreaterEqual(self.__service.get_statistics(7).getMedie(),38 self.__service.get_statistics(8).getMedie())39 self.assertGreaterEqual(self.__service.get_statistics(8).getMedie(),...
test_api.py
Source:test_api.py
...29 json=get_statistics30 )31 assert response.status_code == 40932@temp_db33def test_get_statistics(get_statistics):34 client.post(35 "/statistics/",36 json=get_statistics37 )38 response = client.get(39 "/statistics",40 params=get_statistics["date"]41 )42 assert response.status_code == 20043 assert response.json() == calculate_CPC_and_CPM([get_statistics])44@temp_db45def test_drop_statistics(get_statistics):46 client.post(47 "/statistics/",...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!