dpeerlab / Palantir

Single cell trajectory detection
https://palantir.readthedocs.io
GNU General Public License v2.0
213 stars 50 forks source link

Segmentation fault when running "run_palantir" #49

Closed jamrute closed 3 years ago

jamrute commented 3 years ago

I am getting the following error when I run the run_palantir command: pr_res = palantir.core.run_palantir(ms_data, start_cell, num_waypoints=600)

TerminatedWorkerError: A worker process managed by the executor was unexpectedly terminated. This could be caused by a segmentation fault while calling the function or by an excessive memory usage causing the Operating System to kill the worker. The exit codes of the workers are {SIGABRT(-6), SIGABRT(-6), SIGABRT(-6), SIGABRT(-6), SIGABRT(-6), SIGABRT(-6), SIGABRT(-6), SIGABRT(-6), SIGABRT(-6), SIGABRT(-6), SIGABRT(-6), SIGABRT(-6)}

I was getting an empty ms data frame so I manually specified n_eigs.

Thank you!

ManuSetty commented 3 years ago

Could you please run this again by setting n_jobs=1 . I think the real error is getting masked by the multiprocessing and this will give us a better idea.

jamrute commented 3 years ago

Thank you so much for the prompt response!

It seemed to work once I added the n_jobs=1 keyword argument.

jamrute commented 3 years ago

Trying it on a different dataset yields the following error:

ValueError: Plan shapes are not aligned

ManuSetty commented 3 years ago

Can you please provide more details about the error? Is there more information in the traceback?

jamrute commented 3 years ago

Here is the full traceback sorry forgot to include it:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-15-24d4bddd56d7> in <module>
----> 1 pr_res = palantir.core.run_palantir(ms_data, start_cell, num_waypoints=900, n_jobs=1)

/opt/anaconda3/lib/python3.7/site-packages/palantir/core.py in run_palantir(ms_data, early_cell, terminal_states, knn, num_waypoints, n_jobs, scale_components, use_early_cell_as_start)
     84     print('Entropy and branch probabilities...')
     85     ent, branch_probs = _differentiation_entropy(data.loc[waypoints, :], terminal_states,
---> 86                                                  knn, n_jobs, pseudotime)
     87 
     88     # Project results to all cells

/opt/anaconda3/lib/python3.7/site-packages/palantir/core.py in _differentiation_entropy(wp_data, terminal_states, knn, n_jobs, pseudotime)
    398     bp = pd.DataFrame(0, index=terminal_states, columns=terminal_states)
    399     bp.values[range(len(terminal_states)), range(len(terminal_states))] = 1
--> 400     branch_probs = branch_probs.append(bp.loc[:, branch_probs.columns])
    401 
    402     return ent, branch_probs

/opt/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in append(self, other, ignore_index, verify_integrity, sort)
   7745             ignore_index=ignore_index,
   7746             verify_integrity=verify_integrity,
-> 7747             sort=sort,
   7748         )
   7749 

/opt/anaconda3/lib/python3.7/site-packages/pandas/core/reshape/concat.py in concat(objs, axis, join, ignore_index, keys, levels, names, verify_integrity, sort, copy)
    285     )
    286 
--> 287     return op.get_result()
    288 
    289 

/opt/anaconda3/lib/python3.7/site-packages/pandas/core/reshape/concat.py in get_result(self)
    501 
    502             new_data = concatenate_block_managers(
--> 503                 mgrs_indexers, self.new_axes, concat_axis=self.bm_axis, copy=self.copy,
    504             )
    505             if not self.copy:

/opt/anaconda3/lib/python3.7/site-packages/pandas/core/internals/concat.py in concatenate_block_managers(mgrs_indexers, axes, concat_axis, copy)
     52     blocks = []
     53 
---> 54     for placement, join_units in concat_plan:
     55 
     56         if len(join_units) == 1 and not join_units[0].indexers:

/opt/anaconda3/lib/python3.7/site-packages/pandas/core/internals/concat.py in _combine_concat_plans(plans, concat_axis)
    559         while num_ended[0] != len(next_items):
    560             if num_ended[0] > 0:
--> 561                 raise ValueError("Plan shapes are not aligned")
    562 
    563             placements, units = zip(*next_items)

ValueError: Plan shapes are not aligned
ManuSetty commented 3 years ago

Do you mind sharing the ms_data and the start_cell. I am unable to debug this based on the error message alone. You can anonymize the cell identities.

jamrute commented 3 years ago

I repeated the analysis using different start cells and it seems to work. For some reason it is sensitive to the start cell specified.

ManuSetty commented 3 years ago

Thanks for the update - I will close the issue for now. Please feel free to reopen if you run into this issue again.