def info(cs, sequence): print_colored("INFO", "green") seq = Seq(sequence) response = seq.print_percentages( ) # -- We have created a new function in Seq1.py to print A: number (percentage)% final_response = "Sequence: " + sequence + "\n" + "Total Length: " + str( seq.len()) + "\n" + response print(final_response) cs.send(str(final_response).encode())
def info(sequence): seq = Seq(sequence) seq_info = "Total Length: " + str(seq.len()) context = { 'gene_information': seq_info, 'gene_name': sequence, 'gene_percentages': seq.print_percentages( ), # -- We have created a new function in Seq1.py to print A: number (percentage)% 'operation': "Info" } contents = read_template_html_file('./html/info.html').render( context=context) return contents
def gene_seq(arguments, path_name, HUMAN_GENES): if arguments != {}: gene = arguments['gene'][0] ENDPOINT = "/sequence/id/" id = HUMAN_GENES[gene] connection = http.client.HTTPConnection(SERVER) connection.request("GET", ENDPOINT + id + PARAMS) response = connection.getresponse() response_dict = json.loads(response.read().decode()) if path_name == "/geneSeq" and response.status == 200: context = {'sequence': response_dict['seq'], 'gene': gene} contents = read_template_html_file( './html/gene_sequence.html').render(context=context) return contents elif path_name == "/geneInfo" and response.status == 200: sequence = Seq(response_dict['seq']) chromo_info_list = response_dict['desc'].split(":") context = { 'length': sequence.len(), 'start': chromo_info_list[3], 'end': chromo_info_list[4], 'chromo_name': chromo_info_list[1], 'id': response_dict['id'], 'gene': gene } contents = read_template_html_file( './html/gene_sequence_info.html').render(context=context) return contents elif path_name == "/geneCalc" and response.status == 200: sequence = Seq(response_dict['seq']) context = { 'length': sequence.len(), 'percentages': sequence.print_percentages(), 'gene': gene } contents = read_template_html_file( './html/gene_percentages.html').render(context=context) return contents else: contents = read_template_html_file( "html/errors/error.html").render() return contents else: contents = read_template_html_file( "html/errors/not_introduced.html").render() return contents