Skip to content

Commit 8d73d46

Browse files
committed
Python apollo
1 parent b3b17c8 commit 8d73d46

1 file changed

Lines changed: 58 additions & 44 deletions

File tree

.github/workflows/python-apollo.yml

Lines changed: 58 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -69,53 +69,67 @@ jobs:
6969
export ARROW_GLOBAL_CONFIG_PATH=$(pwd)/test-data/local-apollo2-arrow.yml
7070
./bootstrap_apollo.sh --nodocker
7171
72-
- name: Diagnose organism state
72+
- name: Diagnose load_gff3 failure
7373
run: |
7474
cd python-apollo
7575
export ARROW_GLOBAL_CONFIG_PATH=$(pwd)/test-data/local-apollo2-arrow.yml
76-
echo "=== Organisms ==="
77-
arrow organisms get_organisms
78-
echo "=== Sequences for test_organism ==="
79-
arrow organisms get_sequences test_organism || true
80-
echo "=== Features for test_organism on Merlin ==="
81-
arrow annotations get_features test_organism Merlin || true
82-
83-
echo ""
84-
echo "=== Direct curl: addTranscript on test_organism ==="
85-
ORG_DIR=$(cd .. && pwd)/python-apollo/apollo_shared_dir
86-
curl -s -X POST http://localhost:8080/apollo/annotationEditor/addTranscript \
87-
-H 'Content-Type: application/json' \
88-
-d "{
89-
\"username\": \"admin@local.host\",
90-
\"password\": \"password\",
91-
\"organism\": \"test_organism\",
92-
\"sequence\": \"Merlin\",
93-
\"suppressHistory\": true,
94-
\"suppressEvents\": true,
95-
\"features\": [{
96-
\"location\": {\"fmin\": 100, \"fmax\": 500, \"strand\": 1},
97-
\"type\": {\"name\": \"mRNA\", \"cv\": {\"name\": \"sequence\"}},
98-
\"children\": [{
99-
\"location\": {\"fmin\": 100, \"fmax\": 500, \"strand\": 1},
100-
\"type\": {\"name\": \"exon\", \"cv\": {\"name\": \"sequence\"}}
101-
}]
102-
}]
103-
}" || true
104-
105-
echo ""
106-
echo "=== Direct curl: addFeature on test_organism ==="
107-
curl -s -X POST http://localhost:8080/apollo/annotationEditor/addFeature \
108-
-H 'Content-Type: application/json' \
109-
-d "{
110-
\"username\": \"admin@local.host\",
111-
\"password\": \"password\",
112-
\"organism\": \"test_organism\",
113-
\"sequence\": \"Merlin\",
114-
\"features\": [{
115-
\"location\": {\"fmin\": 1000, \"fmax\": 2000, \"strand\": 1},
116-
\"type\": {\"name\": \"repeat_region\", \"cv\": {\"name\": \"sequence\"}}
117-
}]
118-
}" || true
76+
python3 -c "
77+
import traceback, json, sys
78+
try:
79+
from apollo import ApolloInstance
80+
wa = ApolloInstance('http://localhost:8080/apollo', 'admin@local.host', 'password')
81+
82+
print('=== Organisms ===')
83+
orgs = wa.organisms.get_organisms()
84+
for o in orgs:
85+
print(f\" {o.get('commonName')}: sequences={o.get('sequences')}\")
86+
87+
print()
88+
print('=== Attempting load_gff3 with full traceback ===')
89+
print('Installed apollo version:', end=' ')
90+
import apollo; print(getattr(apollo, '__version__', 'unknown'))
91+
print('BCBio.GFF available:', end=' ')
92+
try:
93+
from BCBio import GFF
94+
print('yes')
95+
except ImportError as e:
96+
print(f'NO - {e}')
97+
98+
print()
99+
print('=== Manual GFF3 parsing test ===')
100+
from BCBio import GFF
101+
with open('test-data/mrna-top.gff') as f:
102+
for rec in GFF.parse(f):
103+
print(f'Record: {rec.id}, features: {len(rec.features)}')
104+
for feat in rec.features[:2]:
105+
print(f' Feature: {feat.id}, type: {feat.type}, loc: {feat.location}')
106+
107+
print()
108+
print('=== Manual addTranscript via python-apollo ===')
109+
wa.annotations.set_sequence('test_organism', 'Merlin')
110+
result = wa.annotations.add_transcripts([{
111+
'location': {'fmin': 5000, 'fmax': 6000, 'strand': 1},
112+
'type': {'name': 'mRNA', 'cv': {'name': 'sequence'}},
113+
'children': [{
114+
'location': {'fmin': 5000, 'fmax': 6000, 'strand': 1},
115+
'type': {'name': 'exon', 'cv': {'name': 'sequence'}}
116+
}]
117+
}])
118+
print(f'addTranscript result: {json.dumps(result, indent=2)[:500]}')
119+
120+
print()
121+
print('=== Full load_gff3 attempt with traceback ===')
122+
try:
123+
feature_data = wa.annotations.load_gff3('test_organism', 'test-data/mrna-top.gff')
124+
print(f'load_gff3 returned: {feature_data}')
125+
except Exception as e:
126+
print(f'load_gff3 raised: {type(e).__name__}: {e}')
127+
traceback.print_exc()
128+
129+
except Exception as e:
130+
print(f'DIAGNOSTIC FAILED: {type(e).__name__}: {e}')
131+
traceback.print_exc()
132+
" || true
119133
120134
echo ""
121135
echo "=== Apollo ERROR/WARN log lines ==="

0 commit comments

Comments
 (0)