biopygeon 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- biopygeon-0.1.0/PKG-INFO +133 -0
- biopygeon-0.1.0/README.md +106 -0
- biopygeon-0.1.0/bio_cli/__init__.py +4 -0
- biopygeon-0.1.0/bio_cli/commands/__init__.py +1 -0
- biopygeon-0.1.0/bio_cli/commands/ask.py +28 -0
- biopygeon-0.1.0/bio_cli/commands/auth.py +27 -0
- biopygeon-0.1.0/bio_cli/commands/bio.py +129 -0
- biopygeon-0.1.0/bio_cli/commands/chat.py +334 -0
- biopygeon-0.1.0/bio_cli/commands/lit.py +102 -0
- biopygeon-0.1.0/bio_cli/commands/omics.py +39 -0
- biopygeon-0.1.0/bio_cli/commands/publish.py +161 -0
- biopygeon-0.1.0/bio_cli/config.py +47 -0
- biopygeon-0.1.0/bio_cli/engines/__init__.py +1 -0
- biopygeon-0.1.0/bio_cli/engines/assistant.py +378 -0
- biopygeon-0.1.0/bio_cli/engines/biology.py +439 -0
- biopygeon-0.1.0/bio_cli/engines/literature.py +284 -0
- biopygeon-0.1.0/bio_cli/engines/omics.py +70 -0
- biopygeon-0.1.0/bio_cli/engines/q1_pipeline.py +201 -0
- biopygeon-0.1.0/bio_cli/engines/report_generator.py +193 -0
- biopygeon-0.1.0/bio_cli/main.py +19 -0
- biopygeon-0.1.0/bio_cli/parsers/__init__.py +1 -0
- biopygeon-0.1.0/bio_cli/parsers/generic.py +24 -0
- biopygeon-0.1.0/bio_cli/styles/nature.mplstyle +38 -0
- biopygeon-0.1.0/biopygeon.egg-info/PKG-INFO +133 -0
- biopygeon-0.1.0/biopygeon.egg-info/SOURCES.txt +29 -0
- biopygeon-0.1.0/biopygeon.egg-info/dependency_links.txt +1 -0
- biopygeon-0.1.0/biopygeon.egg-info/entry_points.txt +2 -0
- biopygeon-0.1.0/biopygeon.egg-info/requires.txt +16 -0
- biopygeon-0.1.0/biopygeon.egg-info/top_level.txt +1 -0
- biopygeon-0.1.0/pyproject.toml +43 -0
- biopygeon-0.1.0/setup.cfg +4 -0
biopygeon-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: biopygeon
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The Last Mile Publication Aggregator CLI
|
|
5
|
+
Author-email: Bio Dev <dev@example.com>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: typer>=0.9.0
|
|
12
|
+
Requires-Dist: rich>=13.0.0
|
|
13
|
+
Requires-Dist: pandas>=2.0.0
|
|
14
|
+
Requires-Dist: matplotlib>=3.7.0
|
|
15
|
+
Requires-Dist: scipy>=1.10.0
|
|
16
|
+
Requires-Dist: requests>=2.25.0
|
|
17
|
+
Requires-Dist: beautifulsoup4>=4.9.0
|
|
18
|
+
Requires-Dist: reportlab>=4.0.0
|
|
19
|
+
Requires-Dist: semanticscholar>=0.8.0
|
|
20
|
+
Requires-Dist: biopython>=1.80
|
|
21
|
+
Requires-Dist: matplotlib-venn>=0.11
|
|
22
|
+
Requires-Dist: primer3-py>=2.0.1
|
|
23
|
+
Requires-Dist: networkx>=3.0
|
|
24
|
+
Requires-Dist: seaborn>=0.12.0
|
|
25
|
+
Requires-Dist: pyvis>=0.3.1
|
|
26
|
+
Requires-Dist: jinja2>=3.1.2
|
|
27
|
+
|
|
28
|
+
# Bio-CLI (Bio-Data CLI)
|
|
29
|
+
**The Last Mile Publication Aggregator & Intelligent Bioinformatics Assistant**
|
|
30
|
+
|
|
31
|
+
Bio-CLI adalah alat antarmuka baris perintah (CLI) yang mengintegrasikan berbagai instrumen bioinformatika (seperti NCBI BLAST, ExPASy ProtParam, Enrichr) dengan agen kecerdasan buatan (Groq LLM). Alat ini dirancang untuk menjadi jembatan antara output mentah data biologis dan pembuatan visualisasi berstandar jurnal Q1 (seperti *Nature* dan *Science*).
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Fitur Utama
|
|
36
|
+
|
|
37
|
+
- 🤖 **Agen Asisten Cerdas (`bio-cli chat`)**: Mode obrolan interaktif yang digerakkan oleh AI untuk menjalankan analisis biologis dan menelusuri literatur menggunakan bahasa natural.
|
|
38
|
+
- 🔬 **Analisis Sekuens & Struktur**: Menghitung properti fisikokimia (ProtParam), mencari homologi (NCBI BLAST), dan membersihkan PDB untuk *molecular docking*.
|
|
39
|
+
- 📊 **Visualisasi Sekelas Jurnal**: Membuat *Enrichment Bubble Plot* dan *Venn Diagram* dengan palet warna khusus jurnal.
|
|
40
|
+
- 📚 **Pencarian Literatur**: Penelusuran cerdas jurnal *open-access* di berbagai sumber (Semantic Scholar, OpenAlex, PubMed) secara bersamaan.
|
|
41
|
+
- 📑 **Interpretasi PDF Otomatis**: Mensintesis hasil mentah (CSV/TXT) menjadi laporan eksekutif (PDF) berisi interpretasi biologis dari agen AI.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Panduan Memulai (Onboarding)
|
|
46
|
+
|
|
47
|
+
### 1. Instalasi
|
|
48
|
+
Pastikan Anda memiliki Python 3.9+ terinstal. Anda dapat menginstal (atau memperbarui) *Bio-CLI* menggunakan perintah:
|
|
49
|
+
```bash
|
|
50
|
+
pip install -e .
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 2. Pengenalan (Membuka Bantuan)
|
|
54
|
+
Kapan pun Anda kebingungan tentang apa yang dapat dilakukan oleh *Bio-CLI*, panggil menu bantuan utama:
|
|
55
|
+
```bash
|
|
56
|
+
bio-cli --help
|
|
57
|
+
```
|
|
58
|
+
Atau akses bantuan untuk sub-perintah spesifik, misalnya: `bio-cli bio --help`.
|
|
59
|
+
|
|
60
|
+
### 3. Mengonfigurasi API Keys (Autentikasi)
|
|
61
|
+
Agar sistem berjalan maksimal (terutama untuk agen AI dan batas penelusuran literatur), Anda perlu mengonfigurasi API Keys.
|
|
62
|
+
Anda memerlukan:
|
|
63
|
+
- **Groq API Key** (Untuk kecerdasan buatan / AI Chat)
|
|
64
|
+
- **Semantic Scholar (S2) API Key** (Opsional, untuk batas pencarian jurnal yang lebih tinggi)
|
|
65
|
+
|
|
66
|
+
**Cara memasukkan Key:**
|
|
67
|
+
```bash
|
|
68
|
+
bio-cli auth set-key --groq-key "gsk_xxxx..." --s2-key "xxxx..."
|
|
69
|
+
```
|
|
70
|
+
Untuk memverifikasi apakah key sudah tersimpan:
|
|
71
|
+
```bash
|
|
72
|
+
bio-cli auth status
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Interaksi Pengguna & Cara Penggunaan
|
|
78
|
+
|
|
79
|
+
### A. Mode Obrolan AI (Rekomendasi)
|
|
80
|
+
Ini adalah cara terbaik untuk berinteraksi. Alih-alih mengingat perintah yang panjang, Anda cukup "berbincang" dengan asisten virtual.
|
|
81
|
+
```bash
|
|
82
|
+
bio-cli chat
|
|
83
|
+
```
|
|
84
|
+
**Contoh percakapan:**
|
|
85
|
+
- *"Cari 10 jurnal terbaru tentang terapi sel punca."*
|
|
86
|
+
- *"Jalankan BLAST untuk sekuens KLLRMAYA."*
|
|
87
|
+
- *"Berapa bobot molekul dan pI dari sekuens protein MLRYAIL?"*
|
|
88
|
+
- *"Buat plot pengayaan (Enrichment) dari file gen_saya.csv."*
|
|
89
|
+
|
|
90
|
+
Setelah AI menyelesaikan tugasnya, ia akan otomatis menawarkan untuk **menyimpan data mentah (CSV/TXT)** dan **membangun laporan PDF interpretatif** untuk Anda.
|
|
91
|
+
|
|
92
|
+
### B. Mode Perintah Manual (Klasik)
|
|
93
|
+
|
|
94
|
+
Jika Anda lebih suka mengeksekusi satu baris perintah secara langsung:
|
|
95
|
+
|
|
96
|
+
**1. Pencarian Literatur**
|
|
97
|
+
```bash
|
|
98
|
+
bio-cli lit search "crispr cas9" --limit 10 --sort date
|
|
99
|
+
bio-cli lit export
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**2. Analisis Biologi (Protein & DNA)**
|
|
103
|
+
```bash
|
|
104
|
+
# Menghitung properti fisikokimia protein
|
|
105
|
+
bio-cli bio protparam "MLRYA"
|
|
106
|
+
|
|
107
|
+
# Melakukan NCBI BLAST
|
|
108
|
+
bio-cli bio blast "MLRYA" --program blastp
|
|
109
|
+
|
|
110
|
+
# Mencari file PDB
|
|
111
|
+
bio-cli bio pdb "hemoglobin"
|
|
112
|
+
# Mempersiapkan PDB untuk docking (membersihkan air/heteroatom)
|
|
113
|
+
bio-cli bio prepare-docking protein.pdb clean_protein.pdb
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**3. Analisis Omics & Ekspresi Gen**
|
|
117
|
+
```bash
|
|
118
|
+
# Mendapatkan jalur biologi (Pathways) dari Enrichr API
|
|
119
|
+
bio-cli omics enrich input_genes.csv output_pathways.csv
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**4. Publikasi & Visualisasi**
|
|
123
|
+
```bash
|
|
124
|
+
# Membuat Bubble Plot (Cocok untuk Enrichment)
|
|
125
|
+
bio-cli publish bubble enrich_results.csv --out plot_nature.tiff --journal nature
|
|
126
|
+
|
|
127
|
+
# Membuat Diagram Venn
|
|
128
|
+
bio-cli publish venn list1.csv list2.csv --out venn_science.tiff --journal science
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
*Dikembangkan untuk mempercepat riset biologi dari skala raw-data menuju publikasi akhir.*
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Bio-CLI (Bio-Data CLI)
|
|
2
|
+
**The Last Mile Publication Aggregator & Intelligent Bioinformatics Assistant**
|
|
3
|
+
|
|
4
|
+
Bio-CLI adalah alat antarmuka baris perintah (CLI) yang mengintegrasikan berbagai instrumen bioinformatika (seperti NCBI BLAST, ExPASy ProtParam, Enrichr) dengan agen kecerdasan buatan (Groq LLM). Alat ini dirancang untuk menjadi jembatan antara output mentah data biologis dan pembuatan visualisasi berstandar jurnal Q1 (seperti *Nature* dan *Science*).
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Fitur Utama
|
|
9
|
+
|
|
10
|
+
- 🤖 **Agen Asisten Cerdas (`bio-cli chat`)**: Mode obrolan interaktif yang digerakkan oleh AI untuk menjalankan analisis biologis dan menelusuri literatur menggunakan bahasa natural.
|
|
11
|
+
- 🔬 **Analisis Sekuens & Struktur**: Menghitung properti fisikokimia (ProtParam), mencari homologi (NCBI BLAST), dan membersihkan PDB untuk *molecular docking*.
|
|
12
|
+
- 📊 **Visualisasi Sekelas Jurnal**: Membuat *Enrichment Bubble Plot* dan *Venn Diagram* dengan palet warna khusus jurnal.
|
|
13
|
+
- 📚 **Pencarian Literatur**: Penelusuran cerdas jurnal *open-access* di berbagai sumber (Semantic Scholar, OpenAlex, PubMed) secara bersamaan.
|
|
14
|
+
- 📑 **Interpretasi PDF Otomatis**: Mensintesis hasil mentah (CSV/TXT) menjadi laporan eksekutif (PDF) berisi interpretasi biologis dari agen AI.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Panduan Memulai (Onboarding)
|
|
19
|
+
|
|
20
|
+
### 1. Instalasi
|
|
21
|
+
Pastikan Anda memiliki Python 3.9+ terinstal. Anda dapat menginstal (atau memperbarui) *Bio-CLI* menggunakan perintah:
|
|
22
|
+
```bash
|
|
23
|
+
pip install -e .
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 2. Pengenalan (Membuka Bantuan)
|
|
27
|
+
Kapan pun Anda kebingungan tentang apa yang dapat dilakukan oleh *Bio-CLI*, panggil menu bantuan utama:
|
|
28
|
+
```bash
|
|
29
|
+
bio-cli --help
|
|
30
|
+
```
|
|
31
|
+
Atau akses bantuan untuk sub-perintah spesifik, misalnya: `bio-cli bio --help`.
|
|
32
|
+
|
|
33
|
+
### 3. Mengonfigurasi API Keys (Autentikasi)
|
|
34
|
+
Agar sistem berjalan maksimal (terutama untuk agen AI dan batas penelusuran literatur), Anda perlu mengonfigurasi API Keys.
|
|
35
|
+
Anda memerlukan:
|
|
36
|
+
- **Groq API Key** (Untuk kecerdasan buatan / AI Chat)
|
|
37
|
+
- **Semantic Scholar (S2) API Key** (Opsional, untuk batas pencarian jurnal yang lebih tinggi)
|
|
38
|
+
|
|
39
|
+
**Cara memasukkan Key:**
|
|
40
|
+
```bash
|
|
41
|
+
bio-cli auth set-key --groq-key "gsk_xxxx..." --s2-key "xxxx..."
|
|
42
|
+
```
|
|
43
|
+
Untuk memverifikasi apakah key sudah tersimpan:
|
|
44
|
+
```bash
|
|
45
|
+
bio-cli auth status
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Interaksi Pengguna & Cara Penggunaan
|
|
51
|
+
|
|
52
|
+
### A. Mode Obrolan AI (Rekomendasi)
|
|
53
|
+
Ini adalah cara terbaik untuk berinteraksi. Alih-alih mengingat perintah yang panjang, Anda cukup "berbincang" dengan asisten virtual.
|
|
54
|
+
```bash
|
|
55
|
+
bio-cli chat
|
|
56
|
+
```
|
|
57
|
+
**Contoh percakapan:**
|
|
58
|
+
- *"Cari 10 jurnal terbaru tentang terapi sel punca."*
|
|
59
|
+
- *"Jalankan BLAST untuk sekuens KLLRMAYA."*
|
|
60
|
+
- *"Berapa bobot molekul dan pI dari sekuens protein MLRYAIL?"*
|
|
61
|
+
- *"Buat plot pengayaan (Enrichment) dari file gen_saya.csv."*
|
|
62
|
+
|
|
63
|
+
Setelah AI menyelesaikan tugasnya, ia akan otomatis menawarkan untuk **menyimpan data mentah (CSV/TXT)** dan **membangun laporan PDF interpretatif** untuk Anda.
|
|
64
|
+
|
|
65
|
+
### B. Mode Perintah Manual (Klasik)
|
|
66
|
+
|
|
67
|
+
Jika Anda lebih suka mengeksekusi satu baris perintah secara langsung:
|
|
68
|
+
|
|
69
|
+
**1. Pencarian Literatur**
|
|
70
|
+
```bash
|
|
71
|
+
bio-cli lit search "crispr cas9" --limit 10 --sort date
|
|
72
|
+
bio-cli lit export
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**2. Analisis Biologi (Protein & DNA)**
|
|
76
|
+
```bash
|
|
77
|
+
# Menghitung properti fisikokimia protein
|
|
78
|
+
bio-cli bio protparam "MLRYA"
|
|
79
|
+
|
|
80
|
+
# Melakukan NCBI BLAST
|
|
81
|
+
bio-cli bio blast "MLRYA" --program blastp
|
|
82
|
+
|
|
83
|
+
# Mencari file PDB
|
|
84
|
+
bio-cli bio pdb "hemoglobin"
|
|
85
|
+
# Mempersiapkan PDB untuk docking (membersihkan air/heteroatom)
|
|
86
|
+
bio-cli bio prepare-docking protein.pdb clean_protein.pdb
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**3. Analisis Omics & Ekspresi Gen**
|
|
90
|
+
```bash
|
|
91
|
+
# Mendapatkan jalur biologi (Pathways) dari Enrichr API
|
|
92
|
+
bio-cli omics enrich input_genes.csv output_pathways.csv
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**4. Publikasi & Visualisasi**
|
|
96
|
+
```bash
|
|
97
|
+
# Membuat Bubble Plot (Cocok untuk Enrichment)
|
|
98
|
+
bio-cli publish bubble enrich_results.csv --out plot_nature.tiff --journal nature
|
|
99
|
+
|
|
100
|
+
# Membuat Diagram Venn
|
|
101
|
+
bio-cli publish venn list1.csv list2.csv --out venn_science.tiff --journal science
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
*Dikembangkan untuk mempercepat riset biologi dari skala raw-data menuju publikasi akhir.*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Kosong untuk inisialisasi package
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
from rich.console import Console
|
|
3
|
+
from rich.panel import Panel
|
|
4
|
+
|
|
5
|
+
app = typer.Typer(no_args_is_help=True)
|
|
6
|
+
console = Console()
|
|
7
|
+
|
|
8
|
+
@app.callback(invoke_without_command=True)
|
|
9
|
+
def ask(
|
|
10
|
+
ctx: typer.Context,
|
|
11
|
+
prompt: str = typer.Argument(..., help="Pertanyaan Anda menggunakan bahasa alami")
|
|
12
|
+
):
|
|
13
|
+
"""
|
|
14
|
+
Asisten Peneliti Virtual (berbasis LLM Groq) untuk memandu penggunaan bio-cli.
|
|
15
|
+
"""
|
|
16
|
+
if ctx.invoked_subcommand is not None:
|
|
17
|
+
return
|
|
18
|
+
|
|
19
|
+
console.print("[bold blue][AI][/bold blue] Memproses pertanyaan Anda...")
|
|
20
|
+
|
|
21
|
+
from bio_cli.engines.assistant import ask_groq
|
|
22
|
+
|
|
23
|
+
try:
|
|
24
|
+
jawaban = ask_groq(prompt)
|
|
25
|
+
console.print(Panel(jawaban, title="[bold green]Saran Asisten", expand=False))
|
|
26
|
+
except Exception as e:
|
|
27
|
+
console.print(f"[bold red][Error][/bold red] {str(e)}")
|
|
28
|
+
raise typer.Exit(code=1)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
from rich.console import Console
|
|
3
|
+
|
|
4
|
+
app = typer.Typer(no_args_is_help=True)
|
|
5
|
+
console = Console()
|
|
6
|
+
|
|
7
|
+
@app.command("set-key")
|
|
8
|
+
def auth(
|
|
9
|
+
groq_key: str = typer.Option(None, "--groq-key", help="API Key dari platform Groq Cloud"),
|
|
10
|
+
s2_key: str = typer.Option(None, "--s2-key", help="API Key dari platform Semantic Scholar")
|
|
11
|
+
):
|
|
12
|
+
"""
|
|
13
|
+
Menyimpan kredensial API secara lokal untuk fitur cerdas.
|
|
14
|
+
"""
|
|
15
|
+
from bio_cli.config import set_groq_key, set_s2_key
|
|
16
|
+
try:
|
|
17
|
+
if groq_key:
|
|
18
|
+
set_groq_key(groq_key)
|
|
19
|
+
console.print("[bold green][OK][/bold green] Kunci Groq API berhasil disimpan secara lokal.")
|
|
20
|
+
if s2_key:
|
|
21
|
+
set_s2_key(s2_key)
|
|
22
|
+
console.print("[bold green][OK][/bold green] Kunci Semantic Scholar API berhasil disimpan secara lokal.")
|
|
23
|
+
|
|
24
|
+
if not groq_key and not s2_key:
|
|
25
|
+
console.print("[!] Tidak ada argumen key yang dimasukkan. Gunakan --help untuk melihat opsi.")
|
|
26
|
+
except Exception as e:
|
|
27
|
+
console.print(f"[bold red][Error][/bold red] Gagal menyimpan kunci: {e}")
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
from rich.console import Console
|
|
3
|
+
from rich.table import Table
|
|
4
|
+
|
|
5
|
+
app = typer.Typer(help="Analisis Sekuens & Struktur Biologi", no_args_is_help=True)
|
|
6
|
+
console = Console()
|
|
7
|
+
|
|
8
|
+
@app.command("protparam")
|
|
9
|
+
def protparam(sequence: str):
|
|
10
|
+
"""Menghitung properti fisikokimia protein."""
|
|
11
|
+
from bio_cli.engines.biology import calculate_protparam
|
|
12
|
+
try:
|
|
13
|
+
with console.status("[bold blue]Menghitung parameter...[/bold blue]"):
|
|
14
|
+
res_str = calculate_protparam(sequence)
|
|
15
|
+
console.print("[bold cyan]Hasil ProtParam:[/bold cyan]")
|
|
16
|
+
console.print(res_str)
|
|
17
|
+
except Exception as e:
|
|
18
|
+
console.print(f"[bold red]Gagal analisis ProtParam:[/bold red] {e}")
|
|
19
|
+
|
|
20
|
+
@app.command("blast")
|
|
21
|
+
def blast(sequence: str, program: str = typer.Option("blastp", "--program", "-p", help="blastp atau blastn")):
|
|
22
|
+
"""Melakukan pencarian NCBI BLAST."""
|
|
23
|
+
from bio_cli.engines.biology import run_ncbi_blast
|
|
24
|
+
try:
|
|
25
|
+
with console.status(f"[bold blue]Menjalankan {program} di NCBI (ini bisa memakan waktu)...[/bold blue]") as status:
|
|
26
|
+
def update_status(msg):
|
|
27
|
+
status.update(f"[bold blue]{msg}[/bold blue]")
|
|
28
|
+
results = run_ncbi_blast(sequence, program=program, progress_callback=update_status)
|
|
29
|
+
|
|
30
|
+
if not results:
|
|
31
|
+
console.print("[!] Tidak ada homologi ditemukan.")
|
|
32
|
+
return
|
|
33
|
+
|
|
34
|
+
table = Table(title=f"Hasil BLAST ({len(results)} hits)", show_header=True)
|
|
35
|
+
table.add_column("Title", style="cyan")
|
|
36
|
+
table.add_column("E-value", style="magenta")
|
|
37
|
+
table.add_column("Identity", style="green")
|
|
38
|
+
for r in results:
|
|
39
|
+
table.add_row(r['title'], str(r['e_value']), r['identity'])
|
|
40
|
+
console.print(table)
|
|
41
|
+
except Exception as e:
|
|
42
|
+
console.print(f"[bold red]Gagal analisis BLAST:[/bold red] {e}")
|
|
43
|
+
|
|
44
|
+
@app.command("primer")
|
|
45
|
+
def primer_design(
|
|
46
|
+
sequence: str = typer.Argument(..., help="Sekuens DNA target"),
|
|
47
|
+
min_size: int = typer.Option(150, help="Ukuran minimal produk PCR"),
|
|
48
|
+
max_size: int = typer.Option(500, help="Ukuran maksimal produk PCR"),
|
|
49
|
+
num: int = typer.Option(5, help="Jumlah pasang primer yang dihasilkan")
|
|
50
|
+
):
|
|
51
|
+
"""
|
|
52
|
+
Desain pasangan primer PCR untuk suatu sekuens DNA menggunakan engine primer3.
|
|
53
|
+
"""
|
|
54
|
+
from bio_cli.engines.biology import design_pcr_primers
|
|
55
|
+
from rich.table import Table
|
|
56
|
+
try:
|
|
57
|
+
with console.status("[bold blue]Mendesain primer PCR...[/bold blue]"):
|
|
58
|
+
primers = design_pcr_primers(sequence, prod_size_min=min_size, prod_size_max=max_size, num_return=num)
|
|
59
|
+
|
|
60
|
+
if not primers:
|
|
61
|
+
console.print("[!] Tidak dapat menemukan primer yang cocok untuk kriteria tersebut.")
|
|
62
|
+
raise typer.Exit(1)
|
|
63
|
+
|
|
64
|
+
table = Table(title=f"Hasil Desain Primer PCR ({len(primers)} Pasang)", show_header=True)
|
|
65
|
+
table.add_column("No", style="dim", width=4)
|
|
66
|
+
table.add_column("Forward (Tm/GC%)", style="cyan")
|
|
67
|
+
table.add_column("Reverse (Tm/GC%)", style="magenta")
|
|
68
|
+
table.add_column("Product Size", style="green")
|
|
69
|
+
|
|
70
|
+
for p in primers:
|
|
71
|
+
fw_info = f"{p['forward_seq']}\n({p['forward_tm']}°C / {p['forward_gc']}%)"
|
|
72
|
+
rv_info = f"{p['reverse_seq']}\n({p['reverse_tm']}°C / {p['reverse_gc']}%)"
|
|
73
|
+
table.add_row(str(p['pair_id']), fw_info, rv_info, f"{p['product_size']} bp")
|
|
74
|
+
console.print(table)
|
|
75
|
+
|
|
76
|
+
except Exception as e:
|
|
77
|
+
console.print(f"[bold red]Gagal mendesain primer:[/bold red] {e}")
|
|
78
|
+
|
|
79
|
+
@app.command("pdb")
|
|
80
|
+
def pdb_search(query: str, limit: int = typer.Option(5, "--limit", "-l", help="Jumlah batas hasil")):
|
|
81
|
+
"""Mencari struktur protein di database PDB."""
|
|
82
|
+
from bio_cli.engines.biology import search_protein_structure
|
|
83
|
+
try:
|
|
84
|
+
with console.status(f"[bold blue]Mencari struktur '{query}' di NCBI PDB...[/bold blue]") as status:
|
|
85
|
+
def update_status(msg):
|
|
86
|
+
status.update(f"[bold blue]{msg}[/bold blue]")
|
|
87
|
+
results = search_protein_structure(query, max_results=limit, progress_callback=update_status)
|
|
88
|
+
|
|
89
|
+
if not results:
|
|
90
|
+
console.print(f"[!] Struktur untuk '{query}' tidak ditemukan.")
|
|
91
|
+
return
|
|
92
|
+
|
|
93
|
+
table = Table(title=f"Hasil Pencarian Struktur ({len(results)} PDB)", show_header=True)
|
|
94
|
+
table.add_column("PDB ID", style="cyan")
|
|
95
|
+
table.add_column("Judul", style="green")
|
|
96
|
+
table.add_column("Metode")
|
|
97
|
+
table.add_column("Resolusi", justify="right")
|
|
98
|
+
for r in results:
|
|
99
|
+
table.add_row(r.get("pdb_id", "N/A"), r.get("title", "No Title"), r.get("method", "Unknown"), str(r.get("resolution", "N/A")))
|
|
100
|
+
console.print(table)
|
|
101
|
+
except Exception as e:
|
|
102
|
+
console.print(f"[bold red]Gagal mencari struktur:[/bold red] {e}")
|
|
103
|
+
|
|
104
|
+
@app.command("prepare-docking")
|
|
105
|
+
def prepare_docking(input_path: str, output_path: str):
|
|
106
|
+
"""Mempersiapkan PDB untuk docking dengan menghapus molekul air & heteroatom."""
|
|
107
|
+
from bio_cli.engines.biology import clean_pdb_for_docking
|
|
108
|
+
try:
|
|
109
|
+
with console.status("[bold blue]Membersihkan file PDB...[/bold blue]"):
|
|
110
|
+
res_path = clean_pdb_for_docking(input_path, output_path)
|
|
111
|
+
console.print(f"[bold green][OK][/bold green] File docking siap di: {res_path}")
|
|
112
|
+
except Exception as e:
|
|
113
|
+
console.print(f"[bold red]Gagal membersihkan PDB:[/bold red] {e}")
|
|
114
|
+
|
|
115
|
+
@app.command("msa")
|
|
116
|
+
def msa(
|
|
117
|
+
input_file: str = typer.Argument(..., help="Path ke file FASTA input"),
|
|
118
|
+
output_file: str = typer.Option("alignment_result.fasta", "--output", "-o", help="Path tujuan penyimpanan file hasil FASTA")
|
|
119
|
+
):
|
|
120
|
+
"""Melakukan Multiple Sequence Alignment via EBI Clustal Omega."""
|
|
121
|
+
from bio_cli.engines.biology import run_ebi_clustalo
|
|
122
|
+
try:
|
|
123
|
+
with console.status(f"[bold blue]Menginisialisasi MSA ke server EBI...[/bold blue]") as status:
|
|
124
|
+
def update_status(msg):
|
|
125
|
+
status.update(f"[bold blue]{msg}[/bold blue]")
|
|
126
|
+
out_path = run_ebi_clustalo(input_file, output_file, progress_callback=update_status)
|
|
127
|
+
console.print(f"[bold green]Alignment selesai! Hasil disimpan di {out_path}[/bold green]")
|
|
128
|
+
except Exception as e:
|
|
129
|
+
console.print(f"[bold red]Gagal melakukan MSA:[/bold red] {e}")
|