|
a |
|
b/docs/aitrika/usage.mdx |
|
|
1 |
--- |
|
|
2 |
title: 'Usage' |
|
|
3 |
description: 'Use AItrika' |
|
|
4 |
icon: 'code' |
|
|
5 |
--- |
|
|
6 |
|
|
|
7 |
## 🔍 Usage |
|
|
8 |
|
|
|
9 |
You can easily get informations of a paper by passing a PubMed ID: |
|
|
10 |
|
|
|
11 |
```python |
|
|
12 |
from aitrika.engine.aitrika import OnlineAItrika |
|
|
13 |
aitrika_engine = OnlineAItrika(pubmed_id=pubmed_id) |
|
|
14 |
title = aitrika_engine.get_title() |
|
|
15 |
print(title) |
|
|
16 |
``` |
|
|
17 |
|
|
|
18 |
Or you can parse a local pdf: |
|
|
19 |
|
|
|
20 |
```python |
|
|
21 |
from aitrika.engine.aitrika import LocalAItrika |
|
|
22 |
aitrika_engine = LocalAItrika(pdf_path = pdf_path) |
|
|
23 |
title = aitrika_engine.get_title() |
|
|
24 |
print(title) |
|
|
25 |
``` |
|
|
26 |
|
|
|
27 |
``` |
|
|
28 |
Breast cancer genes: beyond BRCA1 and BRCA2. |
|
|
29 |
``` |
|
|
30 |
|
|
|
31 |
You can get other informations, like the associations between genes and diseases: |
|
|
32 |
|
|
|
33 |
```python |
|
|
34 |
associations = aitrika_engine.get_associations() |
|
|
35 |
``` |
|
|
36 |
|
|
|
37 |
``` |
|
|
38 |
[ |
|
|
39 |
{ |
|
|
40 |
"gene": "BRIP1", |
|
|
41 |
"disease": "Breast Neoplasms" |
|
|
42 |
}, |
|
|
43 |
{ |
|
|
44 |
"gene": "PTEN", |
|
|
45 |
"disease": "Breast Neoplasms" |
|
|
46 |
}, |
|
|
47 |
{ |
|
|
48 |
"gene": "CHEK2", |
|
|
49 |
"disease": "Breast Neoplasms" |
|
|
50 |
}, |
|
|
51 |
] |
|
|
52 |
... |
|
|
53 |
``` |
|
|
54 |
|
|
|
55 |
Or you can get a nice formatted DataFrame: |
|
|
56 |
|
|
|
57 |
```python |
|
|
58 |
associations = aitrika_engine.associations(dataframe = True) |
|
|
59 |
``` |
|
|
60 |
|
|
|
61 |
``` |
|
|
62 |
gene disease |
|
|
63 |
0 BRIP1 Breast Neoplasms |
|
|
64 |
1 PTEN Breast Neoplasms |
|
|
65 |
2 CHEK2 Breast Neoplasms |
|
|
66 |
... |
|
|
67 |
``` |
|
|
68 |
|
|
|
69 |
With the power of RAG, you can query your document: |
|
|
70 |
|
|
|
71 |
```python |
|
|
72 |
## Prepare the documents |
|
|
73 |
documents = generate_documents(content=abstract) |
|
|
74 |
|
|
|
75 |
## Set the LLM |
|
|
76 |
llm = GroqLLM(documents=documents, api_key=os.getenv("GROQ_API_KEY")) |
|
|
77 |
|
|
|
78 |
## Query your document |
|
|
79 |
query = "Is BRCA1 associated with breast cancer?" |
|
|
80 |
print(llm.query(query=query)) |
|
|
81 |
``` |
|
|
82 |
|
|
|
83 |
``` |
|
|
84 |
The provided text suggests that BRCA1 is associated with breast cancer, as it is listed among the high-penetrance genes identified in family linkage studies as responsible for inherited syndromes of breast cancer. |
|
|
85 |
``` |
|
|
86 |
|
|
|
87 |
Or you can extract other informations: |
|
|
88 |
|
|
|
89 |
```python |
|
|
90 |
results = engine.extract_results(llm=llm) |
|
|
91 |
print(results) |
|
|
92 |
``` |
|
|
93 |
|
|
|
94 |
``` |
|
|
95 |
** RESULTS ** |
|
|
96 |
|
|
|
97 |
- High-penetrance genes - BRCA1, BRCA2, PTEN, TP53 - responsible for inherited syndromes |
|
|
98 |
- Moderate-penetrance genes - CHEK2, ATM, BRIP1, PALB2, RAD51C - associated with moderate BC risk |
|
|
99 |
- Low-penetrance alleles - common alleles - associated with slightly increased or decreased risk of BC |
|
|
100 |
- Current clinical practice - high-penetrance genes - widely used |
|
|
101 |
- Future prospect - all familial breast cancer genes - to be included in genetic test |
|
|
102 |
- Research need - clinical management - of moderate and low-risk variants |
|
|
103 |
``` |