import pandas import po import argparse parser = argparse.ArgumentParser() parser.add_argument('filename', type=str) args = parser.parse_args() df = po.read_csv(args.filename, sep="\t") correctly_mapped = df.query('(indel_pos - mapped_pos == 21)') correctly_aligned = pandas.DataFrame([ r for r in correctly_mapped.values if r[2].startswith('22') ], columns=df.keys()) print("\t\ttotal\tmap correctly\tsame with profile") print(args.filename,"\t",len(df),"\t",len(correctly_mapped),"\t",len(correctly_aligned)) if len(correctly_aligned) > 0: correctly_aligned_by_chr = correctly_aligned[['ChrID','non_gap_num','opt_num_1_alignment']].groupby('ChrID', sort=False) print(correctly_aligned_by_chr.mean()) ## correctly mapped and number of optimal affine-gapped alignment is greater than 1. correctly_mapped = df.query('(indel_pos - mapped_pos == 21) and (opt_num_1_alignment > 1)') correctly_aligned = pandas.DataFrame([ r for r in correctly_mapped.values if r[2].startswith('22') ], columns=df.keys()) print("correctly mapped, same w profile and >1 multiple opt alignments") print(len(correctly_aligned)) if len(correctly_aligned) > 0: correctly_aligned_by_chr = correctly_aligned[['ChrID','non_gap_num','opt_num_1_alignment']].groupby('ChrID', sort=False) print(correctly_aligned_by_chr.mean())
import po # get data from machineuft predict use LogisticRegression and save it in L_machine iris = po.read_csv("data\\F2011-F2015_Regression_FulColumn.csv", encoding='utf-8') iris.Classify(["ARESD", "ACT"], "REGTYPE", method="LogisticRegression", portion=0.8) iris.to_csv("Registration_All_Logistic.csv", encoding='utf-8') # get data from machineuft predict use RandomForest and save it in L_machine iris = po.read_csv("data\\F2011-F2015_Regression_FulColumn.csv", encoding='utf-8') iris.Classify(["ARESD", "ACT"], "REGTYPE", method="RandomForest", portion=0.9) iris.to_csv("Registration_All_RandomForest.csv", encoding='utf-8') # get data from machineuft predict use Naive-Bayes and save it in L_machine iris = po.read_csv("D:\\MasterProject\\po-master\\po\\data\\F2011-F2015_Regression_FulColumn.csv", encoding='utf-8') iris.Classify(["ARESD", "ACT", "HSGPA", "STATE", "RACE", "FIRSTGEN", "FATHEREDUCATION", "MOTHEREDUCATION"], "REGTYPE", method="GaussianNB", portion=0.9) iris.to_csv("GaussianNB_Registration.csv", encoding='utf-8') # get data from machineuft predict use SVM and save it in L_machine iris = po.read_csv("D:\\MasterProject\\po-master\\po\\data\\F2011-F2015_Regression_FulColumn.csv", encoding='utf-8')
import po # get data from machineuft predict use LinearRegression and save it in L_machine iris = po.read_csv("data\\iris.csv", encoding="utf-8") iris.Classify(["SepalLength", "SepalWidth", "PetalLength", "PetalWidth"], "Species", method="RandomForest", portion=0.7) iris.to_csv("Iris_RandomForest.csv", encoding="utf-8") # get data from machineuft predict use LinearRegression and save it in L_machine iris = po.read_csv("data\\iris.csv", encoding="utf-8") iris.Classify(["SepalLength", "SepalWidth", "PetalLength", "PetalWidth"], "Species", method="SVM", portion=0.7) iris.to_csv("Iris_SVM.csv", encoding="utf-8") # get data from machineuft predict use LinearRegression and save it in L_machine iris = po.read_csv("data\\iris.csv", encoding="utf-8") iris.Classify( ["SepalLength", "SepalWidth", "PetalLength", "PetalWidth"], "Species", method="KNeighbors", n_neighbors=4, portion=0.7, ) iris.to_csv("Iris_Kneighbors.csv", encoding="utf-8")
import po # get data from machineuft predict use LinearRegression and save it in L_machine comp = po.read_csv("data\\computer_hardware.csv", encoding='utf-8') comp.Regression(["MYCT", "MMIN", "CACH", "CHMIN", "CHMAX", "PRP"], "ERP", method="LinearRegression", portion=0.8) comp.to_csv("Hardware_Linear.csv", encoding='utf-8') # get data from machineuft predict use LinearRegression and save it in L_machine comp = po.read_csv("data\\computer_hardware.csv", encoding='utf-8') comp.Regression(["MYCT", "MMIN", "CACH", "CHMIN", "CHMAX", "PRP"], "ERP", method="RandomForest", portion=0.8) comp.to_csv("Hardware_RandomForest.csv", encoding='utf-8') # get data from machineuft predict use LinearRegression and save it in L_machine comp = po.read_csv("data\\computer_hardware.csv", encoding='utf-8') comp.Regression(["MYCT", "MMIN", "CACH", "CHMIN", "CHMAX", "PRP"], "ERP", method="KNeighbors", n_neighbors=4, portion=0.8) comp.to_csv("Hardware_KN.csv", encoding='utf-8')
import po import warnings warnings.filterwarnings("ignore", category=DeprecationWarning) # get data from machineuft predict use RandomForest and save it in L_machine iris = po.read_csv("data\\F2011-F2015_Regression_FulColumn.csv", encoding='utf-8') iris.Regression(["ACT"], "FATHEREDUCATION", method="KNeighbors", portion=0.8)
#Optimal Alignment import pandas import po import argparse parser = argparse.ArgumentParser() parser.add_argument('filename', type=str) args = parser.parse_args() df = po.read_csv(args.filename, sep="\t") df["possiblity"] = 1.0/df["opt_num_1_alignment"] correctly_mapped = df.query('indel_pos - mapped_pos == 21') tmp = [ r for r in correctly_mapped.values if r[2].startswith('22') and r[6] > 1 ] correctly_aligned = pandas.DataFrame(tmp, columns=df.keys()) correctly_aligned["p"] = 1.0/correctly_aligned["opt_num_1_alignment"] correctly_aligned_by_chr = correctly_aligned[['ChrID','non_gap_num','opt_num_1_alignment', 'possiblity']].groupby('ChrID', sort=False) print("\t\ttotal\tmapped\taligned\taveragepossible") print(args.filename,"\t",len(df),"\t",len(correctly_mapped),"\t",len(correctly_aligned), correctly_aligned["possiblity"].mean()) print("\nMean") print(correctly_aligned_by_chr.mean()) print("\nStandard Dev") print(correctly_aligned_by_chr.std()) Status API Training Shop Blog About