Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
24 changes: 23 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,34 @@
app = Flask(__name__)
CORS(app) # Enable CORS for all routes

@app.route('/', methods=['GET'])
def health_check():
"""
Health check endpoint for Kubernetes liveness/readiness probes.
Returns: JSON with service status
"""
return jsonify({
'status': 'healthy',
'service': 'RNA Alignment API',
'environment': os.getenv('ENVIRONMENT', 'unknown')
}), 200


@app.route('/<identifier>', methods=['GET'])
def get_msa_data(identifier):
"""
Get MSA data by identifier from S3, parsed and formatted for the MSA viewer.
URL pattern: /{identifier}
Returns: JSON data structure ready for MSA viewer consumption
"""
# Prevent health check route from being treated as an identifier
if identifier in ['health', 'favicon.ico']:
return jsonify({
'status': 'error',
'message': 'Invalid identifier',
'data': None
}), 400

try:
# Get .sto file content from S3
sto_content = get_seed_file_from_s3(identifier)
Expand All @@ -40,7 +61,8 @@ def get_msa_data(identifier):
'identifier': identifier,
'consensus': msa_data['consensus'],
'notation': msa_data.get('notation'),
'sequences': msa_data.get('sequences')
'sequences': msa_data.get('sequences'),
'sequenceCount': len(msa_data.get('sequences', []))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Happy to test it once it’s deployed if you’d like.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Just waiting on the Rfam Docker image to rebuild with the updated alignment viewer :)

}
}

Expand Down