-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #421 from theislab/release
v0.3.8
- Loading branch information
Showing
133 changed files
with
1,379 additions
and
1,050 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
""" | ||
Settings class which for example holds paths to cache directories used throughout the code. | ||
""" | ||
|
||
import os | ||
|
||
|
||
SFAIRA_REPO_URL = "https://zenodo.org/record/4836517/files/" | ||
|
||
|
||
class SfairaConfig: | ||
"""\ | ||
Config manager for sfaira. | ||
""" | ||
|
||
def __init__(self): | ||
self.sfaira_repo_url = SFAIRA_REPO_URL | ||
self._cachedir_base = os.path.join(os.path.expanduser("~"), ".cache", "sfaira") | ||
self._cachedir_databases = os.path.join(self._cachedir_base, "dataset_meta") | ||
self._cachedir_databases_cellxgene = os.path.join(self._cachedir_databases, "cellxgene") | ||
self._cachedir_genomes = os.path.join(self._cachedir_base, "genomes") | ||
self._cachedir_ontologies = os.path.join(self._cachedir_base, "ontologies") | ||
|
||
@property | ||
def cachedir_base(self) -> str: | ||
os.makedirs(self._cachedir_base, exist_ok=True) | ||
return self._cachedir_base | ||
|
||
@cachedir_base.setter | ||
def cachedir_base(self, cachedir_base): | ||
if not isinstance(cachedir_base, str): | ||
raise ValueError(f"cachedir_base needs to be provided as a string, was {type(cachedir_base)}") | ||
if cachedir_base == "repo": | ||
cachedir_base = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "cache") | ||
self._cachedir_base = cachedir_base | ||
|
||
@property | ||
def cachedir_databases(self) -> str: | ||
os.makedirs(self._cachedir_databases, exist_ok=True) | ||
return self._cachedir_databases | ||
|
||
@cachedir_databases.setter | ||
def cachedir_databases(self, cachedir_databases): | ||
raise ValueError("cachedir_databases cannot be set manually as it is defined as a subdirectory of" | ||
" cachedir_base. please modify cachedir_base instead") | ||
|
||
@property | ||
def cachedir_databases_cellxgene(self) -> str: | ||
os.makedirs(self._cachedir_databases_cellxgene, exist_ok=True) | ||
return self._cachedir_databases_cellxgene | ||
|
||
@cachedir_databases_cellxgene.setter | ||
def cachedir_databases_cellxgene(self, cachedir_databases_cellxgene): | ||
raise ValueError("cachedir_databases_cellxgene cannot be set manually as it is defined as a subdirectory" | ||
" of cachedir_base. please modify cachedir_base instead") | ||
|
||
@property | ||
def cachedir_genomes(self) -> str: | ||
os.makedirs(self._cachedir_genomes, exist_ok=True) | ||
return self._cachedir_genomes | ||
|
||
@cachedir_genomes.setter | ||
def cachedir_genomes(self, cachedir_genomes): | ||
raise ValueError("cachedir_genomes cannot be set manually as it is defined as a subdirectory of cachedir_base." | ||
"please modify cachedir_base instead") | ||
|
||
@property | ||
def cachedir_ontologies(self) -> str: | ||
os.makedirs(self._cachedir_ontologies, exist_ok=True) | ||
return self._cachedir_ontologies | ||
|
||
@cachedir_ontologies.setter | ||
def cachedir_ontologies(self, cachedir_ontologies): | ||
raise ValueError("cachedir_ontologies cannot be set manually as it is defined as a subdirectory of cachedir_base. please modify cachedir_base instead") | ||
|
||
|
||
settings = SfairaConfig() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
from sfaira.consts.adata_fields import AdataIds, AdataIdsSfaira, AdataIdsCellxgene, AdataIdsCellxgene_v2_0_0 | ||
from sfaira.consts.directories import CACHE_DIR, SFAIRA_REPO_URL | ||
from sfaira.consts.meta_data_files import META_DATA_FIELDS | ||
from sfaira.consts.ontologies import OntologyContainerSfaira | ||
from sfaira.consts.ontologies import OntologyContainerSfaira, OTHER_ORGANISM_KEY | ||
from sfaira.consts.utils import clean_cache | ||
|
||
OCS = OntologyContainerSfaira() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.