Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: draft for mvs support (unfinished) #110

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
### Custom
working_folder/*
preprocessor/cellstar_preprocessor/tools/open_wrl_file/*
molstar-extension/site/*
molstar-extension/node_modules/
molstar-extension/debug.log
Expand Down Expand Up @@ -317,3 +319,4 @@ dmypy.json
# Cython debug symbols
cython_debug/

working_folder/custom-actin/.zattrs
10 changes: 10 additions & 0 deletions db/cellstar_db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,3 +588,13 @@ def detail_lvl_to_fraction(self) -> dict:
mesh simplification ratios (fractions, e.g. 0.8) as values
"""
...


class ModelArbitraryTypes(BaseModel):
class Config:
arbitrary_types_allowed = True


class Asset(ModelArbitraryTypes):
filename: str
data: str | bytes
2 changes: 1 addition & 1 deletion environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies:
- sfftk==0.5.5.dev1
- sfftk-rw==0.7.1
- SimpleParse @ git+https://github.com/mcfletch/simpleparse.git@57c8d734bdc165581fbacfeecabe25a66c3452a4
- tensorstore==0.1.18
- tensorstore
- killport
- Pillow
- typer==0.7.0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import io
from pathlib import Path
import zipfile

from cellstar_db.models import Asset

def write_in_memory_zip(output_path: Path, assets: list[Asset]):
zip_buffer = io.BytesIO()


with zipfile.ZipFile(zip_buffer, "a", zipfile.ZIP_DEFLATED, False) as zip_file:
# for file_name, data in [('1.txt', io.BytesIO(b'111')),
# ('2.txt', io.BytesIO(b'222'))]:
for item in assets:
# zip_file.writestr(item.filename, data.getvalue())
zip_file.writestr(item.filename, item.data)

with open(str(output_path.resolve()), 'wb') as f:
f.write(zip_buffer.getvalue())

4 changes: 4 additions & 0 deletions vs_toolkit/extra_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import molviewspec

class MVSJ:
pass
Loading