The code in Supplemental Data is provided as demonstration and for clarification of the workflow and algorithms. Also included is a small sample data set of the 553 distinctly patterned TIs at stage 4-6 as Matlab matrix. Up to date code, additional software for clustering and visualization, all datasets and the MySQL database referenced in some of the code is available at http://www.fruitfly.org/insitu/FriseMSB. The Matlab code is written and tested for Matlab 7.2 or higher and requires the toolboxes Image, Database, Optimization, Spline, and Statistics. All Database toolbox queries use pg_query.m which could be modified to work without the database toolbox. The JTImrf2 java code works with JDK 1.5 or higher and the included class file was generated with JDK 1.5. Make sure all directories are included in the Matlab classpath and the java directory is included in the Java classpath. Not included are the Matlab mesh generator (available from http://www-math.mit.edu/~persson/mesh/) and the Affinity Propagation Cluster Matlab code from Frey and Dueck (2009) apcluster.m (available at http://www.psi.toronto.edu/affinitypropagation/) Contents -------- TIbin2 TIfate TIfilter TIgen TImrf TImrf2 are described in the manuscript. TImrf2 requires the Java code in the java directory. Additionally, following directories with code are included: * image2TI contains programs called by TIgen and TIfilter: alignmesh.m aligns the TIs to landmarks. border_embryo.m extracts the outline for the embryo. defmesh2.m contains a set of utilities for investigating the structure of the standardized mesh representation and the code for manual segmentation. fembryo.m contains the active contour refinement and separation of touching embryos (Supplemental Figure 2A,B). fit_ellipse.m from Matlab file exchange (http://www.mathworks.com/matlabcentral/fileexchange/3215). fix_meshes.m queries the MySQL database to prune and reorient the TIs. gmesh.m returns all TIs for a given stage and orientation. im_corrdic.m corrects the DIC staining for images (Supplemental Figure 2C-I). meshstaining.m extracts the staining intensity for the TIs from the images. Contains im_corrdic.m code. outlinemesh.m automatic alignment of the mesh to the landmark points. temporal_meshsort.m compacts and sorts the TIs (Supplemental Figure 7). * java contains the java code JTImrf2.java used by TImrf2. * Utility contains miscellaneous utility programs: esimilar3.m returns similar TIs to a given query TI based on a correlation distance score. Both Matlab build in pdist and a (faster) matrix based version is provided (Supplemental Figure 5B). exp_label2.m labels continuous labeled areas in the TIs (Figure 5C). flipmesh.m calculates the mapping for A/P and D/V reorientation of the TIs. fully_connected.m returns a connectivity matrix for all neighboring triangles as used for the MRF code. my_insitus.m contains SQL statements for database queries. myinsitu2fn.m translates between filenames and file entries in the MySQL database as well as file locations in the data storage. pg_query.m performs a SQL query with the Matlab Database toolbox run_apc.m converts the TIs into an appropriate format for APC and runs apcluster.m or the APC C-code * Visualization contains code to visualize the TIs disp_qc.m was used to compare images to TIs for evaluating the accuracy of the TIs (Figure 1I & J). displaymesh.m displays the TIs. displaymeshco.m overlays two TIs in a RGB, cyan/yellow (Supplemental Figure 11), or cyan/mangenta color mockup. study_clusters.m displays the cluster contents (Figure 5B). unrollmesh.m shows multiple meshes as data vectors (Supplemental Figure 5A). TI_Sample contains a Matlab struct called st4pat in following format: st4pat.p = x/y coordinates of the triangle corner points, numbered 1-180 (also in Coordinates/points.txt) st4pat.p_scale = sample.p scaled to a more display friendly scale. st4pat.t = the 311 triangles, each represented as 3 corner points in p (also in Coordinates/triangle_corners.txt) st4pat.stain = expression intensities (each 311 triangles) st4pat.sym = gene symbols corresponding to the TIs st4pat.tn = for each of the 311 triangles, what other triangles share corner points st4pat.t_conn = connectivity matrix for each of the 311 triangles. 1 indicates two shared corner points st4pat.t_edge = for each of the 311 triangles, thenumber of corners at the boundary TI_coordinates contains the data for the TIs as raw text files: points.txt contains the 180 triangle coordinates (equivalent to st4pat.p) triangle_corners.txt contains the composition of each of the 311 triangles, each specified as the three corner points corresponding to the triangles 1-180 in points.txt (equivalent to st4pat.t) Examples -------- * Automatically generating TIs for the directory bill-2008101 [bill_stain, bill_fn] = meshgen2('/Users/erwin/Desktop/bill-2008101', emesh, 0, 'verbose','dic'); * Automatically generating a TI for a single image from the literature and displaying it. litmesh = TIgen('/Users/erwin/Desktop/Literature/gaul1.tiff', ti, 0, 'verbose','dic'); displaymesh(litmesh,ti.p_scale, ti.t); * Manually generating a TI for a single image from the literature litmesh = TIgen('/Users/erwin/Desktop/Literature/2.tiff', ti, 0, 'verbose','dic', 'interactive'); * Displaying TIs displaymesh(sample.stain(:,35), sample.p_scale, sample.t) (displaymesh.m and displaymeshco.m have an additional parameter, +1 or -1 that normalizes the stain values between 0 and 255 or 255 and 0, respectively (useful for data-normalization or such). * Displaying multiple TIs in the same figure for i=1:5, subplot(5,1,i); displaymesh(sample.stain(:,i), sample.p_scale, sample.t); end * Displaying two TIs merged in different colors two = zeros(311,3); two(:,1) = sample.stain(:,1); two(:,2) = sample.stain(:,2); two(:,3) = repmat(255, [1 311]); displaymeshco(two, sample.p_scale, sample.t); * Showing several TIs as linearized vectors for i=1:5, subplot(5,1,i); unrollmesh(sample.stain(:,i), sample.p_scale, sample.t, i); end * Finding similar expression patterns esimilar3(ti, allStage11_idx, litmesh, 'distance', 'no_pdist', 'db', myconn, 'images', '/Volumes/nanos-images/insitu_image_storage/') * Finding and filtering all stage 9-10 embryos [st9tmesh_pat, st9tpat_sym, st9usym, st9tmesh, st9tmesh_ref, st9symi_X50] = TIfilter(myconn, ti, 4, 'lateral') * Creating the domain-map from Figure 3B TIfate(ti, st4tmesh_pat, 'dist_cut', 0.3); * Extracting the expression pattern with k-means and MRF: TImrf(emesh, st4tmesh_pat(:,212), 'single_mesh', 'verbose', 2) * MRF based similarity search for anti-correlation results = TImrf2(ti, st4tmesh_pat, ti.stain(:,16060), 'verbose', 2, 'symidx', st4tpat_sym, 'symtext', st4usym, 'correlation', -1)