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

real_multi_modality #459

Open
wants to merge 265 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 242 commits
Commits
Show all changes
265 commits
Select commit Hold shift + click to select a range
d2a4d0b
minor change
xingzhongyu Jul 23, 2024
b176cac
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Jul 23, 2024
1a31020
change score
xingzhongyu Jul 23, 2024
2419e24
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 23, 2024
18187e5
minor change
xingzhongyu Jul 23, 2024
77ad75a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 23, 2024
ea7dff5
minor changes
xingzhongyu Jul 23, 2024
beecb6f
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Jul 23, 2024
72c0b71
minor changes
xingzhongyu Jul 23, 2024
d20259f
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Jul 23, 2024
4571f5c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 23, 2024
87c7b4e
minor change
xingzhongyu Jul 23, 2024
9c3acda
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Jul 23, 2024
0f4f027
minor change
xingzhongyu Jul 23, 2024
90c01c6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 23, 2024
e1e5d1e
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Jul 23, 2024
6072fc3
minor change
xingzhongyu Jul 23, 2024
597071e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 23, 2024
e2532e7
minor change
xingzhongyu Jul 23, 2024
78eb7ef
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Jul 23, 2024
ac95353
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Jul 23, 2024
ca7b029
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 23, 2024
1aecb98
minor changes
xingzhongyu Jul 24, 2024
f611f10
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Jul 24, 2024
7d59589
minor change
xingzhongyu Jul 24, 2024
286abe5
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Jul 24, 2024
9d035f7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 24, 2024
86d56f7
minor change
xingzhongyu Jul 24, 2024
ff862a6
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Jul 24, 2024
8cfcf15
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 24, 2024
1ae6bda
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Jul 24, 2024
514465b
minor change
xingzhongyu Jul 24, 2024
ac137c3
minor change
xingzhongyu Jul 24, 2024
ddb6862
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Jul 24, 2024
3c717cb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 24, 2024
648b3c1
minor change
xingzhongyu Jul 24, 2024
cdcd6fc
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Jul 24, 2024
7a7f6a1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 24, 2024
4518d5f
minor change
xingzhongyu Jul 24, 2024
9f4a591
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Jul 24, 2024
44e5b47
minor change
xingzhongyu Jul 25, 2024
aad76dc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 25, 2024
4b2c0f6
minor change
xingzhongyu Jul 25, 2024
d834e89
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 25, 2024
ea0e7fe
minor change
xingzhongyu Jul 29, 2024
50da51e
minor changes
xingzhongyu Jul 29, 2024
8fa1959
minor change
xingzhongyu Jul 31, 2024
46ccfbf
minor change
xingzhongyu Aug 1, 2024
ada544b
minor change
xingzhongyu Aug 1, 2024
c0cfd3a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 1, 2024
0507539
minor change
xingzhongyu Aug 12, 2024
250dfb4
minor change
xingzhongyu Aug 13, 2024
1a6f14f
minor change
xingzhongyu Aug 13, 2024
0776e07
minor change
xingzhongyu Aug 13, 2024
f135306
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Aug 13, 2024
e2eba29
minor change
xingzhongyu Aug 13, 2024
5eb844e
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Aug 13, 2024
a35cbb0
minor change
xingzhongyu Aug 14, 2024
eae8bd2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 14, 2024
5e49b3f
minor change
xingzhongyu Aug 14, 2024
52e5777
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Aug 14, 2024
685582f
minor change
xingzhongyu Aug 14, 2024
250fd99
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 14, 2024
f84c7a0
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Aug 14, 2024
b6a034f
minor change
xingzhongyu Aug 26, 2024
455aaff
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 26, 2024
c58de0a
update metadata
xingzhongyu Aug 26, 2024
96c6522
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Aug 26, 2024
03a1109
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 26, 2024
57d643a
minor change
xingzhongyu Aug 26, 2024
730ae27
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 26, 2024
8983aec
minor change
xingzhongyu Aug 26, 2024
f2b9f9a
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Aug 26, 2024
2432c2c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 26, 2024
52b9df5
update scdeepsort
xingzhongyu Sep 6, 2024
24434eb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 6, 2024
a80eecb
update scdeepsort
xingzhongyu Sep 6, 2024
87bedf6
minor change
xingzhongyu Sep 7, 2024
d44b4bf
minor change
xingzhongyu Sep 7, 2024
27b2e93
minor change
xingzhongyu Sep 7, 2024
b71b4d1
minor change
xingzhongyu Sep 7, 2024
1431b58
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Sep 7, 2024
2a92cf7
update scdeepsort
xingzhongyu Sep 8, 2024
a05b1a0
update scdeepsort
xingzhongyu Sep 8, 2024
ccd4168
update scdeepsort
xingzhongyu Sep 9, 2024
1c19f36
update main
xingzhongyu Sep 10, 2024
6d1f478
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 10, 2024
1c86b2b
update main
xingzhongyu Sep 10, 2024
4258f0a
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Sep 10, 2024
9cc76e4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 10, 2024
e3ba672
update scn
xingzhongyu Sep 13, 2024
04a3a4b
minor change
xingzhongyu Sep 19, 2024
ab7e193
update_get_result_web
xingzhongyu Sep 19, 2024
f1e85b0
update 159
xingzhongyu Sep 29, 2024
ab0b5df
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 29, 2024
cbc4469
update metadata
xingzhongyu Oct 2, 2024
26c73ba
minor change
xingzhongyu Oct 2, 2024
77a2761
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Oct 2, 2024
4f45b17
minor change
xingzhongyu Oct 2, 2024
5b6dd57
Merge branch 'celltype_annotation_automl' of https://github.com/Omics…
xingzhongyu Oct 2, 2024
436c7e5
update get_result_web
xingzhongyu Oct 7, 2024
0dfcafd
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Oct 7, 2024
b1e205d
sc_sim
xingzhongyu Oct 23, 2024
3e4bc57
Merge branch 'celltype_annotation_automl' of https://github.com/Omics…
xingzhongyu Nov 6, 2024
ea5bb9b
update get_result_web
xingzhongyu Nov 8, 2024
ef68af1
minor change
xingzhongyu Nov 8, 2024
2b918df
minor change
xingzhongyu Nov 8, 2024
86d000d
minor_change
xingzhongyu Nov 8, 2024
165e9f3
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Nov 8, 2024
5d32d2e
minor
xingzhongyu Nov 8, 2024
5edd74d
Merge branch 'celltype_annotation_automl' of https://github.com/Omics…
xingzhongyu Nov 8, 2024
2408e54
minor
xingzhongyu Nov 8, 2024
927697c
minor
xingzhongyu Nov 8, 2024
7d30ad7
minor change
xingzhongyu Nov 8, 2024
03557f5
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Nov 8, 2024
05d995d
minor
xingzhongyu Nov 9, 2024
fb148f3
minor change
xingzhongyu Nov 13, 2024
18b197f
minor change
xingzhongyu Nov 13, 2024
864747e
minor change
xingzhongyu Nov 13, 2024
b2db5fa
minor
xingzhongyu Nov 14, 2024
4faaa46
minor
xingzhongyu Nov 15, 2024
53d9ca9
minor
xingzhongyu Nov 15, 2024
1ff7f67
minor
xingzhongyu Nov 15, 2024
7f204df
see https://github.com/PyCQA/docformatter/pull/287
xingzhongyu Nov 15, 2024
5c1d43a
sc_similarity
xingzhongyu Nov 20, 2024
60d5f21
minor
xingzhongyu Nov 21, 2024
a44f625
update scdeepsort
xingzhongyu Nov 24, 2024
136995b
update main
xingzhongyu Nov 26, 2024
eeaafef
Merge branch 'celltype_annotation_automl' of https://github.com/Omics…
xingzhongyu Nov 26, 2024
82f16f4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 26, 2024
e5e2edf
minor
xingzhongyu Nov 29, 2024
d5390e1
minor
xingzhongyu Nov 29, 2024
4a7c5be
update scdeepsort
xingzhongyu Dec 2, 2024
612c72b
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 2, 2024
06f85e7
update scdeepsort
xingzhongyu Dec 2, 2024
adfbfd2
minor
xingzhongyu Dec 4, 2024
5043ffc
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 4, 2024
95b2883
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 4, 2024
13a42e0
minor
xingzhongyu Dec 4, 2024
059a9f4
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 4, 2024
c0cd31b
minor
xingzhongyu Dec 5, 2024
da1bfe7
minor
xingzhongyu Dec 5, 2024
8a27fc6
minor
xingzhongyu Dec 5, 2024
43d4894
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 5, 2024
def68be
minor
xingzhongyu Dec 6, 2024
ad8ecb7
minor
xingzhongyu Dec 6, 2024
6d0583c
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 6, 2024
8fc8f62
update data
xingzhongyu Dec 7, 2024
02893d5
minor
xingzhongyu Dec 9, 2024
75a20b8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 9, 2024
75c6429
minor
xingzhongyu Dec 9, 2024
b265ec7
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 9, 2024
9eba40a
minor
xingzhongyu Dec 9, 2024
1f6e315
Merge branch 'celltype_annotation_automl' of https://github.com/Omics…
xingzhongyu Dec 9, 2024
3edaa6d
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 9, 2024
cdeebd9
minor
xingzhongyu Dec 10, 2024
225b655
minor
xingzhongyu Dec 11, 2024
f70ee3e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 11, 2024
5645a6a
update example
xingzhongyu Dec 12, 2024
06d282d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 12, 2024
cee9204
minor
xingzhongyu Dec 12, 2024
ed0b6b4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 12, 2024
a19a050
minor
xingzhongyu Dec 12, 2024
324714f
minor
xingzhongyu Dec 12, 2024
33eaa23
minor
xingzhongyu Dec 12, 2024
b08ce14
minor
xingzhongyu Dec 12, 2024
20ed44d
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 12, 2024
1ad3cec
minor
xingzhongyu Dec 12, 2024
c26f490
minor
xingzhongyu Dec 12, 2024
fba1880
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 12, 2024
467d4a0
minor
xingzhongyu Dec 12, 2024
30eb4fd
minor
xingzhongyu Dec 13, 2024
2d4070d
update scdeepsort
xingzhongyu Dec 16, 2024
da9b8a6
minor
xingzhongyu Dec 16, 2024
3881988
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 16, 2024
27d9817
ignore result
xingzhongyu Dec 16, 2024
9b6babe
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 16, 2024
f42e6fc
minor
xingzhongyu Dec 16, 2024
83fe348
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 16, 2024
66923ab
minor
xingzhongyu Dec 16, 2024
5859db7
minor
xingzhongyu Dec 16, 2024
00e11fc
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 16, 2024
00c1b82
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 16, 2024
7bbef3e
update pre-commit
xingzhongyu Dec 17, 2024
828a180
Merge branch 'celltype_annotation_automl' of https://github.com/Omics…
xingzhongyu Dec 17, 2024
505e5d6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 17, 2024
b7683af
minor
xingzhongyu Dec 17, 2024
7026ee0
minor
xingzhongyu Dec 17, 2024
d7c63ad
minor
xingzhongyu Dec 17, 2024
79ce92a
Merge branch 'celltype_annotation_automl' of https://github.com/Omics…
xingzhongyu Dec 17, 2024
81b8330
update data
xingzhongyu Dec 17, 2024
7f37be4
update notes
xingzhongyu Dec 18, 2024
3e23afc
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 18, 2024
7599124
update forest and other minor changes
xingzhongyu Dec 18, 2024
8e1d33f
minor
xingzhongyu Dec 18, 2024
1087e3c
minor
xingzhongyu Dec 18, 2024
1e843d3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 18, 2024
46b5cb4
minor
xingzhongyu Dec 18, 2024
38b0f11
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 18, 2024
10f8299
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 18, 2024
f6b3989
add scmvae
xingzhongyu Dec 18, 2024
d0c5c07
minor
xingzhongyu Dec 18, 2024
2e6de34
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 18, 2024
577919a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 18, 2024
c7169eb
minor
xingzhongyu Dec 18, 2024
fa7be0a
minor
xingzhongyu Dec 18, 2024
a66bf43
add note
xingzhongyu Dec 18, 2024
9446566
Merge branch 'celltype_annotation_automl' of https://github.com/Omics…
xingzhongyu Dec 18, 2024
7849333
minor
xingzhongyu Dec 18, 2024
1b8dd47
minor
xingzhongyu Dec 18, 2024
e420a6d
translate notes
xingzhongyu Dec 18, 2024
67fb57b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 18, 2024
d452973
add argument preprocess
xingzhongyu Dec 18, 2024
e87e1f6
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 18, 2024
631ce66
add argument preprocess
xingzhongyu Dec 18, 2024
0f3c268
translate notes
xingzhongyu Dec 18, 2024
c33f9e2
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 18, 2024
5355130
translate notes
xingzhongyu Dec 18, 2024
7c8c657
add atlas
xingzhongyu Dec 19, 2024
c131db2
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 19, 2024
7738d7d
minor
xingzhongyu Dec 19, 2024
35b105c
add atlas
xingzhongyu Dec 19, 2024
4d3a0d2
update scdeepsort
xingzhongyu Dec 19, 2024
c7ac320
minor
xingzhongyu Dec 19, 2024
2cf8e36
minor
xingzhongyu Dec 19, 2024
5b3d2de
minor
xingzhongyu Dec 20, 2024
a18f3ae
add notes
xingzhongyu Dec 20, 2024
dbd1fa3
add notes
xingzhongyu Dec 20, 2024
b096c25
add note
xingzhongyu Dec 20, 2024
4fb6145
add notes
xingzhongyu Dec 20, 2024
059984e
add notes
xingzhongyu Dec 20, 2024
1049349
add notes
xingzhongyu Dec 20, 2024
609db04
translate notes
xingzhongyu Dec 20, 2024
b26151f
add notes
xingzhongyu Dec 20, 2024
6878afa
add notes
xingzhongyu Dec 20, 2024
04ab7eb
add notes
xingzhongyu Dec 20, 2024
844d883
add notes
xingzhongyu Dec 20, 2024
1512c01
add notes
xingzhongyu Dec 20, 2024
7549f1d
minor
xingzhongyu Dec 20, 2024
f0b8db4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 20, 2024
3c3f527
minor
xingzhongyu Dec 20, 2024
bc037a7
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 20, 2024
93d96c1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 20, 2024
e2bd540
minor
xingzhongyu Dec 20, 2024
312ab95
minor
xingzhongyu Dec 20, 2024
b5a6a22
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 20, 2024
5e51a66
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 20, 2024
1a98457
minor
xingzhongyu Dec 20, 2024
4220db0
Merge remote-tracking branch 'origin/celltype_annotation_automl' into…
xingzhongyu Dec 20, 2024
a19aa53
update data
xingzhongyu Dec 20, 2024
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
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,14 @@ temp_data
*.egg*
__pycache__
build/
*.log

#ignore example result
examples/**/*.h5ad
examples/tuning/**/*.yaml
examples/tuning/**/*.csv
examples/tuning/**/*.sh
examples/tuning/**/*.h5
examples/tuning/**/*.tar.gz
examples/tuning/**/*.tif
examples/tuning/**/*.txt
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repos:
args: [--line-width, "120", --profile, black]

- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
rev: eb1df34
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hooks:
- id: docformatter
name: Format docstring
Expand Down
64 changes: 32 additions & 32 deletions README.md

Large diffs are not rendered by default.

101 changes: 101 additions & 0 deletions dance/atlas/data_dropbox_upload.py
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Upload data to dropbox and get the download link

Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import json
import os
import pathlib

import dropbox
import numpy as np
import pandas as pd
import scanpy as sc
from dropbox.exceptions import ApiError, AuthError

from dance.utils import logger


def upload_file_to_dropbox(dropbox_path, access_token, local_path):
dbx = dropbox.Dropbox(access_token)

# Verify access token
try:
dbx.users_get_current_account()
except AuthError as err:
print("ERROR: Invalid access token; please check your access token.")
return None
try:
file_upload(dbx=dbx, local_path=local_path, remote_path=dropbox_path)
print("Upload successful.")
except ApiError as err:
print(f"API error: {err}")
return None


def file_upload(dbx: dropbox.Dropbox, local_path: pathlib.Path, remote_path: str):
CHUNKSIZE = 100 * 1024 * 1024
upload_session_start_result = dbx.files_upload_session_start(b'')
cursor = dropbox.files.UploadSessionCursor(session_id=upload_session_start_result.session_id, offset=0)
with local_path.open("rb") as f:
while True:
data = f.read(CHUNKSIZE)
if data == b"":
break
logger.debug("Pushing %d bytes", len(data))
dbx.files_upload_session_append_v2(data, cursor)
cursor.offset += len(data)
commit = dropbox.files.CommitInfo(path=remote_path)
dbx.files_upload_session_finish(b'', cursor, commit)


def create_shared_link(dbx, dropbox_path):
"""Create or get existing shared link.

:param dbx: Dropbox object
:param dropbox_path: File path on Dropbox
:return: Shared link URL

"""
try:
links = dbx.sharing_list_shared_links(path=dropbox_path, direct_only=True).links
if links:
# If shared link already exists, return the first one
return links[0].url
else:
# Create a new shared link
link = dbx.sharing_create_shared_link_with_settings(dropbox_path)
return link.url
except ApiError as err:
print(f"Error creating shared link: {err}")
return None


def get_link(data_fname, local_path, ACCESS_TOKEN, DROPBOX_DEST_PATH):
DROPBOX_DEST_PATH = DROPBOX_DEST_PATH + "/" + data_fname

upload_file_to_dropbox(dropbox_path=DROPBOX_DEST_PATH, access_token=ACCESS_TOKEN, local_path=local_path)

# Create Dropbox object to get shared link
dbx = dropbox.Dropbox(ACCESS_TOKEN)
# Get shared link
shared_link = create_shared_link(dbx, DROPBOX_DEST_PATH)
if shared_link:
# Dropbox shared link defaults to `dl=0` at the end, which means preview in browser.
# change it to `dl=1`.
download_link = shared_link.replace('&dl=0', '&dl=1')
print(f"Download link: {download_link}")
return download_link
else:
print("Unable to get shared link.")


def get_ans(data: sc.AnnData, tissue: str, dataset_id: str, local_path, ACCESS_TOKEN, DROPBOX_DEST_PATH):
# keys=["species","tissue","dataset","split","celltype_fname","celltype_url","data_fname","data_url"]
ans = {}
ans["species"] = "human"
ans["tissue"] = tissue.capitalize()
ans["dataset"] = data.n_obs
ans["split"] = "train"
ans["celltype_fname"] = ""
ans["celltype_url"] = ""
ans["data_fname"] = f"train_human_{tissue.capitalize()}{dataset_id}_data.h5ad"
ans["data_url"] = get_link(data_fname=ans["data_fname"].split("_", 1)[1], local_path=local_path,
ACCESS_TOKEN=ACCESS_TOKEN, DROPBOX_DEST_PATH=DROPBOX_DEST_PATH)
ans["is_ALL_Integer"] = np.all(np.equal(data.X.data, data.X.data.astype(int)))
return ans
Loading
Loading