Beispiel #1
0
def info(cs, sequence):
    print_colored("INFO", "green")
    seq = Seq(sequence)
    response = seq.percentage_base(
    )  # -- 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())
Beispiel #2
0
    "RBMY2YP": "ENSG00000227633",
    "FGFR3": "ENSG00000068078",
    "KDR": "ENSG00000128052",
    "ANK2": "ENSG00000145362"
}

SERVER = "rest.ensembl.org"
ENDPOINT = "/sequence/id/"

PARAMETERS = "?content-type=application/json"

connection = http.client.HTTPConnection(SERVER)
try:
    user_gene = input("Enter the gene that you want to analyze:")
    id = DICT_GENE[user_gene]
    connection.request("GET", ENDPOINT + id + PARAMETERS)
    response = connection.getresponse()
    if response.status == 200:
        response_dict = json.loads(response.read().decode())
        sequence = Seq(response_dict["seq"])
        s_length = sequence.len()
        percentages = sequence.percentage_base(sequence.count_base())
        most_frequent_base = sequence.frequent_base(sequence.count())
        print("Total length:", s_length)
        for value in percentages.values():
            print(value)
        print("Most frequent base:", most_frequent_base)
except KeyError:
    print("The key is not inside our dictionary. Choose one of the following:",
          list(DICT_GENE.keys))
Beispiel #3
0
def info(sequence):
    seq = Seq(sequence)
    response = seq.percentage_base()  # -- 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
    return final_response