generated from cepdnaclk/eYY-4yp-project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ae9776
commit 5622f04
Showing
4 changed files
with
279 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/venv | ||
cre.txt | ||
exports.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Oxford Nanopore | RNA Analysis Tool | ||
### Welcome to the Oxford Nanopore RNA Analysis Tool repository! | ||
|
||
## Overview | ||
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. | ||
## Features | ||
|
||
- **User-Friendly Interface:** Our web application offers an intuitive interface designed for ease of use. | ||
- **Nanopore Sequencing Support:** Analyze RNA data generated from Oxford Nanopore sequencing technology. | ||
- **Simple Workflow:** Perform various analyses and visualizations with just a few clicks. | ||
- **Accessible to Non-Programmers:** No programming knowledge required. Anyone can analyze RNA data effortlessly. | ||
- **Interactive Visualizations:** Explore your RNA data through interactive charts and graphs. | ||
|
||
|
||
## Getting Started | ||
|
||
To get started with our RNA Analysis Tool, follow these steps: | ||
|
||
1. Clone this repository to your local machine. | ||
``` | ||
git clone https://github.com/KushanManahara/Oxford-Nanopore-RNA-Analysis-Tool.git | ||
``` | ||
3. Navigate into the project repository. | ||
``` | ||
cd Oxford-Nanopore-RNA-Analysis-Tool | ||
``` | ||
4. Create a virtual environment (not necessary) | ||
|
||
In Windows | ||
``` | ||
python -m venv venv | ||
``` | ||
|
||
In Linux/MacOS | ||
``` | ||
python3 -m venv venv | ||
``` | ||
6. Install the necessary dependencies as specified in the `requirements.txt` file. | ||
``` | ||
pip install -r requirements.txt | ||
``` | ||
7. Run the web application using your preferred web server. | ||
``` | ||
streamlit run app.py | ||
``` | ||
## Usage Instructions | ||
- Log in to your server using the provided `host` `username` and `password`. | ||
- Navigate to the **blasting page**. | ||
- Upload your `raw files` as a `.zip` file. The zip file should contain two files, one starting with `'pass_'` and the other with `'fail_'`. | ||
- 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**. | ||
## Contributing | ||
|
||
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. | ||
## Support | ||
|
||
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 | ||
|
||
|
||
This project is licensed under the [MIT License](LICENSE). | ||
|
||
## Tech Stack | ||
|
||
- Python | ||
- Streamlit | ||
|
||
|
||
## 🚀 About Me | ||
### Kushan Manahara | ||
|
||
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. | ||
|
||
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. | ||
|
||
Feel free to reach out if you'd like to collaborate on exciting projects or discuss ideas at the intersection of technology and innovation. | ||
|
||
Connect with me on [LinkedIn](Your_LinkedIn_Profile_URL) | Follow me on [Twitter](Your_Twitter_Profile_URL) | ||
|
||
## 🛠 Skills | ||
- **Full Stack Development** | ||
- **LLM Development** (Large Language Models) | ||
- **ML Development** (Machine Learning) | ||
## Authors | ||
|
||
- [@KushanManahara](https://github.com/KushanManahara/) | ||
## Badges | ||
[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/) | ||
|
||
## 🔗 Links | ||
[![portfolio](https://img.shields.io/badge/my_portfolio-000?style=for-the-badge&logo=ko-fi&logoColor=white)](https://vercel.com/kushan-manaharas-projects/) | ||
[![linkedin](https://img.shields.io/badge/linkedin-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/kushan-manahara/) | ||
|
||
## Screenshots | ||
|
||
- ### Login Page ![App Screenshot](https://github.com/KushanManahara/Oxford-Nanopore-RNA-Analysis-Tool/assets/73605929/4f9939fa-db98-435b-a109-1a31945a5f02) | ||
|
||
- ### Blasting Page ![blasting page](https://github.com/KushanManahara/Oxford-Nanopore-RNA-Analysis-Tool/assets/73605929/7a41c018-5716-4b2f-9b76-31fd2ed239e2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
import paramiko | ||
import streamlit as st | ||
import time | ||
|
||
|
||
def login(): | ||
def on_login(): | ||
try: | ||
ssh_client = create_ssh_connection(host, username, password) | ||
|
||
toast_placeholder = st.empty() | ||
toast_placeholder.success("Login successful!") | ||
ssh_client.close() | ||
time.sleep(2) | ||
toast_placeholder.empty() | ||
|
||
title_placeholder.empty() | ||
host_placeholder.empty() | ||
username_placeholder.empty() | ||
password_placeholder.empty() | ||
st.session_state.logged_in = True | ||
st.session_state.host = host | ||
st.session_state.username = username | ||
st.session_state.password = password | ||
st.session_state.ssh_client = ssh_client | ||
|
||
except Exception as e: | ||
st.error(f"Login failed: {e}") | ||
|
||
title_placeholder = st.empty() | ||
host_placeholder = st.empty() | ||
username_placeholder = st.empty() | ||
password_placeholder = st.empty() | ||
login_button_placeholder = st.empty() | ||
|
||
title_placeholder.title("Login Page") | ||
|
||
host = host_placeholder.text_input("Host") | ||
username = username_placeholder.text_input("Username") | ||
password = password_placeholder.text_input("Password", type="password") | ||
|
||
if host and username and password: | ||
print(host) | ||
print(username) | ||
print(password) | ||
if not login_button_placeholder.button("Login", on_click=on_login): | ||
st.error("Invalid hostname, username or password, . Please try again.") | ||
|
||
|
||
def create_ssh_connection(host, username, password): | ||
ssh_client = paramiko.SSHClient() | ||
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | ||
ssh_client.connect(hostname=host, username=username, password=password) | ||
return ssh_client | ||
|
||
|
||
def create_project_dir(ssh_client, folder_name): | ||
ssh_client.exec_command(f"mkdir -p WebApp/{folder_name}") | ||
ssh_client.exec_command(f"mkdir -p WebApp/{folder_name}/test-dir") | ||
ssh_client.exec_command(f"mkdir -p WebApp/{folder_name}/EXPORTS") | ||
ssh_client.exec_command( | ||
f'echo "Hello World" > WebApp/{folder_name}/hello-world.txt' | ||
) | ||
|
||
|
||
def download_file(ssh_client, remote_path, local_path): | ||
sftp_client = ssh_client.open_sftp() | ||
sftp_client.get(remote_path, local_path) | ||
sftp_client.close() | ||
|
||
|
||
def create_zip_folder(ssh_client, folder_path, zip_file_path): | ||
# Execute the zip command remotely to create the zip file | ||
ssh_client.exec_command(f"zip -r {zip_file_path} {folder_path}") | ||
|
||
|
||
def project_init(): | ||
st.title("Project Init Page") | ||
st.write("Welcome to the Project Init Page! You can start project init here.") | ||
|
||
|
||
def blasting(host, username, password): | ||
if not st.button("Back", on_click=logout): | ||
st.title("Blasting Page") | ||
folder_name = st.text_input("Project Name") | ||
uploaded_file = st.file_uploader("Upload FAST5 file as a zip", type=["zip"]) | ||
|
||
project_status = st.empty() | ||
|
||
if st.button("Start Blasting"): | ||
try: | ||
project_status.info("Project initializing started...") | ||
ssh_client = create_ssh_connection(host, username, password) | ||
create_project_dir(ssh_client, folder_name) | ||
project_status.success( | ||
f"Project '{folder_name}' is initiated successfully!" | ||
) | ||
time.sleep(1) | ||
project_status.empty() | ||
|
||
ssh_client.close() | ||
except Exception as e: | ||
project_status.error(f"An error occurred: {e}") | ||
time.sleep(3) | ||
project_status.empty() | ||
|
||
if uploaded_file is not None: | ||
project_status.empty() | ||
try: | ||
project_status.info("Uploading project files...") | ||
ssh_client = create_ssh_connection(host, username, password) | ||
with ssh_client.open_sftp() as sftp: | ||
with sftp.file( | ||
f"WebApp/{folder_name}/{uploaded_file.name}", "wb" | ||
) as f: | ||
f.write(uploaded_file.getvalue()) | ||
project_status.success("Project file are uploaded successfully!") | ||
|
||
# blasting is started | ||
time.sleep(1) | ||
project_status.info("Blasting started...") | ||
time.sleep(2) | ||
project_status.success("Blasting Completed...") | ||
time.sleep(2) | ||
project_status.empty() | ||
|
||
# TODO: | ||
|
||
# create a zip file of whole final project | ||
create_zip_folder( | ||
ssh_client, | ||
f"WebApp/{folder_name}", | ||
f"WebApp/{folder_name}/EXPORTS/exports.zip", | ||
) | ||
|
||
project_status.info("Completed project files are Downloading...") | ||
|
||
# Download the project export file from the remote server | ||
download_file( | ||
ssh_client, | ||
f"WebApp/{folder_name}/EXPORTS/exports.zip", | ||
"exports.zip", | ||
) | ||
|
||
project_status.success( | ||
"Completed project files are Downloaded successfully!" | ||
) | ||
|
||
except Exception as e: | ||
project_status.error(f"An error occurred while uploading file: {e}") | ||
ssh_client.close() | ||
|
||
|
||
# Main function | ||
def logout(): | ||
st.session_state.logged_in = False | ||
|
||
|
||
def main(): | ||
global ssh_client, host, username, password | ||
|
||
if "logged_in" not in st.session_state: | ||
host = "localhost" | ||
st.session_state.logged_in = False | ||
|
||
if not st.session_state.logged_in: | ||
login() | ||
|
||
else: | ||
blasting( | ||
st.session_state.host, st.session_state.username, st.session_state.password | ||
) | ||
|
||
|
||
# Run the main function | ||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
paramiko==3.4.0 | ||
streamlit==1.32.2 | ||
pyscp==1.1.20 |