21 Building your first app
Aim
In this exercise, you will create a simple web application using Streamlit that allows users to input a DNA sequence and retrieve BLAST results from the NCBI database. This app will demonstrate how to collaborate with a coding agent to build an app that interacts with web APIs and displays results in a user-friendly format.
The aim for this in-class exercise is to practice using an agentic programming command line interface to work on code. You app will provide a user interface that:
- Takes a DNA sequence as input
- Queries the NCBI BLAST database using the URLAPI
- Displays the query results
Instructions
You should have the required software needed for this exercise installed already. If not, please refer to the setup instructions provided on the course website. Start by creating a new directory for this exercise and open a Positron session in that folder.
Next we need to set up our python environment and install the required packages. Run the following in your termnal window:
python -m venv .genai_venv
.genai_venv\Scripts\activate
pip install streamlit google-genai
Now you are ready to start building your app! Open either the Gemini CLI or the GitHub Copilot CLI and give it a list of instructions. I used the following:
Please create a streamlit app called “blast_app”. It should take a DNA sequence as input, query the NCBI BLAST database using the URLAPI, and display the results. The app should have a text input area for the DNA sequence and a button to submit the query. When the button is clicked, it should display the BLAST results below in a user-friendly format.
Follow the instructions for launching the app (it will probably suggest running streamlit run blast_app.py in your terminal) and test it out! Once you have a prototype, finish the exercise before further customizing your app.
Document and push your code to GitHub
Create a README.md file that describes your app, how to run it, and any dependencies required. Can you do this with the help of your coding agent?
Accept this GitHub Classroom assignment to create your own repository for this exercise.
You should now be able to push your code using GitHub Desktop:
- Go to
File > New Repository...and select the folder where you created your app - Look at the History tab, and verify that your files were added during the initialization as expected
- At this point, you need to link it to your GitHub Classroom repository in your terminal window with:
git remote add origin <your-repo-URL>(my url is “https://github.com/BIFX547-26/blast-app-johnsonra”) - Now you can publish your repository to GitHub by clicking the “Publish branch” button in GitHub Desktop
- Go to
If you have time left, consider adding additional features to your app. When you are finished with the exercise, please submit the URL of your GitHub repository to the assignment on Blackboard.