immucellai2 2.1.28__py3-none-any.whl → 2.1.30__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,35 +6,28 @@ import os
6
6
  import re
7
7
  import sys
8
8
  import multiprocessing as mp
9
+ import importlib.util
10
+
11
+ def get_package_dir(package_name):
12
+ spec = importlib.util.find_spec(package_name)
13
+ if spec is None:
14
+ raise ModuleNotFoundError(f"Package '{package_name}' not found")
15
+ path = spec.origin or spec.submodule_search_locations[0]
16
+ return os.path.dirname(path)
9
17
 
10
18
  def SelectGeneForDeconvolution(DFReferenceProfile, FileCoveredGenes="", Method="UsedMarker"):
11
- print("Select the gene for the following deconvolution...")
12
- GeneUsedForDeconvolution = []
13
- DFReferenceProfileGenes = DFReferenceProfile.index.values
14
- if Method == "UsedMarker":
15
- if FileCoveredGenes == "":
16
- try:
17
- marker_path = files("immucellai2.myconfig").joinpath("MarkerUsedDeconvolution.txt")
18
- FileCoveredGenes = str(marker_path)
19
- except Exception as e:
20
- script_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
21
- FileCoveredGenes = os.path.join(script_dir, "immucellai2/myconfig/MarkerUsedDeconvolution.txt")
22
- print(f"[WARNING] Using fallback path: {FileCoveredGenes}")
23
- try:
24
- GeneUsedForDeconvolution0 = pandas.read_table(FileCoveredGenes, sep="\t", header=None).iloc[1].tolist()
25
- print(f"[DEBUG] head:\n list(islice(GeneUsedForDeconvolution0, 3))")
26
- GeneUsedForDeconvolution = list(set(GeneUsedForDeconvolution0).intersection(set(DFReferenceProfileGenes)))
27
- print(f"Successfully loaded {len(GeneUsedForDeconvolution)} marker genes")
28
- except FileNotFoundError:
29
- print(f"Error: Marker file not found - {FileCoveredGenes}")
30
- print("Please check:")
31
- print("1. Package is installed correctly (pip install --upgrade immucellai2)")
32
- print("2. Environment variable IMMUCELLAI_CONFIG_DIR is set")
33
- return []
34
- except Exception as e:
35
- print(f"Error reading marker file: {str(e)}")
36
- return []
37
- return GeneUsedForDeconvolution
19
+ print("Select the gene for the following deconvolution...")
20
+ GeneUsedForDeconvolution = []
21
+ DFReferenceProfileGenes = DFReferenceProfile.index.values
22
+ if Method == "UsedMarker":
23
+ if FileCoveredGenes == "":
24
+ pkg_marker_path = os.path.join(get_package_dir("immucellai2"), "myconfig/MarkerUsedDeconvolution.txt")
25
+ if os.path.exists(pkg_marker_path):
26
+ FileCoveredGenes = pkg_marker_path
27
+ print(f"[INFO] Found marker file in immucellai2 package: {FileCoveredGenes}")
28
+ GeneUsedForDeconvolution0 = (pandas.read_table(FileCoveredGenes, sep= "\t")).iloc[0].to_list()
29
+ GeneUsedForDeconvolution = list(set(GeneUsedForDeconvolution0).intersection(set(DFReferenceProfileGenes)))
30
+ return GeneUsedForDeconvolution
38
31
 
39
32
  def Obtainmyconfigpath():
40
33
  script_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: immucellai2
3
- Version: 2.1.28
3
+ Version: 2.1.30
4
4
  Summary: A tool for immune cell type deconvolution
5
5
  Home-page: https://github.com/VyvyanYjm/ImmuCellAI2.0
6
6
  Author: YangJingmin
@@ -1,7 +1,7 @@
1
1
  immucellai2/Deconvolution.py,sha256=8fYLWKHFf1qahY7qEt5nnsrju7S7kF9f2ch3YXaKQMU,12577
2
2
  immucellai2/Drawplot.py,sha256=YnUleceEyim9SsTiU18mbAMcjOH9ovBXJW3pwXxA7as,5136
3
3
  immucellai2/ObtainCategory.py,sha256=N1F_yUHoaIisnlms4aNNJ2UIzZDI2TIc0t7IRLtM7So,7008
4
- immucellai2/PrepareData.py,sha256=bV0H7OVVuB-BOcQqQazaYpE4RbB9uk8rVXQPrnYhZ5Q,6359
4
+ immucellai2/PrepareData.py,sha256=tJWtQbfFfXszAQMnAmyzFrXB40wgHl48WP3WZKfeifg,5935
5
5
  immucellai2/Time.py,sha256=et3aAqyVDKwP5_tdGIwA6yxdXRbbYemc9wEaPHpQCck,572
6
6
  immucellai2/__init__.py,sha256=wi7UznfkskCvT4yj-u1RuyN0SK1tZptpXffIaQW2XkQ,3055
7
7
  immucellai2/myclasses.py,sha256=9Rgil00HX_RfOhvpdvUZDsvFi7RdIfXay4V3lRcQsQ8,12409
@@ -9,8 +9,8 @@ immucellai2/myconfig/Celltype.category,sha256=l_5vspGpyDbuaQ7QOLIQjSs4xb6x6_pvvt
9
9
  immucellai2/myconfig/MarkerUsedDeconvolution.txt,sha256=33gCFD1_Clis7NFaQTUHc5s7BXoN61jWgWPgjT-m0n0,60756
10
10
  immucellai2/myconfig/reference_normalCelltypes.txt,sha256=zhKP5Z1TgVyB6ijIamjM1ETmuwQgRATofO-0ds89gP4,39107049
11
11
  immucellai2/myconfig/reference_tumorCelltypes.txt,sha256=xYgjehHIXb5re20bmXeoqxfyvQmgpr4y-0ysCVnEeI8,40893156
12
- immucellai2-2.1.28.dist-info/METADATA,sha256=QYja6j1Cya9QA7p6jnbgwBUrOpmWDVgyRDJaeypWbIg,1662
13
- immucellai2-2.1.28.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
14
- immucellai2-2.1.28.dist-info/entry_points.txt,sha256=asskhaErD37JB_X_4TPB1itaIytWCU-RHFIyVGQ8Jbw,62
15
- immucellai2-2.1.28.dist-info/top_level.txt,sha256=9r84YbXmTdnKZnK2OGrTsgYPFoSBdk4EkeieDg-7_DY,12
16
- immucellai2-2.1.28.dist-info/RECORD,,
12
+ immucellai2-2.1.30.dist-info/METADATA,sha256=NKn592muAUBDhIluHj7pKTLUOrdpNxGwXGn64E_fpKQ,1662
13
+ immucellai2-2.1.30.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
14
+ immucellai2-2.1.30.dist-info/entry_points.txt,sha256=asskhaErD37JB_X_4TPB1itaIytWCU-RHFIyVGQ8Jbw,62
15
+ immucellai2-2.1.30.dist-info/top_level.txt,sha256=9r84YbXmTdnKZnK2OGrTsgYPFoSBdk4EkeieDg-7_DY,12
16
+ immucellai2-2.1.30.dist-info/RECORD,,