immucellai2 2.1.30__tar.gz → 2.1.32__tar.gz

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.
Files changed (21) hide show
  1. {immucellai2-2.1.30 → immucellai2-2.1.32}/PKG-INFO +1 -1
  2. {immucellai2-2.1.30 → immucellai2-2.1.32}/immucellai2/Deconvolution.py +22 -25
  3. {immucellai2-2.1.30 → immucellai2-2.1.32}/immucellai2/myclasses.py +4 -10
  4. {immucellai2-2.1.30 → immucellai2-2.1.32}/immucellai2.egg-info/PKG-INFO +1 -1
  5. {immucellai2-2.1.30 → immucellai2-2.1.32}/setup.cfg +1 -1
  6. {immucellai2-2.1.30 → immucellai2-2.1.32}/README.md +0 -0
  7. {immucellai2-2.1.30 → immucellai2-2.1.32}/immucellai2/Drawplot.py +0 -0
  8. {immucellai2-2.1.30 → immucellai2-2.1.32}/immucellai2/ObtainCategory.py +0 -0
  9. {immucellai2-2.1.30 → immucellai2-2.1.32}/immucellai2/PrepareData.py +0 -0
  10. {immucellai2-2.1.30 → immucellai2-2.1.32}/immucellai2/Time.py +0 -0
  11. {immucellai2-2.1.30 → immucellai2-2.1.32}/immucellai2/__init__.py +0 -0
  12. {immucellai2-2.1.30 → immucellai2-2.1.32}/immucellai2/myconfig/Celltype.category +0 -0
  13. {immucellai2-2.1.30 → immucellai2-2.1.32}/immucellai2/myconfig/MarkerUsedDeconvolution.txt +0 -0
  14. {immucellai2-2.1.30 → immucellai2-2.1.32}/immucellai2/myconfig/reference_normalCelltypes.txt +0 -0
  15. {immucellai2-2.1.30 → immucellai2-2.1.32}/immucellai2/myconfig/reference_tumorCelltypes.txt +0 -0
  16. {immucellai2-2.1.30 → immucellai2-2.1.32}/immucellai2.egg-info/SOURCES.txt +0 -0
  17. {immucellai2-2.1.30 → immucellai2-2.1.32}/immucellai2.egg-info/dependency_links.txt +0 -0
  18. {immucellai2-2.1.30 → immucellai2-2.1.32}/immucellai2.egg-info/entry_points.txt +0 -0
  19. {immucellai2-2.1.30 → immucellai2-2.1.32}/immucellai2.egg-info/requires.txt +0 -0
  20. {immucellai2-2.1.30 → immucellai2-2.1.32}/immucellai2.egg-info/top_level.txt +0 -0
  21. {immucellai2-2.1.30 → immucellai2-2.1.32}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: immucellai2
3
- Version: 2.1.30
3
+ Version: 2.1.32
4
4
  Summary: A tool for immune cell type deconvolution
5
5
  Home-page: https://github.com/VyvyanYjm/ImmuCellAI2.0
6
6
  Author: YangJingmin
@@ -267,36 +267,33 @@ def MainRun(RunObject, seed=42, MultithreadModule = 'joblib'):
267
267
  RunObject.SampleList[sample_index],
268
268
  RunObject.MAPorMLE
269
269
  ))
270
- #EmceeParameterCopy = RunObject.EmceeParameter.mycopy()
271
- MultiprocessingReturnValue = []
270
+ MultiprocessingReturnValue = []
272
271
  if MultithreadModule == 'joblib':
273
- try:
274
- results = joblib.Parallel(n_jobs=int(EnvironmentRun.ThreadNum), backend='loky',verbose=0)(joblib.delayed(ThreadRunEachSamples)(*arg) for arg in parameterlist)
275
- except:
276
- print('error occurs while paralleling')
277
- finally:
278
- del parameterlist
279
- print('finished all!')
272
+ try:
273
+ MultiprocessingReturnValue = joblib.Parallel(n_jobs=int(EnvironmentRun.ThreadNum), backend='loky',verbose=0)(joblib.delayed(ThreadRunEachSamples)(*arg) for arg in parameterlist)
274
+ except:
275
+ print('error occurs while paralleling')
276
+ finally:
277
+ del parameterlist
278
+ print('finished all!')
280
279
  elif MultithreadModule == 'multiprocessing':
281
280
  with multiprocessing.Pool(processes=int(EnvironmentRun.ThreadNum)) as pool:
282
- results = pool.starmap(
283
- ThreadRunEachSamples,
284
- [(EmceeParameterCopy,
285
- CelltypesReferenceMatrix,
286
- RunObject.SamplesBulkRNAseqExpression[sample_index],
287
- RunObject.SampleList[sample_index],
288
- seed + sample_index,
289
- RunObject.MAPorMLE
290
- ) for sample_index in range(nsamples)]
291
- )
281
+ try:
282
+ MultiprocessingReturnValue = pool.starmap(ThreadRunEachSamples, parameterlist)
283
+ except Exception as e:
284
+ print(f'Error occurs while paralleling: {e}')
285
+ finally:
286
+ pool.close()
287
+ pool.join()
288
+ print('Finished all!')
292
289
  MergedResultObject = MergeResultsForAllSample(
293
- ThreadList=[MultiprocessesResult(
294
- RunObject.SampleList[i],
295
- result,
296
- deepcopy(RunObject.CellType)
297
- ) for i, result in enumerate(results)],
290
+ ThreadList = [MultiprocessesResult(
291
+ SampleName = RunObject.SampleList[Sampleii],
292
+ SamplingResult = MultiprocessingReturnValue[Sampleii],
293
+ CellType=deepcopy(RunObject.CellType),
294
+ ) for Sampleii in range(len(MultiprocessingReturnValue))],
298
295
  OtherParams=[deepcopy(RunObject.CellType), RunObject.FileCellTypeCategory]
299
- )
296
+ )
300
297
  RecordTime.ShowCostTime()
301
298
  if os.path.exists("TempThread"):
302
299
  os.system("rm -rf TempThread")
@@ -99,16 +99,10 @@ class CLASS_FOR_RUNRESULT(object):
99
99
  self.EmceeFunction2( McSamplingResultList[sampleii, :, :, :] )
100
100
  return NewMcSamplingResultList
101
101
  def optimized_calculation(self, FlatSamplingResultOne, nCellType):
102
- row_sums = FlatSamplingResultOne.sum(axis=1, keepdims=True)
103
- row_sums_safe = row_sums + 1e-10
104
- if FlatSamplingResultOne.shape[1] == nCellType:
105
- return FlatSamplingResultOne / row_sums_safe
106
- elif FlatSamplingResultOne.shape[1] + 1 == nCellType:
107
- normalized = FlatSamplingResultOne / row_sums_safe
108
- last_col = 1 - normalized.sum(axis=1, keepdims=True)
109
- return numpy.column_stack((normalized, last_col))
110
- else:
111
- raise ValueError(f"Dimension mismatch: input {FlatSamplingResultOne.shape[1]} columns, target {nCellType}columns")
102
+ if FlatSamplingResultOne.shape[1] == nCellType:
103
+ return FlatSamplingResultOne / FlatSamplingResultOne.sum(axis=1)[:, None]
104
+ elif FlatSamplingResultOne.shape[1] + 1 == nCellType:
105
+ return numpy.column_stack((FlatSamplingResultOne, 1 - FlatSamplingResultOne.sum(axis=1)))
112
106
  def EmceeFunction2(self, FlatSamplingResultList):
113
107
  fshape = FlatSamplingResultList.shape
114
108
  nCellType = len(self.CellType)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: immucellai2
3
- Version: 2.1.30
3
+ Version: 2.1.32
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,6 +1,6 @@
1
1
  [metadata]
2
2
  name = immucellai2
3
- version = 2.1.30
3
+ version = 2.1.32
4
4
  author = YangJingmin
5
5
  author_email = yangjingmin2021@163.com
6
6
  description = A tool for immune cell type deconvolution
File without changes