Skip to content

Commit 5622f04

Browse files
Added Web UI for RNA seq pipeline
1 parent 4ae9776 commit 5622f04

File tree

4 files changed

+279
-0
lines changed

4 files changed

+279
-0
lines changed

Web UI/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/venv
2+
cre.txt
3+
exports.zip

Web UI/README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Oxford Nanopore | RNA Analysis Tool
2+
### Welcome to the Oxford Nanopore RNA Analysis Tool repository!
3+
4+
## Overview
5+
This repository contains the source code for our web application designed to simplify RNA sequence analysis using Oxford Nanopore sequencing data. Our goal is to provide a user-friendly interface that enables researchers, regardless of their programming background, to analyze RNA data efficiently and effectively.
6+
## Features
7+
8+
- **User-Friendly Interface:** Our web application offers an intuitive interface designed for ease of use.
9+
- **Nanopore Sequencing Support:** Analyze RNA data generated from Oxford Nanopore sequencing technology.
10+
- **Simple Workflow:** Perform various analyses and visualizations with just a few clicks.
11+
- **Accessible to Non-Programmers:** No programming knowledge required. Anyone can analyze RNA data effortlessly.
12+
- **Interactive Visualizations:** Explore your RNA data through interactive charts and graphs.
13+
14+
15+
## Getting Started
16+
17+
To get started with our RNA Analysis Tool, follow these steps:
18+
19+
1. Clone this repository to your local machine.
20+
```
21+
git clone https://github.com/KushanManahara/Oxford-Nanopore-RNA-Analysis-Tool.git
22+
```
23+
3. Navigate into the project repository.
24+
```
25+
cd Oxford-Nanopore-RNA-Analysis-Tool
26+
```
27+
4. Create a virtual environment (not necessary)
28+
29+
In Windows
30+
```
31+
python -m venv venv
32+
```
33+
34+
In Linux/MacOS
35+
```
36+
python3 -m venv venv
37+
```
38+
6. Install the necessary dependencies as specified in the `requirements.txt` file.
39+
```
40+
pip install -r requirements.txt
41+
```
42+
7. Run the web application using your preferred web server.
43+
```
44+
streamlit run app.py
45+
```
46+
## Usage Instructions
47+
- Log in to your server using the provided `host` `username` and `password`.
48+
- Navigate to the **blasting page**.
49+
- Upload your `raw files` as a `.zip` file. The zip file should contain two files, one starting with `'pass_'` and the other with `'fail_'`.
50+
- The pipeline will run, generating the final blasting output as a zip file, which includes the **final blasting report**, **Venn diagram**, and **quality analysis report**.
51+
## Contributing
52+
53+
We welcome contributions from the community! If you'd like to contribute to the development of the Oxford Nanopore RNA Analysis Tool, please fork this repository, make your changes, and submit a pull request.
54+
## Support
55+
56+
If you encounter any issues or have any questions about using the Oxford Nanopore RNA Analysis Tool, please [open an issue](https://github.com/example/repository/issues) on this repository.## License
57+
58+
59+
This project is licensed under the [MIT License](LICENSE).
60+
61+
## Tech Stack
62+
63+
- Python
64+
- Streamlit
65+
66+
67+
## 🚀 About Me
68+
### Kushan Manahara
69+
70+
I'm a final year undergraduate student pursuing Computer Engineering at the University of Peradeniya. My passion lies in research, AI development, and automation. I thrive on exploring new technologies and pushing the boundaries of what's possible in the realm of artificial intelligence.
71+
72+
Whether it's diving into the intricacies of machine learning algorithms or crafting seamless user experiences through full stack development, I'm driven by a relentless curiosity and a desire to make meaningful contributions to the field of technology.
73+
74+
Feel free to reach out if you'd like to collaborate on exciting projects or discuss ideas at the intersection of technology and innovation.
75+
76+
Connect with me on [LinkedIn](Your_LinkedIn_Profile_URL) | Follow me on [Twitter](Your_Twitter_Profile_URL)
77+
78+
## 🛠 Skills
79+
- **Full Stack Development**
80+
- **LLM Development** (Large Language Models)
81+
- **ML Development** (Machine Learning)
82+
## Authors
83+
84+
- [@KushanManahara](https://github.com/KushanManahara/)
85+
## Badges
86+
[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)
87+
88+
## 🔗 Links
89+
[![portfolio](https://img.shields.io/badge/my_portfolio-000?style=for-the-badge&logo=ko-fi&logoColor=white)](https://vercel.com/kushan-manaharas-projects/)
90+
[![linkedin](https://img.shields.io/badge/linkedin-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/kushan-manahara/)
91+
92+
## Screenshots
93+
94+
- ### Login Page ![App Screenshot](https://github.com/KushanManahara/Oxford-Nanopore-RNA-Analysis-Tool/assets/73605929/4f9939fa-db98-435b-a109-1a31945a5f02)
95+
96+
- ### Blasting Page ![blasting page](https://github.com/KushanManahara/Oxford-Nanopore-RNA-Analysis-Tool/assets/73605929/7a41c018-5716-4b2f-9b76-31fd2ed239e2)

Web UI/app.py

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
import paramiko
2+
import streamlit as st
3+
import time
4+
5+
6+
def login():
7+
def on_login():
8+
try:
9+
ssh_client = create_ssh_connection(host, username, password)
10+
11+
toast_placeholder = st.empty()
12+
toast_placeholder.success("Login successful!")
13+
ssh_client.close()
14+
time.sleep(2)
15+
toast_placeholder.empty()
16+
17+
title_placeholder.empty()
18+
host_placeholder.empty()
19+
username_placeholder.empty()
20+
password_placeholder.empty()
21+
st.session_state.logged_in = True
22+
st.session_state.host = host
23+
st.session_state.username = username
24+
st.session_state.password = password
25+
st.session_state.ssh_client = ssh_client
26+
27+
except Exception as e:
28+
st.error(f"Login failed: {e}")
29+
30+
title_placeholder = st.empty()
31+
host_placeholder = st.empty()
32+
username_placeholder = st.empty()
33+
password_placeholder = st.empty()
34+
login_button_placeholder = st.empty()
35+
36+
title_placeholder.title("Login Page")
37+
38+
host = host_placeholder.text_input("Host")
39+
username = username_placeholder.text_input("Username")
40+
password = password_placeholder.text_input("Password", type="password")
41+
42+
if host and username and password:
43+
print(host)
44+
print(username)
45+
print(password)
46+
if not login_button_placeholder.button("Login", on_click=on_login):
47+
st.error("Invalid hostname, username or password, . Please try again.")
48+
49+
50+
def create_ssh_connection(host, username, password):
51+
ssh_client = paramiko.SSHClient()
52+
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
53+
ssh_client.connect(hostname=host, username=username, password=password)
54+
return ssh_client
55+
56+
57+
def create_project_dir(ssh_client, folder_name):
58+
ssh_client.exec_command(f"mkdir -p WebApp/{folder_name}")
59+
ssh_client.exec_command(f"mkdir -p WebApp/{folder_name}/test-dir")
60+
ssh_client.exec_command(f"mkdir -p WebApp/{folder_name}/EXPORTS")
61+
ssh_client.exec_command(
62+
f'echo "Hello World" > WebApp/{folder_name}/hello-world.txt'
63+
)
64+
65+
66+
def download_file(ssh_client, remote_path, local_path):
67+
sftp_client = ssh_client.open_sftp()
68+
sftp_client.get(remote_path, local_path)
69+
sftp_client.close()
70+
71+
72+
def create_zip_folder(ssh_client, folder_path, zip_file_path):
73+
# Execute the zip command remotely to create the zip file
74+
ssh_client.exec_command(f"zip -r {zip_file_path} {folder_path}")
75+
76+
77+
def project_init():
78+
st.title("Project Init Page")
79+
st.write("Welcome to the Project Init Page! You can start project init here.")
80+
81+
82+
def blasting(host, username, password):
83+
if not st.button("Back", on_click=logout):
84+
st.title("Blasting Page")
85+
folder_name = st.text_input("Project Name")
86+
uploaded_file = st.file_uploader("Upload FAST5 file as a zip", type=["zip"])
87+
88+
project_status = st.empty()
89+
90+
if st.button("Start Blasting"):
91+
try:
92+
project_status.info("Project initializing started...")
93+
ssh_client = create_ssh_connection(host, username, password)
94+
create_project_dir(ssh_client, folder_name)
95+
project_status.success(
96+
f"Project '{folder_name}' is initiated successfully!"
97+
)
98+
time.sleep(1)
99+
project_status.empty()
100+
101+
ssh_client.close()
102+
except Exception as e:
103+
project_status.error(f"An error occurred: {e}")
104+
time.sleep(3)
105+
project_status.empty()
106+
107+
if uploaded_file is not None:
108+
project_status.empty()
109+
try:
110+
project_status.info("Uploading project files...")
111+
ssh_client = create_ssh_connection(host, username, password)
112+
with ssh_client.open_sftp() as sftp:
113+
with sftp.file(
114+
f"WebApp/{folder_name}/{uploaded_file.name}", "wb"
115+
) as f:
116+
f.write(uploaded_file.getvalue())
117+
project_status.success("Project file are uploaded successfully!")
118+
119+
# blasting is started
120+
time.sleep(1)
121+
project_status.info("Blasting started...")
122+
time.sleep(2)
123+
project_status.success("Blasting Completed...")
124+
time.sleep(2)
125+
project_status.empty()
126+
127+
# TODO:
128+
129+
# create a zip file of whole final project
130+
create_zip_folder(
131+
ssh_client,
132+
f"WebApp/{folder_name}",
133+
f"WebApp/{folder_name}/EXPORTS/exports.zip",
134+
)
135+
136+
project_status.info("Completed project files are Downloading...")
137+
138+
# Download the project export file from the remote server
139+
download_file(
140+
ssh_client,
141+
f"WebApp/{folder_name}/EXPORTS/exports.zip",
142+
"exports.zip",
143+
)
144+
145+
project_status.success(
146+
"Completed project files are Downloaded successfully!"
147+
)
148+
149+
except Exception as e:
150+
project_status.error(f"An error occurred while uploading file: {e}")
151+
ssh_client.close()
152+
153+
154+
# Main function
155+
def logout():
156+
st.session_state.logged_in = False
157+
158+
159+
def main():
160+
global ssh_client, host, username, password
161+
162+
if "logged_in" not in st.session_state:
163+
host = "localhost"
164+
st.session_state.logged_in = False
165+
166+
if not st.session_state.logged_in:
167+
login()
168+
169+
else:
170+
blasting(
171+
st.session_state.host, st.session_state.username, st.session_state.password
172+
)
173+
174+
175+
# Run the main function
176+
if __name__ == "__main__":
177+
main()

Web UI/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
paramiko==3.4.0
2+
streamlit==1.32.2
3+
pyscp==1.1.20

0 commit comments

Comments
 (0)