How to use select_parameters method in localstack

Best Python code snippet using localstack_python

select_parameters.py

Source:select_parameters.py Github

copy

Full Screen

...40 27347.0,41 23436.0]}42optimized_codon_fop = {'correlation_analysis': []}43optimized_codon_cbi = {'correlation_analysis': []}44class select_parameters():45 cai_reference_frequency = reference_frequnecy_cai['Homo_sapiens_EMBOSS']46 tai_tGCN = tGCN_tai['Homo_sapiens_GRCh38_GtRNAdb']47 ite_heg = reference_heg_ite['Homo_sapiens_EMBOSS']48 ite_bg = reference_bg_ite['Homo_sapiens_EMBOSS']49 fop_opt_codon = optimized_codon_fop['correlation_analysis']50 cbi_opt_codon = optimized_codon_cbi['correlation_analysis']51 @staticmethod52 def parameter_select_cai():53 # select reference set for cai computing54 cai_dict = {1: 'Homo_sapiens_EMBOSS'}55 while True:56 try:57 # select reference set58 cai_choice = int(input("select reference set for cai computing"59 "\nYour choice is: "60 "\n(1) 'Homo_sapiens_reference_set_fromEMBOSS[DEFAULT]'\n"))61 except ValueError:62 print("Only one reference set could be chosen at a time.")63 continue64 if cai_choice not in cai_dict.keys():65 raise ValueError('the number you choose is out of range')66 select_parameters.cai_reference_frequency = reference_frequnecy_cai[cai_dict[cai_choice]]67 break68 print(f"reference set for cai computing was selected\n")69 pass70 # result +=(cai_reference_frequency,)71 # result +=(cai_reference_order,)72 @staticmethod73 def parameter_select_fop():74 # select optimized codons for fop computing75 fop_dict = {0: 'correlation_analysis'}76 while True:77 try:78 fop_choice = int(input("select optimized codons for fop computing"79 "\nYour choice is: "80 "\n(0) Correlation_analysis_for_optimized_codon[DEFAULT]"81 "\n"))82 except ValueError:83 print("Only one reference could be chosen at a time.")84 continue85 select_parameters.fop_opt_codon = optimized_codon_cbi[fop_dict[fop_choice]]86 break87 print(f"optimized codon for fop computing was selected\n")88 @staticmethod89 def parameter_select_tai():90 # select reference GCN of tRNAs for tai computing91 tai_dict = {1: 'Homo_sapiens_GRCh38_GtRNAdb'}92 while True:93 try:94 tai_choice = int(input("select reference GCN of tRNAs for tai computing"95 "\nYour choice is: "96 "\n(1) Homo_sapiens_GRCh38_fromGtRNAdb[DEFAULT]"97 "\n"))98 except ValueError:99 print("Only one reference GCN could be chosen at a time.")100 continue101 select_parameters.tai_tGCN = tai_dict[tai_choice]102 break103 print("the GCN of tRNA for tai computing was selected\n")104 @staticmethod105 def parameter_select_ite():106 # select reference set for ite computing107 ite_dict = {1: 'Homo_sapiens_EMBOSS'}108 while True:109 try:110 ite_choice = int(input("select reference set for ite computing"111 "\nYour choice is: "112 "\n(1) 'Homo_sapiens_reference_fromEMBOSS[DEFAULT]'\n"))113 except ValueError:114 print("Only one reference set could be chosen at a time.")115 continue116 select_parameters.ite_heg = reference_heg_ite[ite_dict[ite_choice]]117 select_parameters.ite_bg = reference_bg_ite[ite_dict[ite_choice]]118 break119 print(f"reference set for ite computing was selected\n")120 @staticmethod121 def parameter_select_cbi():122 # select optimized codons for fop computing123 cbi_dict = {0: 'correlation_analysis'}124 while True:125 try:126 cbi_choice = int(input("select optimized codons for cbi computing"127 "\nYour choice is: "128 "\n(0) Correlation_analysis_for_optimized_codon[DEFAULT]"129 "\n"))130 except ValueError:131 print("Only one reference could be chosen at a time.")132 continue133 select_parameters.cbi_opt_codon = optimized_codon_cbi[cbi_dict[cbi_choice]]134 break135 print(f"optimized codon for cbi computing was selected\n")136 @staticmethod137 def process_parameter_file(parameter_file):138 # the input file welcomes an excel file or a dataframe,139 # namely if you have a parameter file in form of csv, make it a dataframe first.140 try:141 parameter_dataframe = pd.read_excel(parameter_file, index_col=0)142 except:143 if type(parameter_file) == pd.DataFrame:144 parameter_dataframe = parameter_file145 else:146 raise AttributeError('the input parameter file should be an excel file(.xlsx) or a dataframe.')147 # sorting the dataframe.148 parameter_dataframe = parameter_dataframe.loc[["TTT", "TTC", "TTA", "TTG",149 "TCT", "TCC", "TCA", "TCG",150 "TAT", "TAC", "TAA", "TAG",151 "TGT", "TGC", "TGA", "TGG",152 "CTT", "CTC", "CTA", "CTG",153 "CCT", "CCC", "CCA", "CCG",154 "CAT", "CAC", "CAA", "CAG",155 "CGT", "CGC", "CGA", "CGG",156 "ATT", "ATC", "ATA", "ATG",157 "ACT", "ACC", "ACA", "ACG",158 "AAT", "AAC", "AAA", "AAG",159 "AGT", "AGC", "AGA", "AGG",160 "GTT", "GTC", "GTA", "GTG",161 "GCT", "GCC", "GCA", "GCG",162 "GAT", "GAC", "GAA", "GAG",163 "GGT", "GGC", "GGA", "GGG"]]164 # change parameters165 if 'cai_ref' in parameter_dataframe.columns:166 select_parameters.cai_reference_frequency = parameter_dataframe['cai_ref'].values.tolist()167 if 'tai_tGCN' in parameter_dataframe.columns:168 select_parameters.tai_tGCN = parameter_dataframe['tai_tGCN'].values.tolist()169 if 'ite_heg' in parameter_dataframe.columns:170 select_parameters.ite_heg = parameter_dataframe['ite_heg'].values.tolist()171 if 'ite_bg' in parameter_dataframe.columns:172 select_parameters.ite_bg = parameter_dataframe['ite_bg'].values.tolist()173 if 'cbi_opt' in parameter_dataframe.columns:174 # todo 注意导入的文件与实际计算时的可能不同。使得cbi和fop在计算时能容纳不同的opt。175 select_parameters.cbi_opt_codon = parameter_dataframe['cbi_opt'].values.tolist()176 if 'fop_opt' in parameter_dataframe.columns:177 select_parameters.fop_opt_codon = parameter_dataframe['fop_opt'].values.tolist()178 return179 fundict = {1: parameter_select_cai, 2: parameter_select_tai, 3: parameter_select_ite, 4: parameter_select_fop,180 5: parameter_select_cbi}181 def __init__(self, parameter_file=None, cai_ref=None, tai_tGCN=None, ite_heg=None, ite_bg=None, fop_opt=None,182 cbi_opt=None, skip_select=False):183 additional_request = [parameter_file, cai_ref, tai_tGCN, ite_heg, ite_bg, fop_opt, cbi_opt]184 # if skip_select is True, you will select parameters among the prestored database.185 if not skip_select:186 while True:187 try:188 indexes = list(189 map(int, input("Press the serial number of index of which parameter you want to change: "190 "\n(1) cai "191 "\n(2) tai "192 "\n(3) ite "193 "\n(4) fop "194 "\n(5) cbi "195 "\n").split()))196 except ValueError:197 print("Please input number")198 continue199 for index in indexes:200 if 0 < index < 6:201 select_parameters.fundict[index]()202 else:203 print("The number is not between 1 and 5!")204 break205 # if your own parameter data is input, parameters will be replace by the data. the priority is206 # single_parameter_list(use cai_ref=) > parameter_file > parameter_selected. when you try to change a single207 # parameter, for example using cai_ref, make it equal to a list or an array is both OK but not a dataframe.208 if additional_request:209 if parameter_file:210 select_parameters.process_parameter_file(parameter_file=parameter_file)211 if cai_ref:212 select_parameters.cai_reference_frequency = list(cai_ref)213 if tai_tGCN:214 select_parameters.tai_tGCN = list(tai_tGCN)215 if ite_heg:216 select_parameters.ite_heg = list(ite_heg)217 if ite_bg:218 select_parameters.ite_bg = list(ite_bg)219 if cbi_opt:220 select_parameters.cbi_opt_codon = list(cbi_opt)221 if fop_opt:222 select_parameters.fop_opt_codon = list(fop_opt)223 return224 @staticmethod225 def generate_parameter_file(sorting='TCAG'):226 # use different sorting method, the result xlsx file will have sample name of different sorting.227 # for example, "TCAG" for "TTT" to "GGG", "amino_acid" for "GCA" to "TGA".228 if sorting == 'TCAG':229 parameter_dataframe = pd.DataFrame(index=["TTT", "TTC", "TTA", "TTG",230 "TCT", "TCC", "TCA", "TCG",231 "TAT", "TAC", "TAA", "TAG",232 "TGT", "TGC", "TGA", "TGG",233 "CTT", "CTC", "CTA", "CTG",234 "CCT", "CCC", "CCA", "CCG",235 "CAT", "CAC", "CAA", "CAG",236 "CGT", "CGC", "CGA", "CGG",237 "ATT", "ATC", "ATA", "ATG",238 "ACT", "ACC", "ACA", "ACG",239 "AAT", "AAC", "AAA", "AAG",240 "AGT", "AGC", "AGA", "AGG",241 "GTT", "GTC", "GTA", "GTG",242 "GCT", "GCC", "GCA", "GCG",243 "GAT", "GAC", "GAA", "GAG",244 "GGT", "GGC", "GGA", "GGG"])245 elif sorting == 'amino_acid':246 parameter_dataframe = pd.DataFrame(247 index=['GCA', 'GCC', 'GCG', 'GCT', 'TGC', 'TGT', 'GAC', 'GAT', 'GAA', 'GAG', 'TTC', 'TTT',248 'GGA', 'GGC',249 'GGG', 'GGT', 'CAC', 'CAT', 'ATA', 'ATC', 'ATT', 'AAA', 'AAG', 'CTA', 'CTC', 'CTG',250 'CTT', 'TTA',251 'TTG', 'ATG', 'AAC', 'AAT', 'CCA', 'CCC', 'CCG', 'CCT', 'CAA', 'CAG', 'AGA', 'AGG',252 'CGA', 'CGC',253 'CGG', 'CGT', 'AGC', 'AGT', 'TCA', 'TCC', 'TCG', 'TCT', 'ACA', 'ACC', 'ACG', 'ACT',254 'GTA', 'GTC',255 'GTG', 'GTT', 'TGG', 'TAC', 'TAT', 'TAA', 'TAG', 'TGA'])256 else:257 raise ValueError("Counldn't find the sorting method you use.")258 parameter_dataframe['cai_ref'] = select_parameters.cai_reference_frequency259 parameter_dataframe['tai_tGCN'] = select_parameters.tai_tGCN260 ite_dataframe = pd.DataFrame(index=["TTT", "TTC", "TTA", "TTG",261 "TCT", "TCC", "TCA", "TCG",262 "TAT", "TAC",263 "TGT", "TGC", "TGG",264 "CTT", "CTC", "CTA", "CTG",265 "CCT", "CCC", "CCA", "CCG",266 "CAT", "CAC", "CAA", "CAG",267 "CGT", "CGC", "CGA", "CGG",268 "ATT", "ATC", "ATA", "ATG",269 "ACT", "ACC", "ACA", "ACG",270 "AAT", "AAC", "AAA", "AAG",271 "AGT", "AGC", "AGA", "AGG",272 "GTT", "GTC", "GTA", "GTG",273 "GCT", "GCC", "GCA", "GCG",274 "GAT", "GAC", "GAA", "GAG",275 "GGT", "GGC", "GGA", "GGG"])276 ite_dataframe['ite_heg'] = select_parameters.ite_heg277 ite_dataframe['ite_bg'] = select_parameters.ite_bg278 parameter_dataframe = pd.concat([parameter_dataframe, ite_dataframe], axis=1)279 if select_parameters.cbi_opt_codon:280 parameter_dataframe['cbi_opt'] = select_parameters.cbi_opt_codon281 if select_parameters.fop_opt_codon:282 parameter_dataframe['fop_opt'] = select_parameters.fop_opt_codon283 parameter_dataframe.to_excel('parameter_file.xlsx')284 return285# c = select_parameters( parameter_file='parameter_file.xlsx', cai_ref=[1], skip_select=True)286# c.process_parameter_file()287# print(c.cai_reference_frequency)288# print(c.cbi_opt_codon)...

Full Screen

Full Screen

c.py

Source:c.py Github

copy

Full Screen

1import streamlit as st2import time3import numpy as np4import pandas as pd5import matplotlib.pyplot as plt6import datetime7plt.rcParams['font.sans-serif']=['SimHei']8plt.rcParams['axes.unicode_minus'] = False9 10def sidebar():11 df_parameters = pd.DataFrame({'industry': ['-','金融','医疗'],'name': ['-','A','B'],'time': ['-','5天','7天']})12 select_parameters=[]13 option_industry = '-'14 option_name = '-'15 option_time = '-'16 17 option_industry = st.sidebar.selectbox('请选择股票行业',df_parameters['industry'])18 if option_industry != '-':19 select_parameters.append(option_industry)20 option_name = st.sidebar.selectbox('请选择股票名称',df_parameters['name'])21 else:22 pass23 24 if option_name!= '-':25 select_parameters.append(option_name)26 option_time = st.sidebar.selectbox('请选择时间窗口',df_parameters['time'])27 else:28 pass29 30 if option_time!= '-':31 select_parameters.append(option_time)32 version_option=st.sidebar.selectbox('选择历史版本:',('-','版本1', '版本2', '版本3'))33 st.sidebar.button('切换页面')34 st.sidebar.button('更新参数')35 36 return select_parameters37 38def display():39 st.set_option('deprecation.showPyplotGlobalUse', False) 40 #st.title(time.strftime("当前日期:%Y年%m月%d日", time.localtime()))41 start_date = "20200101"42 gap = 36543 date_list = pd.to_datetime(pd.date_range(start=start_date, periods=gap).strftime("%Y%m%d").tolist())44 chart_data = pd.DataFrame(np.random.randn(365, 2),columns=['真实值','预测值'],index=date_list)#传入DataFrame45 plt.plot(date_list,chart_data['真实值'],label='真实值') 46 plt.plot(date_list,chart_data['预测值'],label='预测值')47 plt.ylim(bottom=0)48 plt.xticks(rotation=45)49 plt.title(sidebar[0]+'行业'+sidebar[1]+'股票在'+sidebar[2]+'时间窗口下的预测结果',loc='center',fontproperties="SimHei",fontsize=20)50 plt.xlabel('日期',loc='right')51 plt.ylabel('价格',loc='top')52 plt.legend(loc='upper right')53 st.pyplot()54 55def button():56 ini_date=datetime.date.today()57 end_date=datetime.date.today()58 st.write('训练数据:')59 ini_date=st.date_input('起始日期:',value=datetime.date(2001,1,1))60 end_date=st.date_input('截止日期:') 61 st.button('确定')62 return ini_date,end_date63 64sidebar=sidebar()65#st.write(run)66if len(sidebar) != 3:67 st.header('请选择参数!')68else:69 display() ...

Full Screen

Full Screen

st_sidebar.py

Source:st_sidebar.py Github

copy

Full Screen

1"""2@author raymanlei3@since 2022-05-08 22:27:254"""5import streamlit as st6import pandas as pd7from datetime import datetime as dt8def update_parameters(select_parameters):9 st.header('模板:' + str(dt.now().__format__('%Y-%m-%d')) + ' 分析报告 by raymanlei')10 st.info(select_parameters)11 return12def sidebar():13 print('--->>> sidebar')14 # file uploader15 uploaded_files = st.sidebar.file_uploader("Upload your Python DA Script", type=["py"], accept_multiple_files=True)16 if uploaded_files is not None:17 for f in uploaded_files:18 input_df = pd.read_csv(f)19 print(input_df.head(5))20 # part 221 df_parameters = pd.DataFrame(22 {'industry': ['-', 'Financial', 'Medical'], 'name': ['-', 'Alibaba', 'Tencent'],23 'time': ['-', '5 Days', '7 Days']})24 select_parameters = []25 option_industry = '-'26 option_name = '-'27 option_time = '-'28 option_industry = st.sidebar.selectbox('Industry', df_parameters['industry'])29 if option_industry != '-':30 select_parameters.append(option_industry)31 option_name = st.sidebar.selectbox('Stock', df_parameters['name'])32 else:33 pass34 if option_name != '-':35 select_parameters.append(option_name)36 option_time = st.sidebar.selectbox('Times', df_parameters['time'])37 else:38 pass39 if option_time != '-':40 select_parameters.append(option_time)41 version_option = st.sidebar.selectbox('Anonymous:', ('-', 'Anonymous 1', 'Anonymous 2', 'Anonymous 3'))42 st.sidebar.button('Button Alpha')43 st.sidebar.button('Button Beta', on_click=update_parameters(select_parameters))...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful