Difference between revisions of "Walkthrough for template matching"

From Dynamo
Jump to navigation Jump to search
Line 80: Line 80:
 
[[  File:TemplateMatchingControlThickness.png |thumb|center|500px  ]]
 
[[  File:TemplateMatchingControlThickness.png |thumb|center|500px  ]]
  
 +
[[  File:TemplateMatchingClickNorth.png |thumb|center|500px  ]]
  
 +
[[  File:TemplateMatchingClickNorthTopViewX.png |thumb|center|500px  ]]
 +
 +
==== Averaging manually aligned particles ====
 +
 +
[[  File:TemplateMatchingAverageManual.png |thumb|center|500px  ]]
 +
 +
==== Creating a tight mask  ====
 +
 +
===== Measure distances =====
 +
[[  File:TemplateMatchingMarkZaxis.png |thumb|center|500px  ]]
 +
 +
[[  File:TemplateMatchingMarkXYPlane.png |thumb|center|500px  ]]
 +
 +
[[  File:TemplateMatchingClickNorthTopViewX.png |thumb|center|500px  ]]
 +
 +
===== Create mask =====
 +
[[  File:TemplateMatchingMaskOptions.png |thumb|center|500px  ]]
 +
 +
 +
[[  File:TemplateMatchingMaskSave.png |thumb|center|500px  ]]
  
  
 
====Cropping the borders of a template====
 
====Cropping the borders of a template====
[[  File:TemplateMatchingTemplate32.png |thumb|center|500px| Template cropped to 32 pixels ]]
+
 
 +
[[  File:TemplateMatchingCircshiftTemplate.png |thumb|center|500px  ]]
 +
[[ File:TemplateMatchingTemplateInterior.png |thumb|center|500px| Template cropped to 32 pixels ]]
  
 
=== Through geometrical shapes ===
 
=== Through geometrical shapes ===
Line 91: Line 114:
 
== Creating a cross correlation process==
 
== Creating a cross correlation process==
  
 
+
  <nowiki>ptm = dynamo_match(fileFull,'average48.em','mask','maskData48.em',....
  <notwiki>ptm = dynamo_match(fileFull,'average48.em','mask','maskData48.em',....
 
 
     'outputFolder','cs30',...
 
     'outputFolder','cs30',...
     'ytilt',[-39,36],'sc',[1000,1000,300],'cr',360,'cs',30,'bin',1);<notwiki>
+
     'ytilt',[-39,36],'sc',[1000,1000,300],'cr',360,'cs',30,'bin',1);</nowiki>
  
  
<notwiki>------------------------------------------------------------
+
<nowiki>------------------------------------------------------------
 
   
 
   
 
  Template matching process.
 
  Template matching process.
Line 114: Line 136:
 
   [ok] ... template matching process completed upto creation of cross correlation
 
   [ok] ... template matching process completed upto creation of cross correlation
 
       you can proceed to peak location and particle extraction.
 
       you can proceed to peak location and particle extraction.
------------------------------------------------------------</notwiki>
+
------------------------------------------------------------</nowiki>
  
 
=== The <tt>Process</tt> object ===
 
=== The <tt>Process</tt> object ===
Line 121: Line 143:
  
 
=== Considerations when creating a process===
 
=== Considerations when creating a process===
 
  
 
== Locating cross correlation peaks  ==
 
== Locating cross correlation peaks  ==
  
 
=== Looking at the cross correlation map ===
 
=== Looking at the cross correlation map ===
 +
 +
[[  File:TemplateMatchingCCRaw.png |thumb|center|500px  ]]
  
 
=== Looking at the cross correlation profile ===
 
=== Looking at the cross correlation profile ===
 +
 +
[[  File:TemplateMatchingPeakGood.png |thumb|center|500px  ]]
 +
[[  File:TemplateMatchingPeakGoodVolume.png |thumb|center|500px  ]]
 +
[[  File:TemplateMatchingPeakKink.png |thumb|center|500px  ]]
 +
[[  File:TemplateMatchingPeakBad.png |thumb|center|500px  ]]
 +
  
 
=== Extracting a table ===
 
=== Extracting a table ===
Line 135: Line 164:
  
 
== Visual evaluation of results ==
 
== Visual evaluation of results ==
 +
 +
=== Looking at  table positions===
 +
[[  File:TemplateMatchingTable3d.png |thumb|center|500px  ]]
 +
[[  File:TemplateMatchingTable3dSide.png |thumb|center|500px  ]]
  
 
=== Looking at cropped particles ===
 
=== Looking at cropped particles ===
Line 160: Line 193:
  
 
<tt>o = pff.peaks.average();</tt>
 
<tt>o = pff.peaks.average();</tt>
 +
 +
[[  File:TemplateMatchingAverageRaw.png |thumb|center|500px  ]]
 +
[[  File:TemplateMatchingAverageRandomized.png |thumb|center|500px  ]]

Revision as of 13:01, 19 August 2017

Dynamo includes a set of tools for location of particles inside tomograms. The most simple one is template matching.

Template matching

In this technique, a template representing a molecule of interest is systematically cross-correlated against a tomogram, producing a cross-correlation map of the tomogram. Each pixel in this map represents a score assigned the corresponding pixel in the tomogram map. This score measures the similarity of the neighbourhood of the tomogram pixel to the used template. This similarity is measured exclusively inside a mask.

Data set

Tomogram description

The tomogram contains a buffer with T20S proteasome on a holey carbon grid collected on a Krios + K2. Original pixelsize was 1.76 angstroms. The tomogram provided here has bin binned twice (yielding thus 7.04 ang), defocus is 4.4 microns, no CTF correction, no energy filter.

Acknowledgements

The tomogram has been kindly provided by Alex Noble, from the New York Structural Biology Center. Data collection was performed using Leginon and Appion-Protomo at the Simons Electron Microscopy Center and National Resource for Automated Molecular Microscopy located at the New York Structural Biology Center, supported by grants from the Simons Foundation (349247), NYSTAR, and the NIH National Institute of General Medical Sciences (GM103310) with additional support from Agouron Institute [Grant Number: F00316].

Getting the tomogram

XXXXX

Visualizing the tomogram

We can get a first glance on how the tomogram looks like:

dtmshow -otf t20s.mrc  

to use the on-the-fly access to the slice shown at each given moment, or

v = dread('t20s.mrc');dtmshow(v); 

to preload the full tomogram into a memory variable (arbitrarily called v). In either option, you will see, the proteasomes are densely packed in an layer. The layer is slightly oblique, what can be seen browsing through z or y.

dtmshow on the pt20s tomogram, View along z

Navigating on-the-fly you'll see that transitions in y are slower than transitions in z, because all the pixels of the same slice are stored sequentially in the disk.

dtmshow on the pt20s tomogram, View along y


Estimation of the missing wedge

Estimation of the missing wedge'

Creating a template

There are different strategies to create the first template. In the case where the general shape of each protein is roughly recognisable by eye, it is not difficult to just crop and align manually some of the particles. When this is not possible, you have the option of using a density map that mimics the general topology of your protein.

Through manual alignment

Manual selection of some particles

We use for this our tool dtmslice. As the tomogram is provided is fairly small you can probably just open it without any further binning.

dtmslice t20s.mrc -cc ct20

dtmslice on tomogram


dtmslice on tomogram
Pick particles with the C key
Use the wheel to go up and down in the tomogram to locate top views
TemplateMatchingMeasure.png
TemplateMatchingMenuForDtcrop.png
TemplateMatchingDtcrop.png


Manual alignment of some particles

TemplateMatchingGalleryLoad.png
TemplateMatchingGalleryShowAll.png
TemplateMatchingControlViewing.png
TemplateMatchingControlThickness.png
TemplateMatchingClickNorth.png
TemplateMatchingClickNorthTopViewX.png

Averaging manually aligned particles

TemplateMatchingAverageManual.png

Creating a tight mask

Measure distances
TemplateMatchingMarkZaxis.png
TemplateMatchingMarkXYPlane.png
TemplateMatchingClickNorthTopViewX.png
Create mask
TemplateMatchingMaskOptions.png


TemplateMatchingMaskSave.png


Cropping the borders of a template

TemplateMatchingCircshiftTemplate.png
Template cropped to 32 pixels

Through geometrical shapes

Alternatively, you can use dynamo_mask or dynamo_tube to create a synthetic model.

Creating a cross correlation process

ptm = dynamo_match(fileFull,'average48.em','mask','maskData48.em',....
    'outputFolder','cs30',...
    'ytilt',[-39,36],'sc',[1000,1000,300],'cr',360,'cs',30,'bin',1);


------------------------------------------------------------ Template matching process. computing in CPU Output folder: cs30.TM A total of 1 tiles have been created - Mb per tile (reading) : 724.19 - Mb per tile (operation) : 663.84 ... initializing output elements Preparing to run on 1 blocks Running on single processor Computing tile 1 -Range (original block): x[1:958] y[1:926] z[1:214] -Range (binned block) : x[1:479] y[1:463] z[1:107] ... tile 1 finished in 387 seconds (8 for setup; 7.73 per triplet) [ok] ... template matching process completed upto creation of cross correlation you can proceed to peak location and particle extraction. ------------------------------------------------------------

The Process object

The return of the function <notwiki>ptm</nowiki> is an object of class XXX. In short, this is an object created


Considerations when creating a process

Locating cross correlation peaks

Looking at the cross correlation map

TemplateMatchingCCRaw.png

Looking at the cross correlation profile

TemplateMatchingPeakGood.png
TemplateMatchingPeakGoodVolume.png
TemplateMatchingPeakKink.png
TemplateMatchingPeakBad.png


Extracting a table

A table can be extracted through:

myTable = pff.peaks.computeTable('mcc',0.378);

Visual evaluation of results

Looking at table positions

TemplateMatchingTable3d.png
TemplateMatchingTable3dSide.png

Looking at cropped particles

We can check how the individual particles look like on a gallery modus:

pff.peaks.browse();

This order just opens ddbrowse. We are using here the support object peaks, but this command is equivalent to just invoking ddbrowse

ddbrowse('d','cr30.TM','t',myTable);

ddbrowse with a tomogram as a data source, needing the input of a sidelength in pixels
Result launched by ddbrowse without a connected table
The table must be connected to align the particles
z-view of aligned particles
x-view of aligned particles
y-view of aligned particles

Looking at averages

o = pff.peaks.average();

TemplateMatchingAverageRaw.png
TemplateMatchingAverageRandomized.png