[docs]classEnvironmentSettings:""" Class containing environment variables, like receptor_sequence type, root path etc. """sequence_type=SequenceType.AMINO_ACIDroot_path=Path(os.path.normpath(os.path.dirname(os.path.abspath(__file__))+"/../../")+"/")default_params_path=root_path/"immuneML/config/default_params"tmp_test_path=root_path/"test/tmp"default_analysis_path=root_path/"analysis_runs"cache_path=root_path/"cache"tmp_cache_path=tmp_test_path/"cache"html_templates_path=root_path/"immuneML/presentation/html/templates"specs_docs_path=root_path/"docs/specs"source_docs_path=root_path/"docs/source"max_sequence_length=20low_memory=Truecompairr_paths=[Path("/usr/local/bin/compairr"),Path("./compairr/src/compairr"),root_path/'compairr/src/compairr',root_path/'compairr']
[docs]@staticmethoddefget_cache_path(cache_type:CacheType=None):cache_type=EnvironmentSettings.get_cache_type()ifcache_typeisNoneelsecache_typeifcache_type==CacheType.PRODUCTION:returnEnvironmentSettings.cache_pathifConstants.CACHE_PATHnotinos.environelsePath(os.environ[Constants.CACHE_PATH])elifcache_type==CacheType.TEST:returnEnvironmentSettings.tmp_cache_pathelse:raiseRuntimeError("Cache is not set up.")
[docs]@staticmethoddefget_sequence_alphabet(sequence_type:SequenceType=None):""" :return: alphabetically sorted receptor_sequence alphabet """seq_type=sequence_typeifsequence_typeisnotNoneelseEnvironmentSettings.sequence_typeifseq_type==SequenceType.AMINO_ACID:alphabet=list("ACDEFGHIKLMNPQRSTVWY")alphabet.sort()elifseq_type==SequenceType.NUCLEOTIDE:alphabet=list("ACGT")alphabet.sort()else:raiseRuntimeError("EnvironmentSettings: the sequence alphabet cannot be obtained if sequence_type was not set properly. "f"Expected AMINO_ACID or NUCLEOTIDE, but got {seq_type} instead.")returnalphabet