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

Density plot gate does not respect filter #290

Open
AugustLundquist opened this issue Mar 31, 2021 · 8 comments
Open

Density plot gate does not respect filter #290

AugustLundquist opened this issue Mar 31, 2021 · 8 comments

Comments

@AugustLundquist
Copy link

When displaying data in density plot tool and applying a filter (in my case to examine the objects from only one image in a database containing multiple images by applying a metadata filter) and creating a gate, the gate is applied to the entire population, disregarding the filter.

Is there some workaround to this?

Thank you!

@DavidStirling
Copy link
Member

Unfortunately filters and gates behave independently, and we currently don't have an easy pathway to making them co-operate in this manner. It'd be nice to have in the future, but since that'd be an extensive rewrite I'm not sure if/when it'd happen.

As a workaround, you might want to try building a SQL filter which combines the two and adding that into the .properties file.

@AugustLundquist
Copy link
Author

I see, thank you! I have tried this but was not able to successfully convert the gate to a SQL filter manually.

I arrive at same error message as in #243.

Could you or someone else provide a working example of such a .properties file?

@DavidStirling
Copy link
Member

The default .properties file should already have some SQL filters inside, but commented out. You could check those.

@AugustLundquist
Copy link
Author

Yes, I commented in the example filters but arrived at same error message, pasted below.
Could this have something to do with user interface generated filters not being saved between sessions? Or is that expected behaviour?

An error occurred in the program:
DBException: ERROR: Database query failed for connection "MainThread" and failed to reconnect
Query was: "SELECT Per_Image.ImageNumber, Per_Image.ImageNumber
FROM Per_Image, (SELECT TableNumber, ImageNumber FROM CPA_per_image, Well_ID_Table WHERE CPA_per_image.well=Well_ID_Table.well AND Well_ID_Table.Gene REGEXP 'CDK.') AS subquery_0
WHERE Per_Image.ImageNumber = subquery_0.ImageNumber "
First exception was: no such table: CPA_per_image
Second exception was: ERROR: Database query failed for connection "MainThread"
Query was: "SELECT Per_Image.ImageNumber, Per_Image.ImageNumber
FROM Per_Image, (SELECT TableNumber, ImageNumber FROM CPA_per_image, Well_ID_Table WHERE CPA_per_image.well=Well_ID_Table.well AND Well_ID_Table.Gene REGEXP 'CDK.
') AS subquery_0
WHERE Per_Image.ImageNumber = subquery_0.ImageNumber "
Exception was: no such table: CPA_per_image

Traceback (most recent call last):
File "cpa\density.pyc", line 215, in update_figpanel
File "cpa\density.pyc", line 234, in _load_points
File "cpa\dbconnect.pyc", line 64, in fn
File "cpa\dbconnect.pyc", line 525, in execute

@DavidStirling
Copy link
Member

It looks like there's something very wrong with that filter, what exactly is it supposed to be doing?

@AugustLundquist
Copy link
Author

It's the example filters from the default .properties file generated by Cellprofiler.

filter_SQL_EMPTY = SELECT TableNumber, ImageNumber FROM CPA_per_image, Well_ID_Table WHERE CPA_per_image.well=Well_ID_Table.well AND Well_ID_Table.Gene="EMPTY"

and

filter_SQL_CDKs = SELECT TableNumber, ImageNumber FROM CPA_per_image, Well_ID_Table WHERE CPA_per_image.well=Well_ID_Table.well AND Well_ID_Table.Gene REGEXP 'CDK.*'

Selecting either one of them gives the error.

@DavidStirling
Copy link
Member

Ah, I see. The example filters won't work straight off for any database, yours probably doesn't have a table called "CPA_per_image" and an extra table mapping wells to genes. I meant to point to those as an example of syntax rather than commands that'd work without editing.

If you could post the "create filter" window setup you used to make your filter, and the parameters for your gate, perhaps that'd be a better approach to figuring out how to combine the two.

@AugustLundquist
Copy link
Author

Okay, I see. What I would like to combine is for instance the following gate and filter:

Screenshot 2021-04-15 155853

Screenshot 2021-04-15 154849

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