Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.
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
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ EXPOSE 5003
COPY requirements.txt /app/
RUN /usr/local/bin/python -m pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
RUN pip list -V
RUN pip show pudupy
RUN pip show sbol2build

# Create uploads directory
RUN mkdir -p /app/uploads && \
Expand Down
109 changes: 44 additions & 65 deletions sbs_server/app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ def pin():
def get_data():
return app.send_static_file("data.json")

@app.route('/api/test_metadata_upload', methods = ['POST'])
def test_metadata_upload():
if request.method == 'POST':
f = request.files['file']


@app.route('/api/upload_sbs', methods = ['POST'])
def upload_file_from_sbs_post():
if 'Metadata' not in request.files:
Expand All @@ -44,6 +38,10 @@ def upload_file_from_sbs_post():
if params_file.filename == '':
return 'No selected Params file', 400
params_from_request = json.loads(params_file.read())
expected_params = ['fj_url', 'fj_token', 'sbh_url', 'sbh_token', 'sbh_collec', 'sbh_collec_desc', 'sbh_overwrite', 'fj_overwrite']
for param in expected_params:
if param not in params_from_request:
return 'Parameter ' + param + ' not found in request', 400

# instantiate the XDC class using the params_from_request dictionary
print(request.files['Metadata'])
Expand All @@ -62,13 +60,17 @@ def upload_file_from_sbs_post():
sbh_token = params_from_request['sbh_token'],
homespace = "https://synbiohub.org/gonza10v"
)



xdc.initialize()
xdc.log_in_sbh()
xdc.convert_to_sbol()
sbh_url = xdc.upload_to_sbh()
try:
xdc.initialize()
xdc.log_in_sbh()
xdc.log_in_fj()
xdc.convert_to_sbol()
xdc.generate_sbol_hash_map()
sbh_url = xdc.upload_to_sbh()
xdc.upload_to_fj()
except AttributeError as e:
return jsonify({"error": str(e)}), 400

sbs_upload_response_dict ={
"sbh_url": sbh_url,
Expand All @@ -91,6 +93,10 @@ def upload_file_from_sbs_post_up():
if params_file.filename == '':
return 'No selected Params file', 400
params_from_request = json.loads(params_file.read())
expected_params = ['fj_url', 'fj_user', 'fj_pass', 'sbh_url', 'sbh_user', 'sbh_pass', 'sbh_collec', 'sbh_collec_desc', 'sbh_overwrite', 'fj_overwrite']
for param in expected_params:
if param not in params_from_request:
return 'Parameter ' + param + ' not found in request', 400

# instantiate the XDC class using the params_from_request dictionary
print(request.files['Metadata'])
Expand All @@ -108,64 +114,25 @@ def upload_file_from_sbs_post_up():
fj_token = None,
sbh_token = None,
homespace = "https://synbiohub.org/gonza10v"
)



xdc.initialize()
xdc.log_in_sbh()
xdc.convert_to_sbol()
xdc.generate_sbol_hash_map()
sbh_url = xdc.upload_to_sbh()
)

sbs_upload_response_dict ={
try:
xdc.initialize()
xdc.log_in_fj()
xdc.log_in_sbh()
xdc.convert_to_sbol()
xdc.generate_sbol_hash_map()
sbh_url = xdc.upload_to_sbh()
xdc.upload_to_fj()
except AttributeError as e:
return jsonify({"error": str(e)}), 400

sbs_upload_response_dict = {
"sbh_url": sbh_url,
"status": "success"
}
return jsonify(sbs_upload_response_dict)

@app.route('/extract_data', methods=['POST'])
def process_files():
if 'Metadata' not in request.files:
print(request)
return 'No file part', 400
metadata_file = request.files['Metadata']
if metadata_file.filename == '':
return 'No selected file', 400

if 'platereader_output' not in request.files:
print(request)
return 'No file part', 400
file = request.files['platereader_output']
if file.filename == '':
return 'No selected file', 400
# Get uploaded files from request
platereader_output_files = [file] #request.files.getlist('platereader_output') #[file] #TODO: see how to iterate through files
# Get selected preset from request
preset = request.form.get('preset')

print(platereader_output_files)
print(preset)
# Call the process_files_with_script function
modified_file_path = process_files_with_script(platereader_output_files, metadata_file, preset)

# Return the modified file as a response
with open(modified_file_path, 'rb') as f:
modified_file_data = f.read()
#os.remove(modified_file_path) # Optional: Remove the temporary file
print('finished')
# save modified file to disk



return modified_file_data

@app.route('/return_info', methods=['POST'])
def return_info():
# Return the profile information of the logged in user


return


@app.route('/sbol_2_build_golden_gate', methods=['POST'])
Expand Down Expand Up @@ -267,5 +234,17 @@ def build_pudu():
return jsonify({"error": f"Unexpected server error: {str(e)}"}), 500


@app.route('/api/inspect_request', methods=['POST'])
def inspect_request():
files = {}
for name in request.files:
file = request.files[name]
try:
files[name] = json.loads(file.read())
except Exception as e:
return jsonify({"error": str(e)}), 400

return jsonify({
"message": "Request received successfully",
"files": files}), 200


Binary file added sbs_server/files/Tricahue_v11.6b_Medias.xlsm
Binary file not shown.
1 change: 1 addition & 0 deletions sbs_server/files/files.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
folder for files
12 changes: 12 additions & 0 deletions sbs_server/files/sbs_params_up.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"fj_url": "charmmefj-api.synbiohub.org",
"fj_user": "test",
"fj_pass": "test123",
"sbh_url": "https://synbiohub.org",
"sbh_user": "test@test.test",
"sbh_pass": "test123",
"sbh_collec": "xdc_sbs_test_uploader_file",
"sbh_collec_desc": "xdc_sbs_test_uploader_file_description",
"fj_overwrite": false,
"sbh_overwrite": false
}