Mercurial > repos > tduigou > seq_to_db
annotate verification.py @ 2:dad2c4c3450a draft default tip
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit db4ac861e1d03fcdfe94321d858839124e493930-dirty
| author | tduigou |
|---|---|
| date | Wed, 23 Jul 2025 09:44:33 +0000 |
| parents | 9f845ccb1a9f |
| children |
| rev | line source |
|---|---|
|
0
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
1 from sqlalchemy import create_engine, text |
|
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
2 |
|
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
3 db_uri = "postgresql://postgres:RK17@localhost:5432/test_fragments_db" # adapt with your URI's DB |
|
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
4 engine = create_engine(db_uri) |
|
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
5 |
|
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
6 with engine.connect() as conn: |
|
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
7 result = conn.execute(text(""" |
|
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
8 SELECT fragment, sequence, annotation |
|
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
9 FROM sample |
|
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
10 ORDER BY fragment |
|
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
11 """)) |
|
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
12 |
|
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
13 print("Full contents of fragments in DB:\n") |
|
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
14 for row in result: |
|
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
15 print(f" Fragment: {row.fragment}") |
|
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
16 print(" Sequence:") |
|
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
17 print(row.sequence) |
|
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
18 print("\n Annotation:") |
|
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
19 print(row.annotation) |
|
9f845ccb1a9f
planemo upload for repository https://github.com/brsynth/galaxytools/tree/main/tools commit 3401816c949b538bd9c67e61cbe92badff6a4007-dirty
tduigou
parents:
diff
changeset
|
20 print("-" * 80) |
