Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors with CytoPy #8

Closed
rahusomavanshi opened this issue Jul 3, 2020 · 7 comments
Closed

Errors with CytoPy #8

rahusomavanshi opened this issue Jul 3, 2020 · 7 comments

Comments

@rahusomavanshi
Copy link

Hi,

I am encountering quite a few errors while running CytoPy. It would be immensely helpful if you could provide a master or template script for an example experiment that I could run after installing CytoPy and see output.

Best regards,

Rahul

@burtonrj
Copy link
Owner

burtonrj commented Jul 3, 2020

I'm sorry that you've experienced issues. If you could provide specifics I will try my best to help. Have you followed the examples presented in the docs: https://cytopy.readthedocs.io/en/latest/

CytoPy is a framework of tools with a loose pattern of steps taken in analysis. It is designed for customisation and to be adaptable to your needs, therefore there isn't a "one size fits all" template for analysis, which reflects the nature of the biological data obtained in cytometry experiments.

You can feel free to send me the script(s) you're currently working with to burtonrj@cardiff.ac.uk and I'll try my best to advise (note, I am on annual leave until Tuesday but I can try and get back to you as quickly as possible).

@rahusomavanshi
Copy link
Author

Hi,

Thanks for you reply and contact for further clarifications. I had few questions -

  1. Do CytoPy works best with Jupyter notebooks ? and how about visualization in other editors/IDE ?
  2. After making root - population plot, at the gating step I am got following error -
    my code -
    from CytoPy.flow.gating.defaults import ChildPopulationCollection

children = ChildPopulationCollection('threshold_1d')
children.add_population('CD3+', definition='+')
children.add_population('CD3-', definition='-')

kwargs = dict(x='CD3',
transform_x='logicle',
kde_bw=0.05,
peak_threshold=0.05)
template.create_gate(gate_name='CD3_gate',
parent='cells',
class_='DensityThreshold',
method='gate_1d',
child_populations=children,
kwargs=kwargs)

  • output - True

template.apply('CD3_gate')

  • output - Invalid parent; does not exist in current Gating object

Note - I am using my own data.

I tried altering the parent = cells argument, but that didnt help.
Please let me know how could I resolve this.

I appreciate you taking the time for my queries during your holiday.

Best,

Rahul

@burtonrj
Copy link
Owner

burtonrj commented Jul 3, 2020

Hi,

CytoPy was designed with a Notebook interface in mind, mainly because cytometry analysis is so visual. But there is no reason why you couldn't run the code in an IDE like PyCharm or Spyder. You just need to handle the matplotlib plot rendering.

RE: your issue. So this error means that the parent specified in your gate definition can't be found, that is, it can't find a population called "cells".

Try running this command: template.print_population_tree()

This will generate a population tree of existing populations in the instance of Gating/Template you are working with.

@rahusomavanshi
Copy link
Author

Hi,

I could run the code in other editors, but could not find the plot file, may be it was due to matplotlib rendering.

For the error, i did run the code you suggested, I don't see the population tree. Instead I see 'root' as output. Any suggestions to resolve this. I think the gating should work to see the population tree right ?

@rahusomavanshi
Copy link
Author

Hi,
I don't see mention of 'cells' (for parent argument) in previous code or documentiation. While plotting a population sample is referred as 'root', right ?
Another trouble I am having that the population plot looks like this (attached). Any suggestions to improve would be helpful.

plot1

@burtonrj
Copy link
Owner

burtonrj commented Jul 7, 2020

In the previous code that you posted, you specify the name of the parent population as 'cells':

kwargs = dict(x='CD3', transform_x='logicle', kde_bw=0.05, peak_threshold=0.05) template.create_gate(gate_name='CD3_gate', parent='cells', class_='DensityThreshold', method='gate_1d', child_populations=children, kwargs=kwargs)

See: parent='cells'. This implies that there should be an existing population named "cells" that your new population (generated by the gate you're trying to create) is derived from.

Regarding the plotting problem. This is a genuine bug in the software at the moment and happens often with the "root" population since this population by default has the highest cell count. If the cell count is too high the plot appears in low resolution because the bin count for the 2D histogram is too low. I'll open a new issue and generate a fix soon, see #9 for details.

@burtonrj
Copy link
Owner

Issues addressed in the new release, v1.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants