CPA and ImageViewer

Dear Staff,

I am now getting started with cell profiler Analyst and i would like to visualize some data coming from a Cell Profiler analysis. I have some problem in the image visualization. In particular the ImageViewer and the Classifier tool gave me the following error:

An error occurred in the program:
DBException: ERROR: Database query failed for connection "MainThread"
SHOW INDEX FROM Per_Object
(1146, “Table ‘shp2.per_object’ doesn’t exist”)

Moreover when i realized an histogram or a scatter-plot and i tried to visualize some selected images, i got the following error:

An error occurred in the program:
DBException: ERROR: Database query failed for connection "MainThread"
SELECT plate, well FROM Per_Image WHERE ImageNumber IN (66)
(1054, “Unknown column ‘plate’ in ‘field list’”)

Thanks in advance for your help,

Francesca

Classifier 2.0 properties file

==============================================

==== Database Info ====

db_type = mysql
db_port = 3306
db_host = 127.0.0.1
db_name = shp2
db_user = root
db_passwd = pippo

==== Database Tables ====

image_table = Per_Image
object_table = Per_Object

==== Database Columns ====

Specify the database column names that contain unique IDs for images and

objects (and optionally tables).

table_id (OPTIONAL): This field lets Classifier handle multiple tables if

you merge them into one and add a table_number column as a foreign

key to your per-image and per-object tables.

image_id: must be a foreign key column between your per-image and per-object

tables

object_id: the object key column from your per-object table

image_id = ImageNumber
object_id = ObjectNumber
plate_id = plate
well_id = well

Also specify the column names that contain X and Y coordinates for each

object within an image.

cell_x_loc = Nuclei_Location_Center_X
cell_y_loc = Nuclei_Location_Center_Y

==== Image Accesss Info ====

image_url_prepend =
image_transfer_protocol = local

==== Image Path and File Name Columns ====

Classifier needs to know where to find the images from your experiment.

Specify the column names from your per-image table that contain the image

paths and file names here.

Individual image files are expected to be monochromatic and represent a single

channel. However, any number of images may be combined by adding a new channel

path and filename column to the per-image table of your database and then

adding those column names here.

NOTE: These lists must have equal length!

image_channel_paths = Image_PathName_origCy3,Image_PathName_origV5,Image_PathName_origNUC,
image_channel_files = Image_FileName_origCy3,Image_FileName_origV5,Image_FileName_origNUC,

Give short names for each of the channels (respectively)…

image_channel_names = origCy3,origV5,origNUC

Specify a default color for each of the channels (respectively)

Valid colors are: [red, green, blue, magenta, cyan, yellow, gray, none]

image_channel_colors = red,green,blue

==== Dynamic Groups ====

Here you can define groupings to choose from when classifier scores your experiment. (eg: per-well)

This is OPTIONAL, you may leave "groups = ".

FORMAT:

groups = comma separated list of group names (MUST END IN A COMMA IF THERE IS ONLY ONE GROUP)

group_XXX = MySQL select statement that returns image-keys and group-keys. This will be associated with the group name “XXX” from above.

EXAMPLE GROUPS:

groups = Well, Gene, Well+Gene,

group_SQL_Well = SELECT Per_Image_Table.TableNumber, Per_Image_Table.ImageNumber, Per_Image_Table.well FROM Per_Image_Table

group_SQL_Gene = SELECT Per_Image_Table.TableNumber, Per_Image_Table.ImageNumber, Well_ID_Table.gene FROM Per_Image_Table, Well_ID_Table WHERE Per_Image_Table.well=Well_ID_Table.well

group_SQL_Well+Gene = SELECT Per_Image_Table.TableNumber, Per_Image_Table.ImageNumber, Well_ID_Table.well, Well_ID_Table.gene FROM Per_Image_Table, Well_ID_Table WHERE Per_Image_Table.well=Well_ID_Table.well

groups =

==== Image Filters ====

Here you can define image filters to let you select objects from a subset of your experiment when training the classifier.

This is OPTIONAL, you may leave "filters = ".

FORMAT:

filters = comma separated list of filter names (MUST END IN A COMMA IF THERE IS ONLY ONE FILTER)

filter_SQL_XXX = MySQL select statement that returns image keys you wish to filter out. This will be associated with the filter name “XXX” from above.

EXAMPLE FILTERS:

filters = EMPTY, CDKs,

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”

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.*’

filters =

==== Meta data ====

What are your objects called?

FORMAT:

object_name = singular object name, plural object name,

object_name = cell, cells,

What size plates were used? 384 or 96? This is for use in the PlateViewer

plate_type = 96

==== Excluded Columns ====

OPTIONAL

Classifier uses columns in your per_object table to find rules. It will

automatically ignore ID columns defined in table_id, image_id, and object_id

as well as any columns that contain non-numeric data.

Here you may list other columns in your per_object table that you wish the

classifier to ignore when finding rules.

You may also use regular expressions here to match more general column names.

Example: classifier_ignore_columns = WellID, Meta_., ._Position

This will ignore any column named “WellID”, any columns that start with

“Meta_”, and any columns that end in “_Position”.

A more restrictive example:

classifier_ignore_columns = ImageNumber, ObjectNumber, .Parent., .Children., .Location_Center.,.Metadata.

classifier_ignore_columns = Parent., .Children., .Nuclei_Location_Center_.,.Metadata.

==== Other ====

Specify the approximate diameter of your objects in pixels here.

image_tile_size = 50

======== Auto Load Training Set ========

OPTIONAL

You may enter the full path to a training set that you would like Classifier

to automatically load when started.

training_set =

======== Area Based Scoring ========

OPTIONAL

You may specify a column in your per-object table which will be summed and

reported in place of object-counts when scoring. The typical use for this

is to report the areas of objects on a per-image or per-group basis.

area_scoring_column =

======== Output Per-Object Classes ========

OPTIONAL

Here you can specify a MySQL table in your Database where you would like

Classifier to write out class information for each object in the

object_table

class_table =

======== Check Tables ========

OPTIONAL

[yes/no] You can ask classifier to check your tables for anomalies such

as orphaned objects or missing column indices. Default is on.

This check is run when Classifier starts and may take up to a minute if

your object_table is extremely large.

check_tables = yes

Hi Francesca,

The second error is: "(1054, “Unknown column ‘plate’ in ‘field list’”)"
Do you have a Per_Object table column that is named “plate”?

And the first error is "(1146, "Table 'shp2.per_object' doesn't exist")" Does your shp2 database have a table that is named exactly "Per_Object"?

David

Hi David,

I don’t have a table that is named exactly “per object” and i don’t have a column that is name “plate”. The tables that i have are named “nuclei.csv”, “cells_Cy3.csv”, “cell_V5.csv”.

Thanks for your quick reply,

Francesca

Hi David,

I have just substituted the correct names in place of “Per_Object” and now i can visualize the points of the scatter-plot like images. Thanks!!

However the ImageViewer tool is still not working for this error:

An error occurred in the program:
DBException: ERROR: Database query failed for connection "MainThread"
SHOW INDEX FROM Per_Nuclei,Per_Cell_Cy3,Per_Cell_V5,Per_Cytoplasm_Cy3,Per_Cytosplam_V5
(1064, “You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘Per_Cell_Cy3,Per_Cell_V5,Per_Cytoplasm_Cy3,Per_Cytosplam_V5’ at line 1”)

I don’t have an expertise in mysql database… do you know how can i modify it?

Moreover when i tried to do the scatter-plot with some variables, it gave me this error:

An error occurred in the program:

NameError: global name ‘UnimplementedError’ is not defined

Traceback (most recent call last):
File “Scatter.pyc”, line 207, in on_update_pressed
File “Scatter.pyc”, line 226, in loadpoints

But when i created an histogram with the same variables, there were no problems.

Thanks,
Francesca

Hi Francesca,

It looks like you have used the ExportToDatabase option to “Create one table per object type”, since you have multiple object tables. (it’s approximately the second to last setting). Is that correct?

Unfortunately, CPA is not well-equipped yet to handle multiple object tables. We have successfully created and used MySQL “views” with multiple per-object tables. A ‘view’ simulates a combined, single per_object table from multiple, linked tables. So one option is to create a MySQL view. (There are some distinct advantages to multiple object tables, from the programmer’s and the user’s perspective. Primarily, you don’t have to worry about different numbers of objects populating a single table).

The simpler approach would be to re-run your analysis with the “Single object table” setting in ExportToDatabase.

Sorry for the confusion - I will suggest changing CP’s default setting back to the single object table to avoid this confusion.
Best,
David