-
Notifications
You must be signed in to change notification settings - Fork 7
Session 20: Final project specification
- Project tittle: Browsing human and vertebrates genome
- Date: Tuesday, April-14th-2020
- Deadline: May the 25th, 2020
TODO
Let's create our first application that receives information directly from a remote application
Go to the API REST of the ensembl project and try to find an endpoint for checking if the service is alive (try searching for ping)
Click on the ping endpoint. You will see the documentation. As a Engineer is your work to read all the provided information and understand how this endpoint works. I will help you a litlte bit
The name of the endpoint is info/ping and it should be accessed using the HTTP GET method. On the top right we can see all the formats in which the information can be received: json, xml and jsonp. We are using json
In the bottom there is an example on how to use this endpoint. Click on the given URL:
Let's analyze the URL:
It consist of three parts:
- The server name: rest.ensembl.org
- The endpoint name: /info/ping
- The endpoint parameters: content-type=application/json
The parameter content-type indicates the format in which the application wants to receive the data. In our case we should set it to "application/json", because we are using the json format
In the browser we can see that we have received one object, which has a property called "ping" and its values is 1. It means that the server is alive
Try to receive the information in another format, for example in XML:
Implement a python client, using the http.client module, for accesing to the ensembl's ping endpoint. It should print on the console the server name, the complete URL and a message telling the state of the server
- File: P7/EX01-ping.py
- Description:
The program should read the object provided by the server and store it in a variable called response. Then, it should check the response['ping'] property and print a message if it is equal to 1
This is what it should be printed on the console after executing the client:
Every sequence on the ensembl database has an identifier, called stable identified (id). If you want to get a gene, you can use the /sequence/id endpoint. You should pass the stable identifier as the first argument
As an example, the identifier for the SRCAP gene is ENSG00000080603
In this exercise you have to find the stable identifiers of the following genes: FRAT1, ADA, FXN, RNU6_269P, MIR633, TTTY4C, RBMY2YP, FGFR3, KDR, ANK2
- File: P7/EX02-gene-id.py
- Description: Create a dictionary called GENES that contains the name of the genes and their identifiers. The program should print all the entries in the dicctionary with their identifiers:
If you want to get, for example, the identifier for the FRAT1 gene, you use: GENES['FRAT1']
- File: P7/EX03-gene-MIR633.py
- Description: In this exercise you have to program a client for connecting to the /sequence/id endpoint and getting the sequence and description of the MIR633 Gene
Your program should print this information in the console:
Now that we can get genes from the server, it is time to perform some calculations with them. We will use the Seq1 Class that we created in Practice 1
- File: P7/EX04-gene-process.py
- Description: The program should ask the user to enter the gene name and then get the gene from the server, print the gene's name, its description (same as exercise 3), the total length, then number of bases, the base percentage and the most frequent Base in the sequence
In this animation you can see the program running
- File: P7/Ex05-gene-all.py
- Description: Create a python program for performing the same calculations than in exercise 4, but for ALL the genes, not only one. The gene's names should be obtained from the Dictionary and not from the user
In this animation you can see how it works:
The session is finished. Make sure, during this week, that everything in this list is checked!
- You have all the items of the session 18 checked!
- Your working repo contains the P7 Folder with the following files:
- EX01-ping.py
- EX02-gene-id.py
- EX03-gene-MIR633.py
- EX04-gene-process.py
- EX05-gene-all.py
- All the previous files have been pushed to your remote Github repo
- Juan González-Gómez (Obijuan)
- Alvaro del Castillo. He designed and created the original content of this subject. Thanks a lot :-)
S0: Introduction
S1: Tools I
S2: Tools II
S3: Practicing with the tools
S8: Client-Server-1
S9: Client-Server-2
S10: Client-server-3
S11: Client-server-4
S12: HTTP protocol-1
S13: HTTP protocol-2
S14: HTTP module
S15: HTTP module
S16: HTML forms
S17: HTML forms