STOmics / CellBin

Tools for generating single-cell gene expression data
MIT License
29 stars 2 forks source link

Cell Labelling cannot run #5

Open chstellar opened 11 months ago

chstellar commented 11 months ago

I ran this script

python /home/jyubq/.conda/envs/stereocell/lib/python3.8/StereoCell/stereocell/labelling/correct.py --way fast --mask_path /home/jyubq/proj_benchmarking/dast_ss2022/73.trial/04.register/DAPI_SS200000135TL_D1_mask.tif --matrix_path /home/jyubq/proj_benchmarking/dast_ss2022/73.trial/03.count/FP200003808_L01.raw.gem --out_path /home/jyubq/proj_benchmarking/dast_ss2022/73.trial/051.cellcut/stereocell

where the .raw.gem is converted from .raw.gef by SAWv6.1.3 cellCut view, with the first 10 rows looking like this:

gem = pd.read_csv("/home/jyubq/proj_benchmarking/dast_ss2022/73.trial/03.count/FP200003808_L01.raw.gem",sep='\t', header=0, compression='infer', comment='#')
print(gem[:10])
    geneID      x      y  MIDCount  ExonCount
0  Gm18956  23534  13981         1          1
1  Gm37180  26981  15818         1          1
2  Gm37180  18825  23430         2          2
3  Gm37180  26674  24614         1          1
4  Gm37180  29704  24182         1          1
5  Gm37180  28083  16419         1          1
6  Gm37180  31103  20905         1          1
7  Gm37180  26190  18600         1          1
8  Gm37180  30201  23980         1          1
9  Gm37180  28097  14304         1          1

and the mask is obtained from SAWv6.1.3 register, both are compatible with downstream analysis by SAW. But I encountered this error:

I1126 23:52:27.726047 140514253887296 correct.py:20] Correct Type <fast> selected.
I1126 23:52:27.726493 140514253887296 cell_correct.py:86] Start parse head info of file </home/jyubq/proj_benchmarking/dast_ss2022/73.trial/03.count/FP200003808_L01.raw.gem>
I1126 23:52:28.151114 140514253887296 cell_correct.py:28] Loading matrix data...
I1126 23:53:30.551073 140514253887296 cell_correct.py:31] Matrix original point is (0, 0), shape is (26460, 44100)
I1126 23:53:30.553605 140514253887296 cell_correct.py:37] Loading cell mask...
I1126 23:53:35.230641 140514253887296 cell_correct.py:45] Mask shape, Matrix shape (26460, 44100), (26460, 44100)
I1126 23:53:38.670332 140514253887296 cell_correct.py:53] Cell mask shape is (26460, 44100), cell count is 396168
I1126 23:53:44.611520 140514253887296 cell_correct.py:56] Create single cell gene data...
Traceback (most recent call last):
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/groupby/groupby.py", line 1490, in array_func
    result = self.grouper._cython_operation(
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/groupby/ops.py", line 959, in _cython_operation
    return cy_op.cython_operation(
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/groupby/ops.py", line 657, in cython_operation
    return self._cython_op_ndim_compat(
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/groupby/ops.py", line 497, in _cython_op_ndim_compat
    return self._call_cython_op(
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/groupby/ops.py", line 541, in _call_cython_op
    func = self._get_cython_function(self.kind, self.how, values.dtype, is_numeric)
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/groupby/ops.py", line 173, in _get_cython_function
    raise NotImplementedError(
NotImplementedError: function is not implemented for this dtype: [how->mean,dtype->object]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/nanops.py", line 1692, in _ensure_numeric
    x = float(x)
ValueError: could not convert string to float: 'Tram1Rpl7Rpl7Cox5bRpl31Rpl31Mob4Bmpr2Eef1b2Smarcal1Rpl37aGigyf2Cops9DbiDbiDbiCcnt2Rab29SnrpeTimm17a4930523C07RikMrps14Syt14Mir205hgPhactr2AbraclArg1Rps12Eif4ebp2Arid5bGucd1Sumo3CstbBsgUqcr11Oaz1Zbtb7aRps15Hmg20bTle5Eef2SnrpfFrs2Cct2Mars1Nab2Lrp1Ptges3Myl6Drg1DbnlRps26Rps26Rpl41Rpl41Rpl41Rpl41Rps27aRps27aHba-a1Hba-a1Zfp62HnrnpabVdac1UqcrqUqcrqG3bp1Atox1UbbTnk1Slc25a11Pitpnm3T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5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Dlx5Sem1Sem1Smim30CycsTax1bp1Ccser1Smarcad1Rmnd5aRnf181Serbp1Vamp8ParticlTgoln1Mob1aC87436SnrpgCnbpRuvbl1Mcm2Tpt1-ps3Bhlhe40Sec13Cd9Rpl32Nop53Rps5Gm10175Ltbp4Paf1Ech1Rps16Lgals7Eif3k2200002D01RikRps19Rps19KrtdapKrtdapRpl14-ps1Nomo1Rpl18Rps17Rps17Rps17Stard10Rps3Trim12cArfip2Dennd2bRpl27aRras2Eif3cPycardHbb-bsHbb-bsHbb-bsHbb-bsHbb-bsHbb-bsH19Cdkn1cCol4a1FntaFntaAsah1Gm56864CopeUba52Sin3bHook2Orc6Prdx2Prdx2Cmtm4Gm10073Ist1Fbxo31Tcf25RhouRpl13Rpl13Rpl13JrklAp1m2Hspa8Rps25Rpl10-ps3Commd4Spg21Anxa2Rplp1Rplp1Rplp1Rplp1Rplp1Rplp1Rplp1Rplp1Polr2mRfx7Dhx30Stt3bCtnnb1Rpsamt-Rnr1mt-Rnr1mt-Nd2mt-Nd1mt-Nd1mt-Nd1EbpPgrmc1Rpl39Pls3Rps4xRpl36aRbbp7Ace2Tmsb4xTmsb4xTmsb4x'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/nanops.py", line 1696, in _ensure_numeric
    x = complex(x)
ValueError: complex() arg is a malformed string

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/StereoCell/stereocell/labelling/correct.py", line 52, in <module>
    app.run(main)
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/absl/app.py", line 308, in run
    _run_main(main, args)
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/absl/app.py", line 254, in _run_main
    sys.exit(main(argv))
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/StereoCell/stereocell/labelling/correct.py", line 27, in main
    adjust(FLAGS.way,
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/StereoCell/stereocell/labelling/correct.py", line 22, in adjust
    correct.creat_cell_gxp(matrx_path=matrix_file, cell_mask_path=mask_file)
  File "/import/home/jyubq/.conda/envs/stereocell/lib/python3.8/StereoCell/stereocell/labelling/cell_correct.py", line 114, in creat_cell_gxp
    self.loader.load(matrx_path, cell_mask_path)
  File "/import/home/jyubq/.conda/envs/stereocell/lib/python3.8/StereoCell/stereocell/labelling/cell_correct.py", line 77, in load
    self.cell_coord = self.cell_data.groupby('CellID').mean()[['x', 'y']].reset_index()
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/groupby/groupby.py", line 1855, in mean
    result = self._cython_agg_general(
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/groupby/groupby.py", line 1507, in _cython_agg_general
    new_mgr = data.grouped_reduce(array_func)
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/internals/managers.py", line 1503, in grouped_reduce
    applied = sb.apply(func)
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/internals/blocks.py", line 329, in apply
    result = func(self.values, **kwargs)
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/groupby/groupby.py", line 1503, in array_func
    result = self._agg_py_fallback(values, ndim=data.ndim, alt=alt)
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/groupby/groupby.py", line 1457, in _agg_py_fallback
    res_values = self.grouper.agg_series(ser, alt, preserve_dtype=True)
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/groupby/ops.py", line 994, in agg_series
    result = self._aggregate_series_pure_python(obj, func)
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/groupby/ops.py", line 1015, in _aggregate_series_pure_python
    res = func(group)
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/groupby/groupby.py", line 1857, in <lambda>
    alt=lambda x: Series(x).mean(numeric_only=numeric_only),
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/generic.py", line 11556, in mean
    return NDFrame.mean(self, axis, skipna, numeric_only, **kwargs)
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/generic.py", line 11201, in mean
    return self._stat_function(
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/generic.py", line 11158, in _stat_function
    return self._reduce(
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/series.py", line 4670, in _reduce
    return op(delegate, skipna=skipna, **kwds)
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/nanops.py", line 96, in _f
    return f(*args, **kwargs)
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/nanops.py", line 158, in f
    result = alt(values, axis=axis, skipna=skipna, **kwds)
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/nanops.py", line 421, in new_func
    result = func(values, axis=axis, skipna=skipna, mask=mask, **kwargs)
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/nanops.py", line 727, in nanmean
    the_sum = _ensure_numeric(values.sum(axis, dtype=dtype_sum))
  File "/home/jyubq/.conda/envs/stereocell/lib/python3.8/pandas/core/nanops.py", line 1699, in _ensure_numeric
    raise TypeError(f"Could not convert {x} to numeric") from err
TypeError: Could not convert Tram1Rpl7Rpl7Cox5bRpl31Rpl31Mob4Bmpr2Eef1b2Smarcal1Rpl37aGigyf2Cops9DbiDbiDbiCcnt2Rab29SnrpeTimm17a4930523C07RikMrps14Syt14Mir205hgPhactr2AbraclArg1Rps12Eif4ebp2Arid5bGucd1Sumo3CstbBsgUqcr11Oaz1Zbtb7aRps15Hmg20bTle5Eef2SnrpfFrs2Cct2Mars1Nab2Lrp1Ptges3Myl6Drg1DbnlRps26Rps26Rpl41Rpl41Rpl41Rpl41Rps27aRps27aHba-a1Hba-a1Zfp62HnrnpabVdac1UqcrqUqcrqG3bp1Atox1UbbTnk1Slc25a11Pitpnm3Tlcd3aTaok1Msi2Rpl23Psmd3Krt10Krt10Krt19Krt19Krt17Krt15Atp6v0a1Rpl27Myl4Rpl38Rpl38Jpt1MetrnlMetrnlRps7Wdr89Plekhh1GphnUbr7Ndufb1Glrx5Dync1h1Ssr1Lman2Cxcl14Hnrnpa0Ndufs6Tent2Serf1Rpl15Rps24Rps24HnrnpcAcin1Micu2Bmp1Tpt1Rpl37Rpl37Rpl37Rpl37Rpl37Lrp12Puf60Rpl8Rpl8Lgals1Lgals1Rpl3Ncaph2Rpl31-ps8Krt1Krt1Krt1Krt4Krt4Krt4Mapk1Ranbp1Eif2b5Hes1Ncbp2as2Rpl35aRpl35aCstdc5Cadm2Atp5jEzrBicdl2Paqr4AntkmtRps2CutaRps10Fkbp5Rnf8Rps28Clic1Csnk2bRps18Rps18Flot1Abcf1Tnfrsf21Mrpl14Ccnd3Ccnd3Rpl36VapaSnrpd1Lims2Gm56496Zmat2Diaph1Tcerg1Rps14Rps14Tshz1Rpl17Trmt112Prdx5FauCox8aFads1Anxa1Anxa1Sec61a2Plxdc2NelfbPtpaRab14Rpl35Hoxd11Nckap1Emc7Srp14Spint1Spint1MalMrps26SnrpbZfp937PygbId1Asxl1Romo1Rbm39Srsf6Fabp5Ythdf3GmpsRps3a1Mef2dRab25S100a16S100a16S100a6S100a6S100a6Psmd4Psmb4Gabpb2Pex11bRbm8aRps27Bcas2Papss1Ube2d3Rpl34Tspan5FpgtRps20Rps20Nfx1FktnDmac1Dhcr24Ssbp3Cmpk1Rps8Rps8Tmem50aClic4Lypla2TardbpRpl22Cyp51Zfp513Gpn1Mrpl33Dok7Rpl9Rpl9Rpl9Mir703Enoph1Rpl51500011B03RikCox6a1Rpl6Rplp0Rplp0Erp29Zfp664Rps16-ps2Cct6aCldn3Bcl7bPom121Upk3blMdh2Ap1s1Rac1Arpc1aActbRpl21Cdk8Cdk8Cdk8Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Rn18s-rs5Dlx5Sem1Sem1Smim30CycsTax1bp1Ccser1Smarcad1Rmnd5aRnf181Serbp1Vamp8ParticlTgoln1Mob1aC87436SnrpgCnbpRuvbl1Mcm2Tpt1-ps3Bhlhe40Sec13Cd9Rpl32Nop53Rps5Gm10175Ltbp4Paf1Ech1Rps16Lgals7Eif3k2200002D01RikRps19Rps19KrtdapKrtdapRpl14-ps1Nomo1Rpl18Rps17Rps17Rps17Stard10Rps3Trim12cArfip2Dennd2bRpl27aRras2Eif3cPycardHbb-bsHbb-bsHbb-bsHbb-bsHbb-bsHbb-bsH19Cdkn1cCol4a1FntaFntaAsah1Gm56864CopeUba52Sin3bHook2Orc6Prdx2Prdx2Cmtm4Gm10073Ist1Fbxo31Tcf25RhouRpl13Rpl13Rpl13JrklAp1m2Hspa8Rps25Rpl10-ps3Commd4Spg21Anxa2Rplp1Rplp1Rplp1Rplp1Rplp1Rplp1Rplp1Rplp1Polr2mRfx7Dhx30Stt3bCtnnb1Rpsamt-Rnr1mt-Rnr1mt-Nd2mt-Nd1mt-Nd1mt-Nd1EbpPgrmc1Rpl39Pls3Rps4xRpl36aRbbp7Ace2Tmsb4xTmsb4xTmsb4x to numeric

Could you please help?

ghost commented 10 months ago

It suggests a numeric value should be in that position instead of a string value. Could you please search the string "Tram1Rpl7Rpl7Cox5bRpl31R ..." in your file to see where is it?