<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.dynamo-em.org//w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=AlmaVivas</id>
	<title>Dynamo - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.dynamo-em.org//w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=AlmaVivas"/>
	<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=Special:Contributions/AlmaVivas"/>
	<updated>2026-10-26T20:19:29Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=Walkthrough_on_hexagonal_lattice_coherence_through_neighborhood_analysis&amp;diff=5120</id>
		<title>Walkthrough on hexagonal lattice coherence through neighborhood analysis</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=Walkthrough_on_hexagonal_lattice_coherence_through_neighborhood_analysis&amp;diff=5120"/>
		<updated>2024-04-11T14:16:25Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Local analysis - lattice coherence */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Walkthroughs]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Neighborhood analysis==&lt;br /&gt;
&lt;br /&gt;
Neighbourhood analysis stands at the forefront of methods used to investigate geometrical lattice parameters and offers a wide spectrum of visualization tools. This technique is precise, targeting specific elements, yet broad enough to facilitate overarching interpretive analysis. At its core, the method constructs a latent space of connections by mapping the relative positions of neighbouring particles onto a reference framework. This mapping involves a reorientation process, wherein the &#039;N&#039; closest neighbours are repositioned within the reference particle&#039;s coordinate system, adjusted for its orientation. The richness of the latent space—characterized by the number and nature of these repositioned features—is dictated by a defined distance threshold. This threshold ranges from a minimal couple, representing the closest inter-particle distance, to the maximal extent, linking every particle within the neighbourhood to the reference point.&lt;br /&gt;
&lt;br /&gt;
For additional insights into neighborhood analysis, visit [https://www.dynamo-em.org//w/index.php?title=Neighborhood_analysis this page.]  &lt;br /&gt;
&lt;br /&gt;
==Data==&lt;br /&gt;
&lt;br /&gt;
We will use data from the initial gold standard alignment derived from five tomograms of immature HIV-1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
===Downloading===&lt;br /&gt;
&lt;br /&gt;
The data can be downloaded from [https://drive.google.com/drive/folders/1jberboXIRNp32GvZ14XV_6N2R-tnYESD this google drive.]  &lt;br /&gt;
&lt;br /&gt;
===Inspecting data===&lt;br /&gt;
&lt;br /&gt;
First, open a new local terminal and navigate to the directory containing the tutorial dataset and project.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s inspect the contents:&lt;br /&gt;
&lt;br /&gt;
 &amp;gt;&amp;gt; dfile template.em&lt;br /&gt;
    &lt;br /&gt;
    filetype: volume&lt;br /&gt;
    &lt;br /&gt;
    size: 192 x 192 x 192 &lt;br /&gt;
&lt;br /&gt;
 &amp;gt;&amp;gt; dfile table.tbl&lt;br /&gt;
  &lt;br /&gt;
    filetype: table&lt;br /&gt;
    &lt;br /&gt;
    size: 7068  x 35, aligns: 7068, averages: 7068 &lt;br /&gt;
&lt;br /&gt;
These files represent an average as a template and its associated metadata (i.e., table). We will focus on the table data.&lt;br /&gt;
&lt;br /&gt;
To visualize the particles along with their normals:&lt;br /&gt;
&lt;br /&gt;
 tbl = dread(&#039;table.tbl&#039;);&lt;br /&gt;
 figure;&lt;br /&gt;
 h = dpktbl.plots.sketch(tbl,&#039;haxis&#039;,gca());&lt;br /&gt;
 h.zlength.value=100;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:tbl-positions-normals-vlps.png|centre|thumb|450px| VLPs particle positions and normals.]]&lt;br /&gt;
&lt;br /&gt;
== Prepare (meta)data ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s select a couple of Virus-Like Particles (VLPs):&lt;br /&gt;
&lt;br /&gt;
 tblT2V2 = tbl(tbl(:,20) == 2 &amp;amp; tbl(:,22) == 2, :);&lt;br /&gt;
 tblT2V5 = tbl(tbl(:,20) == 2 &amp;amp; tbl(:,22) == 5, :);&lt;br /&gt;
 tblT2V3 = tbl(tbl(:,20) == 2 &amp;amp; tbl(:,22) == 3, :);&lt;br /&gt;
&lt;br /&gt;
To visualize:&lt;br /&gt;
&lt;br /&gt;
 figure;&lt;br /&gt;
 &lt;br /&gt;
 subplot(1, 3, 1);&lt;br /&gt;
 dpktbl.plots.sketch(tblT2V5);&lt;br /&gt;
 title(&#039;Ideal&#039;);&lt;br /&gt;
 pbaspect([1 1 1]);&lt;br /&gt;
 &lt;br /&gt;
 subplot(1, 3, 2);&lt;br /&gt;
 dpktbl.plots.sketch(tblT2V2); &lt;br /&gt;
 title(&#039;Slightly flat surface&#039;);&lt;br /&gt;
 pbaspect([1 1 1]); &lt;br /&gt;
 &lt;br /&gt;
 subplot(1, 3, 3);&lt;br /&gt;
 dpktbl.plots.sketch(tblT2V3); &lt;br /&gt;
 title(&#039;1/4 missing, flat top&#039;);&lt;br /&gt;
 pbaspect([1 1 1]); &lt;br /&gt;
&lt;br /&gt;
[[File:selected-vlps.png|centre|thumb|800px|  Selected VLPs. From left to right: ideal, medium, and low quality instances.]]&lt;br /&gt;
&lt;br /&gt;
Indeed, we will analyze three different VLP quality instances.&lt;br /&gt;
&lt;br /&gt;
== Get mean distance to closest neighbor ==&lt;br /&gt;
&lt;br /&gt;
To find the optimal distance threshold, we will use the following function to calculate the mean distance to the closest neighbor:&lt;br /&gt;
&lt;br /&gt;
 function [meanDst, stdDsts] = mean_distance_to_closest_neighbor(pts);&lt;br /&gt;
 numPts = size(pts, 1);&lt;br /&gt;
 minDsts = zeros(numPts, 1);&lt;br /&gt;
 &lt;br /&gt;
 for i = 1:numPts&lt;br /&gt;
    dsts = pdist2(pts(i,:), pts);&lt;br /&gt;
    dsts(i) = Inf;&lt;br /&gt;
    minDsts(i) = min(dsts);&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 meanDst = mean(minDsts);&lt;br /&gt;
 stdDsts = std(minDsts);&lt;br /&gt;
 fprintf(&#039;Mean distance: %.4f\nStandard deviation: %.4f \n&#039;, meanDst, stdDsts);&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Invoke the function like so: &lt;br /&gt;
&lt;br /&gt;
 [meanDst, stdDsts] =   mean_distance_to_closest_neighbor(tbl(:,24:26)+tbl(:,4:6));&lt;br /&gt;
&lt;br /&gt;
The mean distance to the closest neighbor is around 50-60 pixels.&lt;br /&gt;
 Mean distance: 50.42&lt;br /&gt;
 Standard deviation: 12.23&lt;br /&gt;
&lt;br /&gt;
For a sanity check, you might also measure the lattice directly on the average volume:&lt;br /&gt;
&lt;br /&gt;
 dshow template.em&lt;br /&gt;
&lt;br /&gt;
[[File:average-overplot-hexagonal-lattice-measurements.png|centre|thumb|400px|  Overplot average and hexagonal lattice measurements.]]&lt;br /&gt;
&lt;br /&gt;
== Neighborhood analysis computation ==&lt;br /&gt;
&lt;br /&gt;
Here, we conduct the neighborhood analysis with a distance threshold set as the mean distance plus the standard deviation:&lt;br /&gt;
&lt;br /&gt;
 tblT2V3N = dpktbl.neighborhood.analize(tblT2V3,&#039;distance&#039;,meanDst+stdDsts,&#039;modelColumn&#039;,22);&lt;br /&gt;
 tblT2V2N = dpktbl.neighborhood.analize(tblT2V2,&#039;distance&#039;,meanDst+stdDsts,&#039;modelColumn&#039;,22);&lt;br /&gt;
 tblT2V5N = dpktbl.neighborhood.analize(tblT2V5,&#039;distance&#039;,meanDst+stdDsts,&#039;modelColumn&#039;,22);&lt;br /&gt;
&lt;br /&gt;
Then, we will need the couple table since it is our new representation (i.e., latent space):&lt;br /&gt;
&lt;br /&gt;
 tblT2V3NC = real(tblT2V3N.coupleTable);&lt;br /&gt;
 tblT2V2NC = real(tblT2V2N.coupleTable);&lt;br /&gt;
 tblT2V5NC = real(tblT2V5N.coupleTable);&lt;br /&gt;
&lt;br /&gt;
Now, let&#039;s visualize first-order distance clusters with synchronized viewing:&lt;br /&gt;
&lt;br /&gt;
 datasets = {tblT2V3NC, tblT2V2NC, tblT2V5NC};&lt;br /&gt;
 titles = {&amp;quot;Incomplete + flat surface&amp;quot;, &amp;quot;Slightly flat surface&amp;quot;, &amp;quot;Ideal&amp;quot;};&lt;br /&gt;
 &lt;br /&gt;
 fig = figure;&lt;br /&gt;
 ax = gobjects(1, length(datasets));&lt;br /&gt;
 &lt;br /&gt;
 for i = 1:length(datasets)&lt;br /&gt;
    ax(i) = subplot(1, length(datasets), i, &#039;Parent&#039;, fig);&lt;br /&gt;
    pcshow(datasets{i}(:, 24:26), &#039;Parent&#039;, ax(i));&lt;br /&gt;
    pbaspect(ax(i), [1 1 1]);&lt;br /&gt;
    % Set titles using text, since the title function was not working&lt;br /&gt;
    xl = xlim(ax(i));&lt;br /&gt;
    yl = ylim(ax(i));&lt;br /&gt;
    zl = zlim(ax(i));&lt;br /&gt;
    titlePos = [mean(xl), yl(2), zl(2)];&lt;br /&gt;
    text(ax(i), titlePos(1), titlePos(2), titlePos(3), titles{i}, ...&lt;br /&gt;
        &#039;HorizontalAlignment&#039;, &#039;center&#039;, &#039;Color&#039;, &#039;white&#039;, ...&lt;br /&gt;
        &#039;FontSize&#039;, 14, &#039;FontWeight&#039;, &#039;bold&#039;, &#039;BackgroundColor&#039;, &#039;black&#039;);&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 link = linkprop(ax, {&#039;CameraUpVector&#039;, &#039;CameraPosition&#039;, &#039;CameraTarget&#039;, &#039;CameraViewAngle&#039;, &#039;XLim&#039;, &#039;YLim&#039;, &#039;ZLim&#039;});&lt;br /&gt;
 setappdata(gcf, &#039;StoreTheLink&#039;, link);&lt;br /&gt;
 &lt;br /&gt;
 for a = ax&lt;br /&gt;
    rotate3d(a, &#039;on&#039;);&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
[[File:first-order-distance-clusters-three-different-vlps.png|centre|thumb|800px|   First-order distance clusters obtained vía neighborhood analysis. From left to right: low, medium, and high quality instances.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The color, by default, represents the Z-axis. Notice that the better the quality of the VLP, the less sparse each cluster is.&lt;br /&gt;
&lt;br /&gt;
== Local analysis - lattice coherence ==&lt;br /&gt;
&lt;br /&gt;
To quantify lattice coherence, we apply [https://www.youtube.com/watch?v=R2e3Ls9H_fc k-means clustering] and calculate the Euclidean norms for each centroid. The standard deviation of these norms provides a measure of cluster sparsity and hence, lattice coherence.&lt;br /&gt;
&lt;br /&gt;
We encapsulate this process in a function:&lt;br /&gt;
&lt;br /&gt;
 function [idx, cc_final, results, results_std] = perform_lattice_analysis(data, symm)&lt;br /&gt;
    [idx, cc_final] = kmeans(data, symm);&lt;br /&gt;
    results = vecnorm(cc_final, 2, 2); &lt;br /&gt;
    results_std = std(results); &lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Then, execute the analysis:&lt;br /&gt;
&lt;br /&gt;
 symm = 6; &lt;br /&gt;
 [idx_ideal, cc_ideal_final, results_ideal, std_ideal] = perform_lattice_analysis(tblT2V5NC(:,24:26),symm);&lt;br /&gt;
 [idx_slightly_flat, cc_sf_final, results_sf, std_sf] = perform_lattice_analysis(tblT2V2NC(:,24:26),symm);&lt;br /&gt;
 [idx_incomplete_and_flat, cc_implt_final, results_implt, std_implt] = perform_lattice_analysis(tblT2V3NC(:,24:26),symm);&lt;br /&gt;
&lt;br /&gt;
Display results neatly in a table&lt;br /&gt;
&lt;br /&gt;
 resultsTable = table(std_ideal, std_sf, std_implt, &#039;VariableNames&#039;, {&#039;Ideal&#039;, &#039;SlightlyFlat&#039;, &#039;IncompleteFlat&#039;}, &#039;RowNames&#039;, {&#039;StandardDeviation&#039;});&lt;br /&gt;
 &lt;br /&gt;
 disp(resultsTable);&lt;br /&gt;
&lt;br /&gt;
This will output:&lt;br /&gt;
        &lt;br /&gt;
                               Ideal             SlightlyFlat        IncompleteFlat                       &lt;br /&gt;
                         __________________    _________________    _________________&lt;br /&gt;
                           &lt;br /&gt;
    Standard deviation    0.0933777687916592    0.321031652546273    0.574732108201886&lt;br /&gt;
&lt;br /&gt;
As demonstrated, the qualitative degree of imperfection correlates with our lattice coherence measurements.&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=Walkthrough_on_hexagonal_lattice_coherence_through_neighborhood_analysis&amp;diff=5119</id>
		<title>Walkthrough on hexagonal lattice coherence through neighborhood analysis</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=Walkthrough_on_hexagonal_lattice_coherence_through_neighborhood_analysis&amp;diff=5119"/>
		<updated>2024-04-11T14:16:16Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Local analysis - lattice coherence */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Walkthroughs]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Neighborhood analysis==&lt;br /&gt;
&lt;br /&gt;
Neighbourhood analysis stands at the forefront of methods used to investigate geometrical lattice parameters and offers a wide spectrum of visualization tools. This technique is precise, targeting specific elements, yet broad enough to facilitate overarching interpretive analysis. At its core, the method constructs a latent space of connections by mapping the relative positions of neighbouring particles onto a reference framework. This mapping involves a reorientation process, wherein the &#039;N&#039; closest neighbours are repositioned within the reference particle&#039;s coordinate system, adjusted for its orientation. The richness of the latent space—characterized by the number and nature of these repositioned features—is dictated by a defined distance threshold. This threshold ranges from a minimal couple, representing the closest inter-particle distance, to the maximal extent, linking every particle within the neighbourhood to the reference point.&lt;br /&gt;
&lt;br /&gt;
For additional insights into neighborhood analysis, visit [https://www.dynamo-em.org//w/index.php?title=Neighborhood_analysis this page.]  &lt;br /&gt;
&lt;br /&gt;
==Data==&lt;br /&gt;
&lt;br /&gt;
We will use data from the initial gold standard alignment derived from five tomograms of immature HIV-1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
===Downloading===&lt;br /&gt;
&lt;br /&gt;
The data can be downloaded from [https://drive.google.com/drive/folders/1jberboXIRNp32GvZ14XV_6N2R-tnYESD this google drive.]  &lt;br /&gt;
&lt;br /&gt;
===Inspecting data===&lt;br /&gt;
&lt;br /&gt;
First, open a new local terminal and navigate to the directory containing the tutorial dataset and project.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s inspect the contents:&lt;br /&gt;
&lt;br /&gt;
 &amp;gt;&amp;gt; dfile template.em&lt;br /&gt;
    &lt;br /&gt;
    filetype: volume&lt;br /&gt;
    &lt;br /&gt;
    size: 192 x 192 x 192 &lt;br /&gt;
&lt;br /&gt;
 &amp;gt;&amp;gt; dfile table.tbl&lt;br /&gt;
  &lt;br /&gt;
    filetype: table&lt;br /&gt;
    &lt;br /&gt;
    size: 7068  x 35, aligns: 7068, averages: 7068 &lt;br /&gt;
&lt;br /&gt;
These files represent an average as a template and its associated metadata (i.e., table). We will focus on the table data.&lt;br /&gt;
&lt;br /&gt;
To visualize the particles along with their normals:&lt;br /&gt;
&lt;br /&gt;
 tbl = dread(&#039;table.tbl&#039;);&lt;br /&gt;
 figure;&lt;br /&gt;
 h = dpktbl.plots.sketch(tbl,&#039;haxis&#039;,gca());&lt;br /&gt;
 h.zlength.value=100;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:tbl-positions-normals-vlps.png|centre|thumb|450px| VLPs particle positions and normals.]]&lt;br /&gt;
&lt;br /&gt;
== Prepare (meta)data ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s select a couple of Virus-Like Particles (VLPs):&lt;br /&gt;
&lt;br /&gt;
 tblT2V2 = tbl(tbl(:,20) == 2 &amp;amp; tbl(:,22) == 2, :);&lt;br /&gt;
 tblT2V5 = tbl(tbl(:,20) == 2 &amp;amp; tbl(:,22) == 5, :);&lt;br /&gt;
 tblT2V3 = tbl(tbl(:,20) == 2 &amp;amp; tbl(:,22) == 3, :);&lt;br /&gt;
&lt;br /&gt;
To visualize:&lt;br /&gt;
&lt;br /&gt;
 figure;&lt;br /&gt;
 &lt;br /&gt;
 subplot(1, 3, 1);&lt;br /&gt;
 dpktbl.plots.sketch(tblT2V5);&lt;br /&gt;
 title(&#039;Ideal&#039;);&lt;br /&gt;
 pbaspect([1 1 1]);&lt;br /&gt;
 &lt;br /&gt;
 subplot(1, 3, 2);&lt;br /&gt;
 dpktbl.plots.sketch(tblT2V2); &lt;br /&gt;
 title(&#039;Slightly flat surface&#039;);&lt;br /&gt;
 pbaspect([1 1 1]); &lt;br /&gt;
 &lt;br /&gt;
 subplot(1, 3, 3);&lt;br /&gt;
 dpktbl.plots.sketch(tblT2V3); &lt;br /&gt;
 title(&#039;1/4 missing, flat top&#039;);&lt;br /&gt;
 pbaspect([1 1 1]); &lt;br /&gt;
&lt;br /&gt;
[[File:selected-vlps.png|centre|thumb|800px|  Selected VLPs. From left to right: ideal, medium, and low quality instances.]]&lt;br /&gt;
&lt;br /&gt;
Indeed, we will analyze three different VLP quality instances.&lt;br /&gt;
&lt;br /&gt;
== Get mean distance to closest neighbor ==&lt;br /&gt;
&lt;br /&gt;
To find the optimal distance threshold, we will use the following function to calculate the mean distance to the closest neighbor:&lt;br /&gt;
&lt;br /&gt;
 function [meanDst, stdDsts] = mean_distance_to_closest_neighbor(pts);&lt;br /&gt;
 numPts = size(pts, 1);&lt;br /&gt;
 minDsts = zeros(numPts, 1);&lt;br /&gt;
 &lt;br /&gt;
 for i = 1:numPts&lt;br /&gt;
    dsts = pdist2(pts(i,:), pts);&lt;br /&gt;
    dsts(i) = Inf;&lt;br /&gt;
    minDsts(i) = min(dsts);&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 meanDst = mean(minDsts);&lt;br /&gt;
 stdDsts = std(minDsts);&lt;br /&gt;
 fprintf(&#039;Mean distance: %.4f\nStandard deviation: %.4f \n&#039;, meanDst, stdDsts);&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Invoke the function like so: &lt;br /&gt;
&lt;br /&gt;
 [meanDst, stdDsts] =   mean_distance_to_closest_neighbor(tbl(:,24:26)+tbl(:,4:6));&lt;br /&gt;
&lt;br /&gt;
The mean distance to the closest neighbor is around 50-60 pixels.&lt;br /&gt;
 Mean distance: 50.42&lt;br /&gt;
 Standard deviation: 12.23&lt;br /&gt;
&lt;br /&gt;
For a sanity check, you might also measure the lattice directly on the average volume:&lt;br /&gt;
&lt;br /&gt;
 dshow template.em&lt;br /&gt;
&lt;br /&gt;
[[File:average-overplot-hexagonal-lattice-measurements.png|centre|thumb|400px|  Overplot average and hexagonal lattice measurements.]]&lt;br /&gt;
&lt;br /&gt;
== Neighborhood analysis computation ==&lt;br /&gt;
&lt;br /&gt;
Here, we conduct the neighborhood analysis with a distance threshold set as the mean distance plus the standard deviation:&lt;br /&gt;
&lt;br /&gt;
 tblT2V3N = dpktbl.neighborhood.analize(tblT2V3,&#039;distance&#039;,meanDst+stdDsts,&#039;modelColumn&#039;,22);&lt;br /&gt;
 tblT2V2N = dpktbl.neighborhood.analize(tblT2V2,&#039;distance&#039;,meanDst+stdDsts,&#039;modelColumn&#039;,22);&lt;br /&gt;
 tblT2V5N = dpktbl.neighborhood.analize(tblT2V5,&#039;distance&#039;,meanDst+stdDsts,&#039;modelColumn&#039;,22);&lt;br /&gt;
&lt;br /&gt;
Then, we will need the couple table since it is our new representation (i.e., latent space):&lt;br /&gt;
&lt;br /&gt;
 tblT2V3NC = real(tblT2V3N.coupleTable);&lt;br /&gt;
 tblT2V2NC = real(tblT2V2N.coupleTable);&lt;br /&gt;
 tblT2V5NC = real(tblT2V5N.coupleTable);&lt;br /&gt;
&lt;br /&gt;
Now, let&#039;s visualize first-order distance clusters with synchronized viewing:&lt;br /&gt;
&lt;br /&gt;
 datasets = {tblT2V3NC, tblT2V2NC, tblT2V5NC};&lt;br /&gt;
 titles = {&amp;quot;Incomplete + flat surface&amp;quot;, &amp;quot;Slightly flat surface&amp;quot;, &amp;quot;Ideal&amp;quot;};&lt;br /&gt;
 &lt;br /&gt;
 fig = figure;&lt;br /&gt;
 ax = gobjects(1, length(datasets));&lt;br /&gt;
 &lt;br /&gt;
 for i = 1:length(datasets)&lt;br /&gt;
    ax(i) = subplot(1, length(datasets), i, &#039;Parent&#039;, fig);&lt;br /&gt;
    pcshow(datasets{i}(:, 24:26), &#039;Parent&#039;, ax(i));&lt;br /&gt;
    pbaspect(ax(i), [1 1 1]);&lt;br /&gt;
    % Set titles using text, since the title function was not working&lt;br /&gt;
    xl = xlim(ax(i));&lt;br /&gt;
    yl = ylim(ax(i));&lt;br /&gt;
    zl = zlim(ax(i));&lt;br /&gt;
    titlePos = [mean(xl), yl(2), zl(2)];&lt;br /&gt;
    text(ax(i), titlePos(1), titlePos(2), titlePos(3), titles{i}, ...&lt;br /&gt;
        &#039;HorizontalAlignment&#039;, &#039;center&#039;, &#039;Color&#039;, &#039;white&#039;, ...&lt;br /&gt;
        &#039;FontSize&#039;, 14, &#039;FontWeight&#039;, &#039;bold&#039;, &#039;BackgroundColor&#039;, &#039;black&#039;);&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 link = linkprop(ax, {&#039;CameraUpVector&#039;, &#039;CameraPosition&#039;, &#039;CameraTarget&#039;, &#039;CameraViewAngle&#039;, &#039;XLim&#039;, &#039;YLim&#039;, &#039;ZLim&#039;});&lt;br /&gt;
 setappdata(gcf, &#039;StoreTheLink&#039;, link);&lt;br /&gt;
 &lt;br /&gt;
 for a = ax&lt;br /&gt;
    rotate3d(a, &#039;on&#039;);&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
[[File:first-order-distance-clusters-three-different-vlps.png|centre|thumb|800px|   First-order distance clusters obtained vía neighborhood analysis. From left to right: low, medium, and high quality instances.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The color, by default, represents the Z-axis. Notice that the better the quality of the VLP, the less sparse each cluster is.&lt;br /&gt;
&lt;br /&gt;
== Local analysis - lattice coherence ==&lt;br /&gt;
&lt;br /&gt;
To quantify lattice coherence, we apply [ https://www.youtube.com/watch?v=R2e3Ls9H_fc k-means clustering] and calculate the Euclidean norms for each centroid. The standard deviation of these norms provides a measure of cluster sparsity and hence, lattice coherence.&lt;br /&gt;
&lt;br /&gt;
We encapsulate this process in a function:&lt;br /&gt;
&lt;br /&gt;
 function [idx, cc_final, results, results_std] = perform_lattice_analysis(data, symm)&lt;br /&gt;
    [idx, cc_final] = kmeans(data, symm);&lt;br /&gt;
    results = vecnorm(cc_final, 2, 2); &lt;br /&gt;
    results_std = std(results); &lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Then, execute the analysis:&lt;br /&gt;
&lt;br /&gt;
 symm = 6; &lt;br /&gt;
 [idx_ideal, cc_ideal_final, results_ideal, std_ideal] = perform_lattice_analysis(tblT2V5NC(:,24:26),symm);&lt;br /&gt;
 [idx_slightly_flat, cc_sf_final, results_sf, std_sf] = perform_lattice_analysis(tblT2V2NC(:,24:26),symm);&lt;br /&gt;
 [idx_incomplete_and_flat, cc_implt_final, results_implt, std_implt] = perform_lattice_analysis(tblT2V3NC(:,24:26),symm);&lt;br /&gt;
&lt;br /&gt;
Display results neatly in a table&lt;br /&gt;
&lt;br /&gt;
 resultsTable = table(std_ideal, std_sf, std_implt, &#039;VariableNames&#039;, {&#039;Ideal&#039;, &#039;SlightlyFlat&#039;, &#039;IncompleteFlat&#039;}, &#039;RowNames&#039;, {&#039;StandardDeviation&#039;});&lt;br /&gt;
 &lt;br /&gt;
 disp(resultsTable);&lt;br /&gt;
&lt;br /&gt;
This will output:&lt;br /&gt;
        &lt;br /&gt;
                               Ideal             SlightlyFlat        IncompleteFlat                       &lt;br /&gt;
                         __________________    _________________    _________________&lt;br /&gt;
                           &lt;br /&gt;
    Standard deviation    0.0933777687916592    0.321031652546273    0.574732108201886&lt;br /&gt;
&lt;br /&gt;
As demonstrated, the qualitative degree of imperfection correlates with our lattice coherence measurements.&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=Complete_walkthrough_on_FHV_virus_(G%C3%B6ttingen_2024)&amp;diff=5104</id>
		<title>Complete walkthrough on FHV virus (Göttingen 2024)</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=Complete_walkthrough_on_FHV_virus_(G%C3%B6ttingen_2024)&amp;diff=5104"/>
		<updated>2024-04-08T11:20:40Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: Created page with &amp;quot;Category:Walkthroughs  This walkthrough uses a small size example based on a real tomogram to cover several tasks.  == The example data set ==  The data is a fraction of a...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Walkthroughs]]&lt;br /&gt;
&lt;br /&gt;
This walkthrough uses a small size example based on a real tomogram to cover several tasks.&lt;br /&gt;
&lt;br /&gt;
== The example data set ==&lt;br /&gt;
&lt;br /&gt;
The data is a fraction of a tomogram.  The full tomogram was used in &amp;quot;Cryo-electron tomography reveals novel features of a viral RNA replication compartment.&amp;quot;  (Ertel et al.), and represents several FHV viruses docked in the outer membrane of a mitochondrion.&lt;br /&gt;
&lt;br /&gt;
 [[File:FhvDefinitionCrown.png|thumb|center|500px| Average for several hundreds of particles. The &amp;quot;crown&amp;quot; area is shown under a red shadow.]]&lt;br /&gt;
&lt;br /&gt;
== Downloading ==&lt;br /&gt;
&lt;br /&gt;
Open a new local terminal and navigate to the directory where you just created the tutorial dataset and project.&lt;br /&gt;
 &amp;lt;tt &amp;gt; ~/Desktop/workshop_data/advanced_starter_guide&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Size check of a file===&lt;br /&gt;
&lt;br /&gt;
You&#039;re probably curious to see what&#039;s inside, so that let&#039;s write first:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dfile crop.rec&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to let &#039;&#039;Dynamo&#039;&#039; check the dimensions of the file. The header of a &amp;lt;tt&amp;gt;.rec&amp;lt;/tt&amp;gt; file is readed as a regular &amp;lt;tt&amp;gt;.mrc&amp;lt;/tt&amp;gt;, yielding:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;filetype: volume&lt;br /&gt;
 size: 1285 x 956 x 786&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, it&#039;s a tomogram.&lt;br /&gt;
&lt;br /&gt;
===Lightweight visualization===&lt;br /&gt;
We can inspect quickly its contents with [[Viewing_tomograms#dtmshow | dtmshow]]&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dtmshow -otf crop.rec&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hereby, the flag &amp;lt;tt&amp;gt;-otf&amp;lt;/tt&amp;gt; means &amp;quot;on the fly&amp;quot;, telling &amp;lt;tt&amp;gt;dtmshow&amp;lt;/tt&amp;gt; to &#039;&#039;not&#039;&#039; preload the full tomogram, but to access in disk the individual slices that are needed when inspecting a particular area.&lt;br /&gt;
&lt;br /&gt;
 [[File:FhvTomoshowOnTheFly.png|thumb|center|500px|Basic controls of &amp;lt;tt&amp;gt;dtmshow&amp;lt;/tt&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Go up and down. We want to select the locations were the vesicles intersect the mitochondrion membrane and average them together. For this, we need to &#039;&#039;catalogue&#039;&#039; the tomogram, so that our annotations are stored with a clear relationship with the tomogram.&lt;br /&gt;
&lt;br /&gt;
== Cataloguing the tomogram ==&lt;br /&gt;
&lt;br /&gt;
We can create catalogues just to contain a single tomogram. They are useful to keep track of all annotations, and of the typical transforms (binning, cropping of fractions) that we usually perform on a larged size tomogram of interest. In this case, we can create the catalogue directly from the command line: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt; dcm -create fhv &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;tt&amp;gt;dcm&amp;lt;/tt&amp;gt; is the short form of &amp;lt;tt&amp;gt;dynamo_catalogue_manager&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;fhv&amp;lt;/tt&amp;gt; is just an arbitrary name. The just created catalogue is empty, and we can add our tomogram with:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;tt&amp;gt;dcm -c fhv -at crop.rec&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can check that the tomogram is in the catalogue by asking &#039;&#039;Dynamo&#039;&#039; to show the contents of the catalogue&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dcm -c fhv -l tomograms&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dcm -c fhv -l t&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The flag &amp;lt;tt&amp;gt;-l&amp;lt;/tt&amp;gt; asks &#039;&#039;Dynamo&#039;&#039; to list items of a given category of catalogue contents, in this case &amp;lt;tt&amp;gt;tomograms&amp;lt;/tt&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Prebinning the tomograms ===&lt;br /&gt;
&lt;br /&gt;
We typically want to [[prebinned tomograms | prebin]] the tomogram, i.e., have a version of |smaller size that is known to the catalogue. This version will be useful in some operations that require a full tomogram in memory, an operation that can consume much memory and need a long time. In this example, this would not be necessary: a tomogram with a sidelength on x and y of ~1000 pixels shouldn&#039;t pose any visualization problem. We do it anyway for the exercise with the command:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dynamo_catalogue_bin(&#039;fhv&#039;, 1, &#039;zchunk&#039;, 300); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where the parameter &amp;lt;tt&amp;gt;zchunk&amp;lt;/tt&amp;gt; represents the maximum number of z slices that are kept simultaneously in the memory during the binning process. This parameter might be important for larger size tomograms.&lt;br /&gt;
&lt;br /&gt;
=== Operation with GUI===&lt;br /&gt;
&lt;br /&gt;
These steps could have been performed thorough the &amp;lt;tt&amp;gt;dcm&amp;lt;/tt&amp;gt; GUI&lt;br /&gt;
&lt;br /&gt;
== Annotation of particle positions ==&lt;br /&gt;
Now we can open the tomogram through the catalogue:&lt;br /&gt;
 &amp;lt;tt&amp;gt;dtmslice crop.rec -c fhv  -prebinned 1 &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 [[File:FhvTomosliceOpen.png|thumb|center|500px|dtmslice opened on the FHV example tomogram&amp;lt;tt&amp;gt;dtmslice&amp;lt;/tt&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Probably you don&#039;t like the initial contrast, change it with the button in the toolbar.&lt;br /&gt;
&lt;br /&gt;
 [[File:FhvTomosliceContrast.png|thumb|center|500px|contrast adjustment options inside &amp;lt;tt&amp;gt;dtmslice&amp;lt;/tt&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
=== Navigating the tomogram ===&lt;br /&gt;
&lt;br /&gt;
* left click and drag the slice with your mouse to move it up and down&lt;br /&gt;
* this can also be achieved with the controls on the left hand side&lt;br /&gt;
* ctrl + left click and drag will change your viewpoint of the 3d scene&lt;br /&gt;
* shift + left click and drag will move the center of rotation&lt;br /&gt;
* ctrl + mouse wheel up/down will zoom in or out of the scene&lt;br /&gt;
&lt;br /&gt;
Other [[Dtmslice#Viewing controls | axiliary tools]] are the keys x,y,z to change the slice orientation, the number of projected slices (called &amp;quot;thickness&amp;quot; in the GUI controls), the transparency of the slice.&lt;br /&gt;
&lt;br /&gt;
You can reset the scene at any time by hitting the reset button.&lt;br /&gt;
&lt;br /&gt;
You can save slices for viewing later with the s key.&lt;br /&gt;
&lt;br /&gt;
=== Creation of models to contain annotations===&lt;br /&gt;
&lt;br /&gt;
In this example we just want to manually pick some particles. This can be done creating a general or box [[models|model]], which will [[model pool | reside in memory  ]] till we save it into the catalogue. &lt;br /&gt;
&lt;br /&gt;
 [[File:FhvBoxesModel.png|thumb|center|500px|Creating a new model in the scene. Each annotation is represented by a box]]&lt;br /&gt;
&lt;br /&gt;
After creating the model, it will be only model currently active in the &amp;lt;tt&amp;gt;dtmslice&amp;lt;/tt&amp;gt; scene.  You can add new points pressing on [c].  The idea is to mark on the positions where you see the &amp;quot;neck&amp;quot; of a vesicle (what we called &amp;quot;crowns&amp;quot;) in contact with the outer mitochondrial membrane.&lt;br /&gt;
&lt;br /&gt;
[[File:FhvCloseUp.png|thumb|center|500px|Clicking the crowns on screen]]&lt;br /&gt;
&lt;br /&gt;
The last marked point can be deleted by pressing [delete]. An arbitrary point can be deleted by clicking on it with the auxiliary mouse button. This will open a menu that includes the option of deleting the point (through Ctrl+X in Linux or Cmmd+X in Mac).&lt;br /&gt;
&lt;br /&gt;
At this stage you probably want to change the transparence of the depicted slice, so that you can control which objects have been already clicked below the depicted slide.&lt;br /&gt;
&lt;br /&gt;
 [[File:FhvSelectedPoints.png|thumb|center|500px|Selection of points. Transparency of slide was set to 0.8]].&lt;br /&gt;
&lt;br /&gt;
When you are done, remember to save the model, using the menu options on active model or simply clicking on the disk icon in tomoslice.&lt;br /&gt;
&lt;br /&gt;
== Cropping particles ==&lt;br /&gt;
&lt;br /&gt;
Now we want to use the positions that we have marked to extract the subtomograms and format them as a [[data folder]]. The first thing we need is an estimation of the sidelength in pixels of each of the subtomograms. In [[dtmslice]] We can use the keys [1] and [2] to define two anchor points that appear as rombohedra. Clicking (with the right button) onto the black dashed that links the will show on screen both coordinates and the distance between them. All distances are reported in pixels of the non-binned tomogram: even if you are using a binned version, &#039;&#039;Dynamo&#039;&#039; keeps track of it.&lt;br /&gt;
&lt;br /&gt;
 [[File:FhvMeasureDistance.png|thumb|center|500px|Measuring distances with [1] , [2] and right-click]].&lt;br /&gt;
&lt;br /&gt;
We will thus choose to create a datafolder with a cubic sidelength of 128 pixels (remember that the particles will be cropped in the &#039;&#039;unbinned&#039;&#039; tomogram). This will ensure that the crowns fit comfortably inside the physical box, even if our manual picking imposes an error of several pixels. If you were using, say, a &#039;&#039;thickness&#039;&#039; parameter of 10 pixles in &amp;lt;tt&amp;gt;dtmslice&amp;lt;/tt&amp;gt;, you have to count with at least this inaccuracy in the location of the particles.&lt;br /&gt;
&lt;br /&gt;
Now, we check that the  catalogued tomogram contains the model that we manually picked before:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;gt;&amp;gt; dcmodels fhv&lt;br /&gt;
Volume 1 contains 1 models in total&lt;br /&gt;
/Users/casdanie//fhv/tomograms/volume_1/models/mboxes.omd&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In your system, instead of &amp;lt;tt&amp;gt;/Users/casdanie/&amp;lt;/tt&amp;gt; you will see the path to the  folder where you created the catalogue &amp;lt;tt&amp;gt;fhv&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Creating a table ===&lt;br /&gt;
We could just use  the catalogue GUI to extract the particles, be it is also possible to proceed directly  with the command line. We will use the  &amp;lt;tt&amp;gt;dtcrop&amp;lt;/tt&amp;gt; command, .which requires preparing a [[table]] with the information of the model. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;m = dread(&#039;/Users/casdanie/fhv/tomograms/volume_1/models/mboxes.omd&#039;);&lt;br /&gt;
t = m.grepTable();&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, you read the file into a model object (which we arbitrarily choose to call &amp;lt;tt&amp;gt;m&amp;lt;/tt&amp;gt;), and then you use the &amp;lt;tt&amp;gt;grepTable&amp;lt;/tt&amp;gt; method on this object to extract a variable into your workspace. We arbitrarily call it &amp;lt;tt&amp;gt;t&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Note that we can extract models directly from the output of &amp;lt;tt&amp;gt;dcmodels&amp;lt;/tt&amp;gt;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;dcmodels fhv -i 1 -ws o;&lt;br /&gt;
m = dread(o.files{1});&lt;br /&gt;
t = m.grepTable();&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
i.e., we load the answer of &amp;lt;tt&amp;gt;dcmodels&amp;lt;/tt&amp;gt; for volume index &amp;lt;tt&amp;gt;-i 1&amp;lt;/tt&amp;gt; in the output variable &amp;lt;tt&amp;gt;o&amp;lt;/tt&amp;gt;.  Inside it, there is a field called &amp;lt;tt&amp;gt;&#039;files&#039;&amp;lt;/tt&amp;gt; which contains a [[matlab cell array| cell array]] of files containing models.  Then we read the first entry &amp;lt;tt&amp;gt;o.files{1}&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Whichever way you create the table variable &amp;lt;tt&amp;gt;t&amp;lt;/tt&amp;gt;, it is just a matrix with a row for each particle, and a summary of the information coded inside can be created through:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;gt;&amp;gt; dtinfo(t);&lt;br /&gt;
 &lt;br /&gt;
        size                :  22 35 &lt;br /&gt;
        NaNs                :  0&lt;br /&gt;
 &lt;br /&gt;
 COLUMN &lt;br /&gt;
[  2  ] marked for alignment:  22&lt;br /&gt;
[  3  ] included in average :  22&lt;br /&gt;
[ 4-6 ] shifts              :  all zero&lt;br /&gt;
[ 7-9 ] angles              :  all zero&lt;br /&gt;
[  10 ] cross correlation   :  min: 0.00  max: 0.00  mean: 0.00  std: 0.00&lt;br /&gt;
[  13 ] Fourier sampling    :  1 (single tilt around y) &lt;br /&gt;
[  13 ] fsampling types     :  all of the same type &lt;br /&gt;
[14-15] ytilt range         :  min:120.00   max:120.00&lt;br /&gt;
[16-17] xtilt range         :  min:120.00   max:120.00&lt;br /&gt;
[  20 ] linked volumes      :  total 1 (labels: [1])&lt;br /&gt;
[  21 ] regions inside tomograms :  total 1 (labels: [0])&lt;br /&gt;
[  22 ] user-defined classes:  total 1 (labels: [0])&lt;br /&gt;
[  23 ] annotation types    :  total 1 (labels: [0])&lt;br /&gt;
[24-26] spatial locations   :  initialized: 22&lt;br /&gt;
[  24 ]   *  x              :  min: 645.21  max: 1001.92  mean: 799.05  std: 109.44&lt;br /&gt;
[  25 ]   *  y              :  min: 23.78  max: 917.51  mean: 484.07  std: 271.28&lt;br /&gt;
[  26 ]   *  z              :  min: 198.00  max: 563.00  mean: 415.55  std: 114.03&lt;br /&gt;
[  31 ] original tags       :  total 1 (labels: [0])&lt;br /&gt;
[  32 ] compacted particles :  total 1 (labels: [1])&lt;br /&gt;
[  34 ] references          :  total 1 (labels: [0])&lt;br /&gt;
[  35 ] subreferences       :  total 1 (labels: [0])&lt;br /&gt;
[  36 ] apix                :  Warning: column not available in this table&lt;br /&gt;
[  37 ] defocus             :  Warning: column not available in this table&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Using &amp;lt;tt&amp;gt;dtcrop&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
 &lt;br /&gt;
The simplest  syntax of &amp;lt;tt&amp;gt;dtcrop&amp;lt;/tt&amp;gt; requires passing the name of the tomogram from which we want to crop (syntax varies for [[ Particle extraction#Extract from different tomograms| cropping from multiple tomograms]]). We know that the file is &amp;lt;tt&amp;gt;crop.rec&amp;lt;/tt&amp;gt;, and we could directly insert this name in the command. But a catalogued model already contains information about its source tomogram (inside its property &amp;lt;tt&amp;gt;cvolume&amp;lt;/tt&amp;gt;), so that we can always track it back. We could then define a variable &amp;lt;tt&amp;gt;tomogramFile&amp;lt;/tt&amp;gt; by accessing this information inside the model variable &amp;lt;tt&amp;gt;m&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;tomogramFile = m.cvolume.file();&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if you get a warning at this stage, don&#039;t worry, the command still worked.&lt;br /&gt;
&lt;br /&gt;
You can then launch the cropping order:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;o = dtcrop(tomogramFile,t,&#039;particlesData&#039;,128);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where you could add the &amp;lt;tt&amp;gt;mw&amp;lt;/tt&amp;gt; flag to let &#039;&#039;Dynamo&#039;&#039; use several cores. In any case, for this number or particles the cropping should take some seconds. The last part of the final output into screen should look like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;21 [read_subtomogram] Volume has size 1285 956 786&lt;br /&gt;
[read_subtomogram] Accessing subvolume x: 713:840; y: 339:466; z: 160:287  totalling ~ 16.0Mb&lt;br /&gt;
Elapsed time is 0.191014 seconds.&lt;br /&gt;
22 &lt;br /&gt;
Total time invested in cropping: 7s&lt;br /&gt;
[table_crop] Done extracting 20 particles&lt;br /&gt;
             from tomogram      :&amp;quot;/Users/casdanie/dynamo/devmac/workplace/paris/crop.rec&amp;quot; &lt;br /&gt;
             destination folder :&amp;quot;particlesData&amp;quot; &lt;br /&gt;
             excluded particles : 2   &lt;br /&gt;
 &lt;br /&gt;
 [ok] table_crop &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
informing you that some of the particles where excluded, as they were probably too close to the boundary of the tomogram, given the sidelength we asked for.  Inside the created data folder,&lt;br /&gt;
you will find the table &amp;lt;tt&amp;gt;particlesData/crop.tbl&amp;lt;/tt&amp;gt;, which only indexes the actually cropped particles.&lt;br /&gt;
&lt;br /&gt;
=== Creating an average ===&lt;br /&gt;
 &lt;br /&gt;
The particles can now be averaged together. They have different orientations, but in this tomogram we only have a fraction of the membrane. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;oa = daverage(&#039;particlesData&#039;,&#039;t&#039;,&#039;particlesData/crop.tbl&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to let &#039;&#039;Dynamo&#039;&#039; pass maps into Chimera, you have to inform &#039;&#039;Dynamo&#039;&#039;  on the location of Chimera. For instance: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dchimera -setPath  /usr/local/bin/ &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please adapt it to the location of Chimera in your file system.&lt;br /&gt;
&lt;br /&gt;
To open your average in chimera&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;tt&amp;gt; dchimera(oa.average) &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project to find membrane orientations==&lt;br /&gt;
&lt;br /&gt;
We first need to create files with the average and the table that we have till now in memory:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;dwrite(t,&#039;raw.tbl&#039;);&lt;br /&gt;
dwrite(oa.average,&#039;rawTemplate.em&#039;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can create a project directly thorugh the command line:&lt;br /&gt;
 &amp;lt;tt&amp;gt;dcp.new(&#039;first&#039;,&#039;d&#039;,&#039;particlesData&#039;,&#039;template&#039;,&#039;rawTemplate.em&#039;,&#039;masks&#039;,&#039;default&#039;,&#039;t&#039;,&#039;particlesData/crop.tbl&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...and go directly to the panel of numerical parameters to create a project adapted for catching the general orientation of the membrane:&lt;br /&gt;
 [[File:FhvFirstParameters.png|thumb|center|500px| Numerical parameters for just membrane orientation]]&lt;br /&gt;
&lt;br /&gt;
Also, remember to visit the window for execution environment, and select the appropriate settings. If you are working with Matlab, select &#039;&#039;Matlab&#039;&#039;(for one single core) or &amp;quot;Matlab_parfor&amp;quot; (if you are going to several cores. Be aware that it requires the parallel computing toolbox.). If working with the standalone, use the [[standalone]]  option.  In both cases, select the number of cores for alignment (green box in the picture below) and averaging (blue and green arrow) .  &lt;br /&gt;
&lt;br /&gt;
 [[File:fhv_any_computing_enviroment.png|thumb|center|500px| Selecting the execution modus]]&lt;br /&gt;
&lt;br /&gt;
You can operate the project management operations from the GUI or the command line. First checking:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dvcheck first&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then unfolding &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dvunfold first&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and finally running it by invoking the name of the execution script.&lt;br /&gt;
&lt;br /&gt;
* If you are running in Matlab use: &amp;lt;code&amp;gt;run first.m &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* For the standalone, first opening a new terminal (in a new tab), loading &#039;&#039;Dynamo&#039;&#039; but not running it and starting the alignment project by typing: &amp;lt;code&amp;gt;./first.exe&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the project, we check the created average:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;ddb first:a -v &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command asks the  database (hence &amp;lt;tt&amp;gt;db&amp;lt;/tt&amp;gt;) of the project &amp;lt;tt&amp;gt;first&amp;lt;/tt&amp;gt; to look for the item of type &amp;lt;tt&amp;gt;average&amp;lt;/tt&amp;gt;, by default accessing  the last computed one. The flag &amp;lt;tt&amp;gt;-v&amp;lt;/tt&amp;gt; sends the output of the database query to the depiction GUI called &amp;lt;tt&amp;gt;dview&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 [[File:FhvFirstAverage.png|thumb|center|500px|First average, no azimuthal rotation was tested. Shown in &amp;lt;tt&amp;gt; dview&amp;lt;/tt&amp;gt; program]]&lt;br /&gt;
&lt;br /&gt;
Apparently, the project finds the membranes and centers the particles correctly.  If you show the volume in Chimera (by clicking in the &#039;&#039;Export&amp;gt;Send to Chimera&#039;&#039; option in the &amp;lt;tt&amp;gt;dview&amp;lt;/tt&amp;gt; window ).&lt;br /&gt;
&lt;br /&gt;
[[File:FhvFirstChimera.png|thumb|center|500px|First average, no azimuthal rotation was tested ]]&lt;br /&gt;
&lt;br /&gt;
We can check the individual particles:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;ddbrowse -d first:data -t first:rt &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:FhvDdbrowseFirstZ.png|thumb|center|700px| ddbrowse explores the aligned particles, each one represented as a projection. ]].&lt;br /&gt;
&lt;br /&gt;
== Aligning  the axis of symmetry ==&lt;br /&gt;
&lt;br /&gt;
We would like to bring the axis of symmetry to the &#039;&#039;z&#039;&#039;direction. This will create an intuitive separation between the two first euler angles that represent &amp;quot;change of orientation of the main axis&amp;quot;, and the third one that represents &amp;quot;azimuthal rotation about the new axis&amp;quot;.  We want that azimuthal rotations occur about an axis of possible symmetry, which by convention is located along z. There are several ways to achieve this. A simple one is to create a model of the membrane/crown geometry, align our average to it (with &amp;lt;tt&amp;gt;dalign&amp;lt;/tt&amp;gt;), and use the alignment parameters to create a new table. With this new table and average we will be able study possible symmetries with a new project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creating a template aligned with z ===&lt;br /&gt;
&lt;br /&gt;
Geometrical shapes of many types can be created with &amp;lt;tt&amp;gt;dmask,dsphere,dcylinder,dshell&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;dtube&amp;lt;/tt&amp;gt;, and combined with &amp;lt;tt&amp;gt;dynamo_mask_combine&amp;lt;/tt&amp;gt;. However, there are also some available utilities to create templates representing frequently occurring membraneous geometries:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;mr = dpktomo.examples.motiveTypes.MembraneWithRod();&lt;br /&gt;
mr.sidelength = 128;&lt;br /&gt;
mr.rodRadius = 20; mr.rodShift = [0,0,10]; mr.rodHeight= 20;&lt;br /&gt;
mr.getMask();&lt;br /&gt;
template  = mr.mask;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that you can check the list of properties inside the object &amp;lt;tt&amp;gt;mr&amp;lt;/tt&amp;gt; just by typing it without the semicolon and pressing [Return]&lt;br /&gt;
&lt;br /&gt;
We can check the result with:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;mr.viewMask();&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:FhvTemplateZ.png|thumb|center|700px| A simple template with rotational symmetry axis aligned along z]]&lt;br /&gt;
&lt;br /&gt;
=== Aligning the previous average along z ===&lt;br /&gt;
The mask is white on black by definition. The tomogram data in this case represents bright protein on dark background, so that in this case we want to align the previously computed average to the mask of the &amp;lt;tt&amp;gt;mr&amp;lt;/tt&amp;gt; object. &lt;br /&gt;
&lt;br /&gt;
The alignment does not need to scan azimuthal rotations, so that our &#039;inplane_range&#039; will be 0. The &#039;cone_range&#039; will be the full sphere, and we take and spacing of 30 degrees. As we are looking for coarse orientations, we can bin the two volumes twice (yielding volumes with a sidelength of 32 pixels). We will also &amp;quot;nail&amp;quot; the new center to the physical center of the box (parameter &amp;lt;tt&amp;gt;limm&amp;lt;/tt&amp;gt; set to 1 below).&lt;br /&gt;
&lt;br /&gt;
Now we read the average computed by the project &amp;lt;tt&amp;gt;first&amp;lt;/tt&amp;gt; into a workspace variable which we arbitrarily call &amp;lt;tt&amp;gt;previousAverage&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;ddb first:a -r previousAverage;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, the volume &amp;lt;tt&amp;gt;previousAverage&amp;lt;/tt&amp;gt; will be treated as a &amp;quot;particle&amp;quot; to be aligned onto a &#039;&#039;template&#039;&#039;, which in this case is the volume contained in &amp;lt;tt&amp;gt;mr.mask&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;sal = dalign(previousAverage,mr.mask,&#039;cr&#039;,360,&#039;cs&#039;,30,&#039;ir&#039;,0,&#039;dim&#039;,32,&#039;limm&#039;,1,&#039;lim&#039;,[10,10,10]); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The flags are the same parameters that would be used in an alignment project. You can check the shorthands with &amp;lt;tt&amp;gt;dvhelp&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The output result &amp;lt;tt&amp;gt;sal&amp;lt;/tt&amp;gt; contains many fields. We can, for instance directly visualize how the previous average looks like when transformed through the results of this &amp;lt;tt&amp;gt;dalign&amp;lt;/tt&amp;gt; operation.  For this, use the field &amp;lt;tt&amp;gt;aligned_particle&amp;lt;/tt&amp;gt; in the output &amp;lt;tt&amp;gt;sal&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dview(sal.aligned_particle);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:ZAlignedAverage.png|thumb|center|700px| A simple template with rotational symmetry axis aligned along z]]&lt;br /&gt;
&lt;br /&gt;
=== Applying the z-alignment to the table ===&lt;br /&gt;
&lt;br /&gt;
We don&#039;t want just to get a z-oriented average: we also want to convert the table yield by the &amp;lt;tt&amp;gt;first&amp;lt;/tt&amp;gt; project into a table that, when applied onto the original data, produces a correct, z-aligned average. For this, we use the alignment parameters coded inside the output &amp;lt;tt&amp;gt;sal&amp;lt;/tt&amp;gt;  (as field &amp;lt;tt&amp;gt;.Tp&amp;lt;/tt&amp;gt;) and apply them onto the table.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;ddb first:rt -r tf&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;tt&amp;gt;tf &amp;lt;/tt&amp;gt; contains now the original table, which is now rotated and shifted according with the rigid body transform &amp;lt;tt&amp;gt;Tp&amp;lt;/tt&amp;gt; inside &amp;lt;tt&amp;gt;sal&amp;lt;/tt&amp;gt;&lt;br /&gt;
  &amp;lt;tt&amp;gt;tr =  dynamo_table_rigid(tf,sal.Tp); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
now the &#039;&#039;rectified &#039;&#039;table &amp;lt;tt&amp;gt;tr&amp;lt;/tt&amp;gt;   should contain the metadata that makes the particles &amp;quot;point upward&amp;quot;. We use now the typical sanity check to assess that a table behave as expected: we apply it to the particles in its paired [[data folder]] and check the average:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;tt&amp;gt;oz = daverage(&#039;first:data&#039;,&#039;t&#039;,tr,&#039;fc&#039;,1); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
whose results can be checked by:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dview(oz); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:FhvSanityCheckZ.png|thumb|center|700px| Particles aligned with rectified table &amp;lt;tt&amp;gt;tr&amp;lt;/tt&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can visualize this operation by plotting a sketch with the orientation of the particles. We first show the results for the table computed in the project &amp;lt;tt&amp;gt;first&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;figure;&lt;br /&gt;
dtplot(&#039;first:rt&#039;,&#039;m&#039;,&#039;sketch&#039;,&#039;sketch_length&#039;,100,&#039;sm&#039;,30);&lt;br /&gt;
view(-230,30);axis equal;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:FhvSketchFirst.png|thumb|center|400px| sketch of orientations after computation of the the project &amp;lt;tt&amp;gt;first&amp;lt;/tt&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Here, the &#039;z&#039; orientation computed for each particle is represented by the longest semiaxis. Note that with the original definition of the template, the &#039;z&#039; points -approximately- along the direction of the &#039;z&#039; in the tomogram. If we depict the same plot with the table we just computed:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;figure;&lt;br /&gt;
dtplot(tr,&#039;m&#039;,&#039;sketch&#039;,&#039;sketch_length&#039;,100,&#039;sm&#039;,30);&lt;br /&gt;
view(-230,30);axis equal;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:FhvSketchZ.png|thumb|center|400px| sketch of orientations in the rectified table]]&lt;br /&gt;
&lt;br /&gt;
we see that now the &#039;z&#039; axis in each particle is pointing orthogonally(-ish) to the membrane. A different quick check would be to show the projections of the particles along &#039;&#039;y&#039;&#039;. Instead of using the GUI &amp;lt;tt&amp;gt;ddbrowse&amp;lt;/tt&amp;gt;, we can create this depiction with a single command: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;figure;dslices(&#039;particlesData&#039;,&#039;t&#039;,tr,&#039;projy&#039;,&#039;*&#039;,&#039;align&#039;,1,&#039;labels&#039;,&#039;on&#039;); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:fhvOrientedSlicesX.png|thumb|center|400px|  full &#039;&#039;y&#039;&#039;projection of the particles according to the orientations in the rectified table ]]&lt;br /&gt;
&lt;br /&gt;
Lets look at the &#039;&#039;z&#039;&#039;-projection. In this case we project only the central slices around the crown and the aperture in the viral vesicle, chosing thus slices 60 to 70. if project the full particle, we won&#039;t distinguish any features.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;figure;dslices(&#039;particlesData&#039;,&#039;t&#039;,tr,&#039;projz&#039;,60:80,&#039;align&#039;,1,&#039;labels&#039;,&#039;on&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:fhvOrientedSlicesZ.png|thumb|center|400px|  &#039;&#039;z&#039;&#039;projection of the central slices in the rectified table ]]&lt;br /&gt;
&lt;br /&gt;
The depiction clearly shows the missing wedge of the particles. Incidentally, it also shows that averaging all the particles should produce an average that covers all the orientaions  in the Fourier space.&lt;br /&gt;
&lt;br /&gt;
== Using the membrane to impart an orientation ==&lt;br /&gt;
&lt;br /&gt;
This section describes an &#039;&#039;&#039;alternative&#039;&#039;&#039; method to compute:&lt;br /&gt;
* a rough orientation of the particles, and&lt;br /&gt;
* a rough first template&lt;br /&gt;
&lt;br /&gt;
In this section we will use the membrane of the mithocondrion to assign a roughly orientation to each of the points in the table. This orientation will be defined by the normal of the closest point in the membrane. The membrane will be defined as a a triangulation, to be constructed based on a set of manually picked points.&lt;br /&gt;
&lt;br /&gt;
=== Pick membrane points===&lt;br /&gt;
&lt;br /&gt;
We open our tomogram in &amp;lt;tt&amp;gt;dtmslice&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dtmslice @{fhv}1 -prebin 1&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or, if you are working with the [[standalone]] version, please prepend a &amp;quot;\&amp;quot; symbol:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;\dtmslice @{fhv}1 -prebin 1&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this variant of the syntax of &amp;lt;tt&amp;gt;dtmslice&amp;lt;/tt&amp;gt;, the string &amp;lt;tt&amp;gt;@{fhv}1&amp;lt;/tt&amp;gt; just means &amp;quot;tomogram number 1 inside catalogue &amp;lt;tt&amp;gt;fhv&amp;lt;/tt&amp;gt;.  On the opened scene, we will use a [[Montage viewer for membrane picking | montage ]] to manually click on a set of membrane points.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note! (08/06/21) - the montage viewer was recently updated and no longer provides the ability to easily add points, please define your surface model on sequential z-slices in dtmslice directly by annotating points every 20 or so slices.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[ File:FhvMontage.png |thumb|center|400px|   Opening a montage view]]&lt;br /&gt;
&lt;br /&gt;
By default, this &amp;lt;tt&amp;gt;montage&amp;lt;/tt&amp;gt; represents slices taken orthogonally to &#039;&#039;z&#039;&#039; every 20 pixels of the unbinned tomogram. This can be changed in the settings &#039;&#039;before&#039;&#039; opening the montage GUI. Now, we can create a model of type &amp;lt;tt&amp;gt;Surface&amp;lt;/tt&amp;gt;, which we will use to store a set of points in the membrane to be picked manually (or semiautomatically). To do this, go to &#039;&#039;Model pool&amp;gt; Create new model in pool (choose type) &amp;gt; surface &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[ File:FhvCreateSurfaceModel.png |thumb|center|400px|  Creating a surface model]]&lt;br /&gt;
&lt;br /&gt;
You need to click on the point switcher (the control in the toolbar with a &#039;&#039;c&#039;&#039; and an &#039;&#039;i&#039;&#039;) to allow entering points. The basic controls are: &lt;br /&gt;
* Mouse click to enter a point. &lt;br /&gt;
* &amp;lt;tt&amp;gt;d&amp;lt;/tt&amp;gt; to delete a point.&lt;br /&gt;
* &amp;lt;tt&amp;gt;i&amp;lt;/tt&amp;gt; to insert a point.&lt;br /&gt;
&lt;br /&gt;
[[File:FhvMontageActiveClick.png |thumb|center|400px|  Point switcher  must be toggle on to pick points into the model]]&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&amp;gt;&amp;gt;&#039;&#039; button in the bottom of the GUI to go to next set of orthoslices.&lt;br /&gt;
&lt;br /&gt;
[[File:FhvMontageControls.png |thumb|center|400px|   Controls of the montage GUI]]&lt;br /&gt;
&lt;br /&gt;
Note that the points that you click in the Montage GUI are assigned to a model in the pool, and as such, they appear automatically in the dtmslice GUI&lt;br /&gt;
[[ File:FhvTmsliceUpdates.png |thumb|center|600px|   Points clicked in the montage GUI reflect in the &amp;lt;tt&amp;gt;tmslice&amp;lt;/tt&amp;gt; GUI]]&lt;br /&gt;
&lt;br /&gt;
You also need &amp;lt;tt&amp;gt;shift + C &amp;lt;/tt&amp;gt; in order to place a center inside the mithocondrion. This point is just used to tell &#039;&#039;Dynamo&#039;&#039; what is the inside and what is the outside face of the surface that we are building.&lt;br /&gt;
&lt;br /&gt;
[[File:FhvSurfaceMarkCenter.png |thumb|center|400px|   &amp;lt;tt&amp;gt;shift + C &amp;lt;/tt&amp;gt; marks an arbitrary interior point]]&lt;br /&gt;
&lt;br /&gt;
==== Automatic detection ====&lt;br /&gt;
&lt;br /&gt;
Once you have clicked points on a level, you can try and check if the automatic tracker can locate them in the next one. To do so, activate the next slice (i.e., secondary click it, so that its frame becomes red), and press &amp;lt;tt&amp;gt;o&amp;lt;/tt&amp;gt;. You can edit the points with &amp;lt;tt&amp;gt;d&amp;lt;/tt&amp;gt; to delete the closest point, &amp;lt;tt&amp;gt;m&amp;lt;/tt&amp;gt; to move the closest point to the position currently under the cursor, or &amp;lt;tt&amp;gt;l&amp;lt;/tt&amp;gt; to delete all the points detected in the slice... in such a case, you probably want to check the tracking parameters before using &amp;lt;tt&amp;gt;o&amp;lt;/tt&amp;gt; again!&lt;br /&gt;
&lt;br /&gt;
=== Create a surface ===&lt;br /&gt;
&lt;br /&gt;
Now, we want to convert the points that we have introduced into a triangulation. This is a part of the [[Membrane Models#Workflow description| workflow]] used to crop particles from [[membrane models]], so we open the workflow GUI for this model in the &#039;&#039;Active Model&#039;&#039; menu tab. &lt;br /&gt;
&lt;br /&gt;
[[ File:FhvSurfaceWorkflowCreate.png |thumb|center|400px|  Invoking the workflow editor of active model ]]&lt;br /&gt;
&lt;br /&gt;
We can first check the points currently contained in the model, by auxiliary clicking on the first viewing option and choosing the &#039;&#039;User points&#039;&#039; option. They will be depicted in a graphic window which will update with the new graphical elements that we depict there.&lt;br /&gt;
&lt;br /&gt;
[[ File:FhvSurfacePlotPoints.png|thumb|center|600px|  Showing original points in the model workflow GUI ]]&lt;br /&gt;
&lt;br /&gt;
We first need to create a spline interpolation on each of the levels of our point cloud.&lt;br /&gt;
&lt;br /&gt;
[[ File:FhvSurfaceControlPoints.png|thumb|center|600px|  Control points are created by spline interpolation. ]]&lt;br /&gt;
&lt;br /&gt;
Now we define a triangulation on  this control points.&lt;br /&gt;
&lt;br /&gt;
[[ File:FhvSurfaceCreateTriangulation.png |thumb|center|600px|  Creating a triangulation on the control points ]]&lt;br /&gt;
&lt;br /&gt;
Which can be subdivided to get a smoother appearance, and also a more accurate representation of the geometry.&lt;br /&gt;
&lt;br /&gt;
[[File:FhvSurfaceSubdivisionMinimum.png |thumb|center|400px|  A single round of subdivision smoothens the appearance of the lattice ]]&lt;br /&gt;
&lt;br /&gt;
Then, we can change the name of the model for clarity, and then save it into the catalogue (with the disk icon in &amp;lt;tt&amp;gt;tmslice&amp;lt;/tt&amp;gt; or the &#039;&#039;Save into catalogue&#039;&#039; options under the &#039;&#039;Active model&#039;&#039; menu)&lt;br /&gt;
[[ File:FhvSurfaceSaveModel.png |thumb|center|600px|  Renaming a saving a model into the catalogue ]]&lt;br /&gt;
&lt;br /&gt;
=== Use a surface to impart orientation ===&lt;br /&gt;
&lt;br /&gt;
We bring the model into our workspace. We search for it in the catalogue:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dcmodels fhv -nc mySurface -ws output&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which will prompt the response &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Volume 1. Matching models: 1 (total: 1)&lt;br /&gt;
/Users/casdanie/dynamo/examples/fhvParis/fhv/tomograms/volume_1/models/mySurface.omd&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
now, we can read the model file into our memory space to operate with it:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;m = dread(output.files{1});&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the model &amp;lt;tt&amp;gt;m&amp;lt;/tt&amp;gt; is in our space of memory and can be used to impart an orientation to the points in our table.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;tOrientedBySurface = dpktbl.triangulation.fillTable(m,&#039;raw.tbl&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this table, orientations are orthogonal to the membrane (or more precisely, orthogonal to the closest triangle in the mesh that represents the membrane)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt; figure;dslices(&#039;particlesData&#039;,&#039;t&#039;, tOrientedBySurface,&#039;projy&#039;,&#039;c20&#039;,&#039;align&#039;,1,&#039;labels&#039;,&#039;on&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[ File:FhvMembraneSlicesPreflipping.png|thumb|center|400px|   Slices along the xz plane as seen by the table]]&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;tConsistent = dynamo_table_flip_normals(tOrientedBySurface,&#039;center&#039;,m.center)&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can check the effect of this table on the particles through:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;figure;dslices(&#039;particlesData&#039;,&#039;t&#039;, tConsistent,&#039;projy&#039;,&#039;c20&#039;,&#039;align&#039;,1,&#039;labels&#039;,&#039;on&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[ File:FhvMembraneSlicesPostflipping.png |thumb|center|400px|  Slices along the xz plane as seen by the table, after using the center point to establish the interior side of the surface ]]&lt;br /&gt;
&lt;br /&gt;
To get a better graphical impression, we can depict our surface (contained in the model &amp;lt;tt&amp;gt;m&amp;lt;/tt&amp;gt;)  with:&lt;br /&gt;
  &lt;br /&gt;
 &amp;lt;tt&amp;gt;m.ezplot&amp;lt;/tt&amp;gt; &lt;br /&gt;
&lt;br /&gt;
and choose the &amp;lt;tt&amp;gt;Surface&amp;lt;/tt&amp;gt;option&lt;br /&gt;
&lt;br /&gt;
[[ File:FhvMembraneSurfaceEzplot.png |thumb|center|400px| Easy way to get all defined plots of a model object.  ]]&lt;br /&gt;
&lt;br /&gt;
Then, we just plot the positions of the particles on the same graphical figure:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dtplot(tConsistent,&#039;m&#039;,&#039;sketch&#039;,&#039;sketch_length&#039;,100,&#039;sm&#039;,30);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[ File:FhvMembraneSketchDtplot.png |thumb|center|400px|  &amp;lt;tt&amp;gt;dtplot&amp;lt;/tt&amp;gt; directs its output on the last active figure ]]&lt;br /&gt;
&lt;br /&gt;
==== Management of the missing wedge ====&lt;br /&gt;
&lt;br /&gt;
When we create a table considering only the orientations of the points with relation to a membrane, there is no particular preference for rotations of the particles about the normal direction (i.e., azimuthal directions).  The &amp;lt;tt&amp;gt;narot&amp;lt;/tt&amp;gt; angle in this table is initialized to zero&lt;br /&gt;
&lt;br /&gt;
Thus, take into account that an average created on these particles will have a strong missing wedge, especially in our case, where we have a preferential direction. This can be checked by averaging the particles against this table:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;oa=daverage(&#039;particlesData&#039;,&#039;t&#039;, tConsistent,&#039;fc&#039;,1);&amp;lt;/tt&amp;gt;&lt;br /&gt;
Here, we ask (&amp;lt;tt&amp;gt;&#039;fc&#039;,1&amp;lt;/tt&amp;gt;) to run a Fourier compensation step, so that we can check in the output &amp;lt;tt&amp;gt;oa&amp;lt;/tt&amp;gt; the property &amp;lt;tt&amp;gt;fweight&amp;lt;/tt&amp;gt;, which contains the number of times a Fourier component is represented in the average. Bright values mean that the Fourier component is present in many particles (yielding thus an average of better quality for the involved frequencies).&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dview(oa.fweight);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[  File:FhvMembraneMissingWedge.png|thumb|center|400px|   Fourier component presence without azimuthal randomization ]]&lt;br /&gt;
&lt;br /&gt;
We can atenuate this effect by randomizing the rotational angle:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;tConsistentRandomized = dynamo_table_randomize_azimuth( tConsistent);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and averaging again.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;oaRandomized=daverage(&#039;particlesData&#039;,&#039;t&#039;, tConsistentRandomized,&#039;fc&#039;,1);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, the &amp;lt;tt&amp;gt;fweight&amp;lt;/tt&amp;gt; map doesn&#039;t show such a strongly preferential orientation:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dview(oaRandomized.fweight);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[  File:FhvMembraneMissingRandomized.png |thumb|center|400px|   Fourier component presence with azimuthal randomization ]]&lt;br /&gt;
&lt;br /&gt;
The effect in direct space can be shown by depicting both averages (with and without randomization side to side)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dpkdev.legacy.dynamo_mapview({oa.average,oaRandomized.average});&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[  File:FhvMembraneCompareWedges.png |thumb|center|400px| The map on the left shows a worse definition and clear traces of missing Fourier components  ]]&lt;br /&gt;
&lt;br /&gt;
== Project for rotational alignment ==&lt;br /&gt;
&lt;br /&gt;
We have now a template and a coherently defined metadata (i.e. table) that align the particles coarsely along the right direction. We write  them into disk: &lt;br /&gt;
&amp;lt;nowiki&amp;gt;Insert non-formatted text here&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
If you did not create a membrane model, use the results of the alignment project:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;dwrite(tr,&#039;zOriented.tbl&#039;);&lt;br /&gt;
dwrite(oz.average,&#039;zOriented.em&#039;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you did create a membrane model, used the corresponding table and average:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;dwrite(tConsistentRandomized,&#039;zOriented.tbl&#039;);&lt;br /&gt;
dwrite(oaRandomized.average,&#039;zOriented.em&#039;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and create a project with these files. Note that the [[data folder]] remains unchanged.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dcp.new(&#039;zOriented&#039;,&#039;d&#039;,&#039;particlesData&#039;,&#039;template&#039;,&#039;zOriented.em&#039;,&#039;masks&#039;,&#039;default&#039;,&#039;t&#039;,&#039;zOriented.tbl&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this project, we will ask for a symmetrization &#039;c57&#039;.. this is just to simulate fully rotational symmetry.  We are not assuming that this symmetry is physical: we just want to force any possible symmetry axis in the data along the &#039;&#039;z&#039;&#039; axis. We also keep binning twice the particles, in order to get the computation times short.&lt;br /&gt;
&lt;br /&gt;
[[File:FhvZOrientedParameters.png|thumb|center|500px| Alignment parameters in &amp;lt;tt&amp;gt;zOriented&amp;lt;/tt&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
The result shown an incipient formation of the crown... however, the presence of  suspicious striations in a preferential direction might be an indication of the effect of the missing wedge.&lt;br /&gt;
&lt;br /&gt;
[[File:FhvZOrientedMapview.png|thumb|center|500px| Result in  &amp;lt;tt&amp;gt;zOriented&amp;lt;/tt&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
== Project with rotational randomization ==&lt;br /&gt;
&lt;br /&gt;
We can create a template that does not have a prefererential orintation, by just randomizing the azimuthal rotations in our table, We extract the last refined table into the variable &amp;lt;tt&amp;gt;tns&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;ddb zOriented:rt -r tns &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and impose a perturbation that keeps all other parameters constant but randomly rotates the particles around their axis&lt;br /&gt;
 &amp;lt;tt&amp;gt;tr = dynamo_table_perturbation(tns,&#039;pshift&#039;,0,&#039;paxis&#039;,0,&#039;pnarot&#039;,360);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can use this table to average again the particles and check the average.&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;oar = daverage(&#039;particlesData&#039;,&#039;t&#039;,tr,&#039;fc&#039;,1);&lt;br /&gt;
dview(oar)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, we can write these files in disk and create a project:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;dwrite(oar.average,&#039;randomizedAverage.em&#039;);&lt;br /&gt;
dwrite(tr,&#039;randomized.tbl&#039;);&lt;br /&gt;
dcp.new(&#039;zRandomized&#039;,&#039;d&#039;,&#039;particlesData&#039;,&#039;template&#039;,&#039;randomizedAverage.em&#039;,&#039;masks&#039;,&#039;default&#039;,&#039;t&#039;,&#039;randomized.tbl&#039;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:FHV zRandomized Parameters.png|thumb|center|600px| Alignment parameters in &amp;lt;tt&amp;gt;zRandomized&amp;lt;/tt&amp;gt; project]]&lt;br /&gt;
&lt;br /&gt;
After running this projects, the presence of a crown-like is very, very faintly hinted in mapview:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dpkdev.legacy.dynamo_mapview(&#039;zRandomized:a&#039;)&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:FhvRandomizedFaintHintsMapview.png|thumb|center|500px| Result from  &amp;lt;tt&amp;gt;zRandomized&amp;lt;/tt&amp;gt; project]]&lt;br /&gt;
&lt;br /&gt;
and barely identifialble in Chimera:&lt;br /&gt;
&lt;br /&gt;
[[File:FhvZRandomizedChimera.png|thumb|center|500px| Alignment parameters in &amp;lt;tt&amp;gt;localized&amp;lt;/tt&amp;gt; project]]&lt;br /&gt;
&lt;br /&gt;
== Project for localized alignment ==&lt;br /&gt;
&lt;br /&gt;
We don&#039;t see clearly what is happening on the area of interest... On one hand we know that we are using a very reduced number of particles ( which on top of it are too similarly oriented). But there is still some room to improve in the approach: we can focus the refinement in the area of interest.&lt;br /&gt;
&lt;br /&gt;
=== Creating a tight mask ===&lt;br /&gt;
We want to create a mask that encloses the area of interest. To do this, we open the average in &amp;lt;tt&amp;gt;dmapview&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dpkdev.legacy.dynamo_mapview(&#039;zRandomized:a&#039;)&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We tune the browser for viewing along &#039;&#039;y&#039;&#039;, and we select one of the central slices. We can use a thickness of several pixels to have a better view.&lt;br /&gt;
&lt;br /&gt;
Then, we select the area that we want to use as seed in this plane to create a revolution solid. We press on &amp;lt;tt&amp;gt;[shift] + [s] &amp;lt;/tt&amp;gt; on the selected slide, letting a new window pop up. In this window, you handdraw an area on the XZ plane (main click to start drawing, auxiliary click to stop). &#039;&#039;Dynamo&#039;&#039; will rotate the region about the &#039;&#039;z&#039;&#039; axis, creating a revolution solid into the &amp;lt;tt&amp;gt;file temp_drawn_revolution_mask.em&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:fhvHandDrawn.png|thumb|center|500px|  Drawing a revolution mask.]]&lt;br /&gt;
&lt;br /&gt;
We have to change the default name given by &#039;&#039;Dynamo&#039;&#039; to a relevant one:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;tt&amp;gt;!mv temp_drawn_revolution_mask.em teethMask.em&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and now continue the previous project by transferring the results of &amp;lt;tt&amp;gt;zRandomized&amp;lt;/tt&amp;gt; to a fresh project (lets call  it &amp;lt;tt&amp;gt;localized&amp;lt;/tt&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dynamo_vpr_branch zRandomized localized -b 1 -noise 0&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where we insert the tight mask &amp;lt;tt&amp;gt;teethMask.em&amp;lt;/tt&amp;gt; that we just created as alignment mask of the project. Note that we do &#039;&#039;&#039;not&#039;&#039;&#039; want impose any symmetry in our parameters:&lt;br /&gt;
[[File:FhvParametersLocalized.png|thumb|center|500px| Alignment parameters in &amp;lt;tt&amp;gt;localized&amp;lt;/tt&amp;gt; project]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s inspect the output in &amp;lt;tt&amp;gt;dview&amp;lt;/tt&amp;gt;&lt;br /&gt;
[[File:fhvLocalizedDview.png|thumb|center|800px| Last average in project &amp;lt;tt&amp;gt;localized&amp;lt;/tt&amp;gt; as shown by &amp;lt;tt&amp;gt;dview&amp;lt;/tt&amp;gt;]]&lt;br /&gt;
There are different things that we like in this average&lt;br /&gt;
# The localized masking worked well, producing a clearer insight into the region of relevance&lt;br /&gt;
# Although we are using signal only inside the mask, the material outside of the mask does &#039;&#039;&#039;not&#039;&#039; become smeared. This is clear mark that the alignment is real and non artifactual. That&#039;s an important point to check when we use small masks.&lt;br /&gt;
# The symmetry in the area becomes apparent on the bare eye. They can be distinguished clearly with mapview and even in Chimera.&lt;br /&gt;
&lt;br /&gt;
[[File:FhvLocalizedMapview.png|thumb|center|500px| Last average in project &amp;lt;tt&amp;gt;localized&amp;lt;/tt&amp;gt; as shown by &amp;lt;tt&amp;gt;mapview&amp;lt;/tt&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
[[File:FhvLocalizedChimera.png|thumb|center|500px| Last average in project &amp;lt;tt&amp;gt;localized&amp;lt;/tt&amp;gt; as shown by &amp;lt;tt&amp;gt;mapview&amp;lt;/tt&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
=== Testing the symmetry ===&lt;br /&gt;
&lt;br /&gt;
We can check for different symmetry operators to confirm the presence of symmetry. &lt;br /&gt;
&lt;br /&gt;
==== Basic command ====&lt;br /&gt;
&lt;br /&gt;
The basic command for this task is &amp;lt;tt&amp;gt;dynamo_symmetry_scan&amp;lt;/tt&amp;gt;. In its fundamental syntax, you need to state the type  of symmetry operator to be tested, and a set of operator.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt; stm = dynamo_symmetry_scan(&#039;localized:a&#039;,&#039;c&#039;,&#039;order&#039;,3:15,&#039;type&#039;,&#039;pearson&#039;,&#039;nfig&#039;,3); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:FhvSymmetryGlobal.png|thumb|center|500px| Symmetry detected for different masks]]&lt;br /&gt;
&lt;br /&gt;
With a more localized mask:&lt;br /&gt;
 &amp;lt;tt&amp;gt; slm = dynamo_symmetry_scan(&#039;localized:a&#039;,&#039;c&#039;,&#039;order&#039;,3:15,&#039;type&#039;,&#039;pearson&#039;,&#039;mask&#039;,&#039;teethMask.em&#039;,&#039;nfig&#039;,4);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:FhvSymmetryLocal.png|thumb|center|500px| Symmetry detected for different masks]]&lt;br /&gt;
&lt;br /&gt;
==== Interpretation of results ====&lt;br /&gt;
&lt;br /&gt;
If you got the results above, you might have jumped to the conclusion that they already constitute an objective hint at a real C12 symmetry. This is, however, not true. The fact is that,  with a slightly different picking of particles, you could have obtained the profiles in these pictures:&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;margin: 0 auto;&amp;quot;&lt;br /&gt;
| [[File:FhvSymmetryGlobalWrong.png|thumb|upright|400px| Symmetry merit plot (global mask) ]]&lt;br /&gt;
| [[File:FhvSymmetryLocalWrong.png|thumb|upright|400px| Symmetry merit plot (local mask) ]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These images represent the result of the two symmetry-exploring commands described above obtained by a different user. . Surprisingly, they point at possible symmetry orders of 11 and 13.&lt;br /&gt;
So, what is going on here? How is it possible that two different users that operate exactly the same walkthrough get contradictory symmetry estimations? The reason is that different users will pick manually slightly different particle centers, and this have a direct impact on the symmetry estimation. In short, the problem is that the density map &amp;lt;tt&amp;gt;localized:a&amp;lt;/tt&amp;gt; is not garanteed to have its possible symmetry axis located along the center of the box, and this misleads &amp;lt;tt&amp;gt; dynamo_symmetry_scan&amp;lt;/tt&amp;gt;. This can bechecked by opening the average in &amp;lt;tt&amp;gt;mapview&amp;lt;/tt&amp;gt; and overlaying the file &amp;lt;tt&amp;gt;&#039;teethMask.em&#039;&amp;lt;/tt&amp;gt; on it.&lt;br /&gt;
&lt;br /&gt;
[[File:FhvSymmetryDecentered.png|thumb|center|500px| Mapview map n file &amp;lt;tt&amp;gt;localized:a &amp;lt;/tt&amp;gt; overlayed with file &amp;lt;tt&amp;gt;&#039;teethMask.em&#039;&amp;lt;/tt&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
In this non-centered density map, any symmetry determination can only be an artifact. To solve this, we create a centered version: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;ddb zOriented:a -r zo % extract average of zOriented as the ws variable zo&lt;br /&gt;
ddb localized:a –r localizedAverage % extract average of localized as the ws variable localized Average&lt;br /&gt;
sal = dalign(localizedAverage,zo,&#039;cr&#039;,0,&#039;cs&#039;,30,&#039;ir&#039;,0,&#039;dim&#039;,64,&#039;limm&#039;,1,&#039;lim&#039;,[20,20,20]); % aligns localizedAverage against zo (like that localizedAverage is centered)&lt;br /&gt;
centerLocalized = sal.aligned_particle;&lt;br /&gt;
dview(centerLocalized); &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:FhvSymmetryRecenteredView.png|thumb|center|500px| Recentered average (x and y views) ]]&lt;br /&gt;
&lt;br /&gt;
We can scan again the symmetry operators on the recentered volume.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt; slmCentered = dynamo_symmetry_scan(centerLocalized,&#039;c&#039;,&#039;order&#039;,3:15,&#039;type&#039;,&#039;pearson&#039;,&#039;mask&#039;,&#039;teethMask.em&#039;,&#039;nfig&#039;,4);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;margin: 0 auto;&amp;quot;&lt;br /&gt;
| [[File:FHVsymmetryRecenteringOldMaskSlice.png|thumb|upright|400px| &amp;lt;tt&amp;gt;&#039;teethMask.em&#039;&amp;lt;/tt&amp;gt; overlayed on the recentered average ]]&lt;br /&gt;
| [[File:FHVsymmetryRecenteringOldMaskPlot.png|thumb|upright|400px| Symmetry merit plot after recentering using &amp;lt;tt&amp;gt;&#039;teethMask.em&#039;&amp;lt;/tt&amp;gt; ]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Now the peaks located that at 6 and 12 are trustworthy.  You can even create a new mask on the recentered average, carefully excluding intensities from the central ring structure to completely rule out any artefact. &lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;margin: 0 auto;&amp;quot;&lt;br /&gt;
| [[File:FHVSymmetryAdhocMaskOverlay.png|thumb|upright|400px| Mask constructed &#039;&#039;ad hoc&#039;&#039; on the recentered average ]]&lt;br /&gt;
| [[File:FHVSymmetryAdhocMaskPlot.png |thumb|upright|400px| Symmetry merit plot using  &#039;&#039;ad hoc&#039;&#039; constructed mask]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Subboxing ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;subboxing&#039;&#039; technique consists in redefining the area of interest inside a previously defined average. In this example, we have use the full crowns as the subject of alignment and averaging. This has allowed us to use the whole signal carried by the full crown on each of the particles to drive the alignment robustly. This approach, however, will not allow us to identify heterogeneity and flexibility inside the individual crowns. Additionally, the possible hetereogeneity inside the crown will decrease the quality of the alignment when the crown is treated as a whole. &lt;br /&gt;
&lt;br /&gt;
With the &#039;&#039;subboxing&#039;&#039; technique, we can use our previous results to setup an approach that centers the alignment on the individual teeth. Each one the particles in our new data set will be a &#039;&#039;subbox&#039;&#039; (a tooth) extracted from the previos &#039;&#039;box&#039;&#039; (the crown) using the alignment parametes for the full boxes gained by the projects that we have ran so far. &lt;br /&gt;
&lt;br /&gt;
=== Defining a subboxed subunit ===&lt;br /&gt;
&lt;br /&gt;
First, we need to define the location that we want to subbox. We use &amp;lt;tt&amp;gt;mapview&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dpkdev.legacy.dynamo_mapview(&#039;localized:a&#039;) &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to show the last average in the project &amp;lt;tt&amp;gt;localized&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:FhvSubboxSelectZ.png|thumb|center|500px| Selecting the center of the tooth subunit with &amp;lt;tt&amp;gt;mapview&amp;lt;/tt&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
You probably want to explore several views in mapviews (&#039;&#039;x&#039;/&#039;y&#039; and &#039;z&#039;) to make sure you (roughtly) hit the center of the subunit of interest. Guiding yourself only for a view on &#039;&#039;z&#039;&#039; can be misleading.&lt;br /&gt;
&lt;br /&gt;
[[File:FhvSubboxSelectY.png|thumb|center|500px| Selecting the center of the tooth subunit with &amp;lt;tt&amp;gt;mapview&amp;lt;/tt&amp;gt; on the &#039;&#039;y&#039;&#039; view]].&lt;br /&gt;
&lt;br /&gt;
As we are in this browser, we can check the size of the subunit that we want to &#039;&#039;subbox&#039;&#039;, using the two markers C and N. This will be useful later when we want to actually crop physical particles using &amp;lt;tt&amp;gt;dtcrop&amp;lt;/tt&amp;gt;, when we will be required to input a sidelength for the subboxed data folder.&lt;br /&gt;
&lt;br /&gt;
[[File:FhvSubboxSelectDistance.png|thumb|center|500px| Measuring distances in mapview]].&lt;br /&gt;
&lt;br /&gt;
We define a variable to contain the position that we read in mapview for the blue (North) anchor. &lt;br /&gt;
 &amp;lt;tt&amp;gt;rSubunitFromCenter = [88,80,53 ] - [64,64,64]; &amp;lt;/tt&amp;gt;&lt;br /&gt;
We subtract the half sidelength of the full box, because the next command will need the position of the asymmetrical unit expressed in relation to center of the box.&lt;br /&gt;
&lt;br /&gt;
=== Creating a subboxing table ===&lt;br /&gt;
&lt;br /&gt;
We extract the last refined table: &lt;br /&gt;
 &amp;lt;tt&amp;gt;ddb localized:rt -r t&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and define positions related by C12 symmetry along the axis&lt;br /&gt;
 &amp;lt;tt&amp;gt;ts = dynamo_subboxing_table(t,rSubunitFromCenter,&#039;sym&#039;,&#039;c12&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new subboxed table &amp;lt;tt&amp;gt;ts&amp;lt;/tt&amp;gt; will have 12 times as many rows as the original one. The system of reference on each particle will point &#039;&#039;z&#039;&#039; in the direction of its original box, but the &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039; orientations of each tooth will be symmetrically related in the same crown. We can depict this geometrical relationship by plotting a sketch of all the particles in the table:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;figure;dtplot(ts,&#039;m&#039;,&#039;sketch&#039;,&#039;sketch_length&#039;,100,&#039;sm&#039;,30);view(-151,12);axis equal;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:FhvSubboxSketch.png|thumb|center|500px| Sketch of orientations of the new subboxed table &amp;lt;tt&amp;gt;ts&amp;lt;/tt&amp;gt;]].&lt;br /&gt;
&lt;br /&gt;
=== Creating a subboxed data folder ===&lt;br /&gt;
&lt;br /&gt;
Now we have all we need to go back to the original tomogram and crop the subboxed particles into a new data folder using the sidelength that we checked with &amp;lt;tt&amp;gt;mapview&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dtcrop(&#039;crop.rec&#039;,ts,&#039;subboxData&#039;,32);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can run our typical sanity check to ensure that everything ran correctly&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;osb = daverage(&#039;subboxData&#039;,&#039;t&#039;,ts,&#039;fc&#039;,1);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To visualize it you can write: &lt;br /&gt;
&lt;br /&gt;
  &amp;lt;tt&amp;gt;dview(osb.average);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:FhvSubboxAverage.png|thumb|center|700px| Density map of the average of subboxed teeth]].&lt;br /&gt;
&lt;br /&gt;
As it looks like we expected, we just write it into a file, which we will use to define a new project.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dwrite(osb.average,&#039;subboxRaw.em&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Defining masks ===&lt;br /&gt;
&lt;br /&gt;
There are some tools to quickly format masks for project. If we want to check a reasonable radius for our mask, we can use the &amp;lt;tt&amp;gt;dsphere&amp;lt;/tt&amp;gt; command and overlay the created mask on the template &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;cs = dynamo_sphere(10,32);&lt;br /&gt;
figure;dslices(osb.average,&#039;y&#039;,&#039;ov&#039;,cs,&#039;ovas&#039;,&#039;mask&#039;);&lt;br /&gt;
figure;dslices(osb.average,&#039;ov&#039;,cs,&#039;ovas&#039;,&#039;mask&#039;); &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:FhvSubboxOverlay.png|thumb|center|700px| Testing the radius of created masks by overlay on template]].&lt;br /&gt;
In fact, this mask is probably too risky: we need a minimum of signal to drive the alignment &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dwrite(cs,&#039;maskTooth32.em&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subboxing project ===&lt;br /&gt;
&lt;br /&gt;
We create the project through:&lt;br /&gt;
 &amp;lt;tt&amp;gt;dcp.new(&#039;subboxBig&#039;,&#039;d&#039;,&#039;subboxData&#039;,&#039;template&#039;,&#039;subboxRaw.em&#039;,&#039;masks&#039;,&#039;default&#039;,&#039;t&#039;,&#039;subboxData/crop.tbl&#039;,&#039;show&#039;,0);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we use  &amp;lt;tt&amp;gt;&#039;show&#039; 0&amp;lt;/tt&amp;gt; would suppress the [[dcm]] GUI. We use typically this option when we want to enter project parameters through the command line. This is exactly equivalent to entering parameters through the GUI. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;dvput subboxBig mask maskTooth32.em&lt;br /&gt;
dvput subboxBig ite_r1 3&lt;br /&gt;
dvput subboxBig cr_r1 4&lt;br /&gt;
dvput subboxBig cs_r1 2&lt;br /&gt;
dvput subboxBig ir_r1 4&lt;br /&gt;
dvput subboxBig is_r1 2&lt;br /&gt;
dvput subboxBig rf_r1 2&lt;br /&gt;
dvput subboxBig rff_r1 2&lt;br /&gt;
dvput subboxBig dim_r1 32&lt;br /&gt;
dvput subboxBig lim_r1 [4,4,4]&lt;br /&gt;
dvput subboxBig limm_r1 1 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list of the names of the parameters can be displayed through the command &amp;lt;tt&amp;gt;dvhelp&amp;lt;/tt&amp;gt;. The computing environment is set using the &amp;lt;tt&amp;gt;destination&amp;lt;/tt&amp;gt; parameter, shortnamed &amp;lt;tt&amp;gt;dst&amp;lt;/tt&amp;gt;. To run it in matlab use:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt; dvput -dst matlab&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For standalone running, use:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt; dvput -dst standalone&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the project, we can check the effect of the independent refinement of the &amp;quot;tooth&amp;quot; units:&lt;br /&gt;
 &amp;lt;tt&amp;gt;dpkdev.legacy.dynamo_mapview(&#039;subboxBig:a:ite=[0,3]&#039;)&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:FhvSubboxRefimentMapview.png|thumb|center|800px| Slice-to-slice comparison of initial template and final average of the subboxing project]].&lt;br /&gt;
&lt;br /&gt;
or send the average to Chimera through:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;ddb subboxBig:a -c &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:FhvSubboxRefimentChimera.png|thumb|center|600px| Density map of the average of subboxed teeth after refinement]].&lt;br /&gt;
&lt;br /&gt;
== Visualization ==&lt;br /&gt;
&lt;br /&gt;
You can continue working on this data in the [[Walkthrough on creation of 3d scenes]], where you will learn to depict tomgraphic slices, place templates in table positions, and depict graphical elements  representing model geometries.&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=G%C3%B6ttingen_Workshop_2024&amp;diff=5103</id>
		<title>Göttingen Workshop 2024</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=G%C3%B6ttingen_Workshop_2024&amp;diff=5103"/>
		<updated>2024-04-08T11:20:24Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Time Schedule */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Workshop =&lt;br /&gt;
This workshop will take place from April the 10 to April the 12th 2024.&lt;br /&gt;
&lt;br /&gt;
The workshop provides hands-on training in all practical aspects of tomography and sub-tomogram averaging using our software Dynamo, encompassing all stages of the pipeline: alignment and reconstruction of tilt series, tomogram visualization and archiving, particle selection and extraction, and subtomogram alignment, averaging, refinement and classification. No previous experience is required. Computing infrastructure will be provided in place, and we welcome participants to bring their own data sets to work on them during this three-days course.&lt;br /&gt;
&lt;br /&gt;
= Computing resources = &lt;br /&gt;
&lt;br /&gt;
== Laptops ==&lt;br /&gt;
For the first two days, participants will bring their own laptops . However, each participant should also install in their laptop prior to the workshop:&lt;br /&gt;
* (R2024a version), a [https://ch.mathworks.com/campaigns/products/trials.html licence free trial version is available]. &lt;br /&gt;
* [https://www.dynamo-em.org//w/index.php?title=Downloads#Beta_Version  Dynamo ] : prior to installation make sure you have a compiler. On Linux you probably have one by default. On Mac, Xcode needs to be installed. On Windows, the recommended option is to install it via Matlab: &lt;br /&gt;
&lt;br /&gt;
https://es.mathworks.com/help/matlab/matlab_external/install-mingw-support-package.html &lt;br /&gt;
 &lt;br /&gt;
Then, &lt;br /&gt;
&lt;br /&gt;
   &amp;gt;&amp;gt; tar -xvf dynamo_temp_1.1.532.tar&lt;br /&gt;
&lt;br /&gt;
Launch the installed package inside MATLAB.&lt;br /&gt;
&lt;br /&gt;
  &amp;gt;&amp;gt; run &amp;lt;DYNAMO_ROOT&amp;gt;/dynamo_activate.m&lt;br /&gt;
&lt;br /&gt;
Wait while some packages are compiled. Activate it again. &lt;br /&gt;
&lt;br /&gt;
* [https://www.cgl.ucsf.edu/chimera/download.html Chimera]&lt;br /&gt;
&lt;br /&gt;
== Workshop data ==&lt;br /&gt;
&lt;br /&gt;
The data that will be used during the workshop can be downloaded using the google drive link: https://drive.google.com/drive/folders/10lZjjKj1tMfVL_RYJioaK12ji3_RdrNT?usp=drive_link&lt;br /&gt;
&lt;br /&gt;
In detail, the data for the respective modules is as follows (for a total of about 8GB):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Module and data source&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Data source&lt;br /&gt;
|-&lt;br /&gt;
| Starters Guide: subtomogram averaging || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Models: Filaments || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Models: Vesicles || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Models: Surfaces || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Template Matching || https://drive.google.com/drive/folders/1EXXGPMQZhD0lKurzaQ6Nz0Vypj3WUkJP?usp=drive_link (750MB)&lt;br /&gt;
|-&lt;br /&gt;
| Alignment of tilt series || https://drive.google.com/drive/folders/1VPYk91xJ6cLCSy6Mg4UX_dDLHHIhhbp9?usp=drive_link (600MB)&lt;br /&gt;
|-&lt;br /&gt;
| Virus like particles || https://drive.google.com/drive/folders/1Vr108rtKI7knFOmzL06-nfFm1KCKdq4e?usp=drive_link (4.6GB)&lt;br /&gt;
|-&lt;br /&gt;
| Spherical geometries || https://drive.google.com/drive/folders/1arrd1KcscsvCDEasmNISShujWjWCYjlw?usp=drive_link (64 MB)&lt;br /&gt;
|-&lt;br /&gt;
| Principal Component Analysis || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Complete walkthrough on FHV virus || https://drive.google.com/drive/folders/10j1mGTV-4srVV2Hg98eWkAPhPeAbU5BQ?usp=drive_link (2GB)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Access to computational resources==&lt;br /&gt;
On the third day, a more advanced tutorial will be completed. For this we will to access a server which will host the data. Access details will be updated here.&lt;br /&gt;
&lt;br /&gt;
= Time Schedule =&lt;br /&gt;
&lt;br /&gt;
* On the first two days, we will present the basic tools in the Dynamo environment.    &lt;br /&gt;
* The third day will be devoted to a hands-on guide on two practical cases:&lt;br /&gt;
** [https://doi.org/10.3389/fmolb.2018.00082&#039;&#039;Protocols for Subtomogram Averaging of Membrane Proteins in the Dynamo Software Package&#039;&#039;] Navarro PP, Stahlberg H and Castaño-Díez D (2018). Front. Mol. Biosci. 5:82.&lt;br /&gt;
** [https://journals.plos.org/plosbiology/article?id=10.1371/journal.pbio.3001318&#039;&#039;Step-by-step guide to efficient subtomogram averaging of virus-like particles with Dynamo&#039;&#039;] Scaramuzza S, Castaño-Díez D (2021). PLoS biology. 19(8):e3001318.&lt;br /&gt;
&lt;br /&gt;
* On the third day participants are encouraged to make a flash presentation (3 mins, max. slides) describing their past or planned research in tomography. We will study the particular cases of interest of each participant, and identify tools of possible relevance inside the &#039;&#039;Dynamo&#039;&#039; environment, designing with the participants viable processing workflows combining &#039;&#039;Dynamo&#039;&#039; and other packages. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 1 (Morning) General tools&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 09:30 - 10:00|| Research Talk&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 10:00 - 10:45|| General introduction: Hands-on guide to basic tools. &amp;lt;br/&amp;gt; &lt;br /&gt;
[https://wiki.dynamo.biozentrum.unibas.ch/w/doc/misc/conceptsSheet.pdf Basic Dynamo jargon] &amp;lt;br/&amp;gt;&lt;br /&gt;
[https://wiki.dynamo.biozentrum.unibas.ch/w/doc/misc/introductionTablesAndData.pdf Basic formats for data and metadata] &lt;br /&gt;
|-&lt;br /&gt;
| 2 || 11:00 - 12:30 || [[Starters guide (Göttingen 2024) | Starters Guide: subtomogram averaging]]&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| 3 || 13:30 - 14:00 || General modeling&lt;br /&gt;
|-&lt;br /&gt;
| 3a ||14:00 - 14:45  || [[Walkthrough_on_filament_models | Models: Filaments]] &amp;lt;br/&amp;gt;  Additional material: [[Walkthrough model worfklow reuse | Coordinated extraction from several filaments]]&lt;br /&gt;
|-&lt;br /&gt;
| 3b || 14:45 - 15:30 || [[Walkthrough_on_vesicle_models | Models: Vesicles ]] &lt;br /&gt;
|-&lt;br /&gt;
| 3c || 15:30 - 16:30 || [[Walkthrough_on_membrane_models | Models: Surfaces ]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 2  General Tools&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 09:30 - 10:15 || [[Walkthrough for template matching (Göttingen 2024) | Template Matching]]&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 10:15 - 11:30 || [[Walkthrough on PCA through the command line (Göttingen 2024) | Principal Component Analysis ]]&lt;br /&gt;
|-&lt;br /&gt;
| 6a || 11:30 - 12:00 || [[Walkthrough on manual marker clicking | Alignment of tilt series: Manual]] &lt;br /&gt;
|-&lt;br /&gt;
| 6b || 12:00 - 12:30 || [[Walkthrough_on_GUI_based_tilt_series_alignment | Alignment of tilt series: GUI ]]&lt;br /&gt;
|-&lt;br /&gt;
| 6c || 12:30 - 12:45 || [[Walkthrough_on_command_line_based_tilt_series_alignment | Alignment of tilt series: command line]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 2 (Afternoon):  Practical cases&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
| FHV ||  13:30- 17:00 || [[Complete walkthrough on FHV virus (Göttingen 2024) | FHV]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 3 (Whole day):  Practical case: High resolution workflow.&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
| HIV1 || 09:30 - 17:00 || High Resolution workflow for HIV1: preprocessing &amp;lt;br/&amp;gt;&lt;br /&gt;
[[ High resolution walkthrough with HIV1 (Göttingen 2024) | High Resolution workflow for HIV1: Dynamo manipulations ]] &amp;lt;/br&amp;gt;&lt;br /&gt;
High Resolution workflow for HIV1: binding with Relion&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Additional material: &amp;lt;br/&amp;gt;&lt;br /&gt;
* [[Walkthrough for lattices on vesicles | Coordinated extraction from several vesicles]]&lt;br /&gt;
* [[Walkthrough on creation of 3d scenes]]&lt;br /&gt;
* [[Walkthrough on placement of averages on table positions]]&lt;br /&gt;
&lt;br /&gt;
= Instructors =&lt;br /&gt;
* Daniel Castano-Diez (CSIC Bilbao, Spain).&lt;br /&gt;
* Raffaele Coray (CSIC Bilbao, Spain).&lt;br /&gt;
* Alma Vivas-Lago (CSIC Bilbao, Spain).&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=Starters_guide_(G%C3%B6ttingen_2024)&amp;diff=5102</id>
		<title>Starters guide (Göttingen 2024)</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=Starters_guide_(G%C3%B6ttingen_2024)&amp;diff=5102"/>
		<updated>2024-04-08T11:19:20Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: Created page with &amp;quot;This tutorial shows how to manually pick particles in a tomogram, extract them, align and classify them. This tutorial is a shortened version of the original Starters_guide...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial shows how to manually pick particles in a tomogram, extract them, align and classify them. This tutorial is a shortened version of the original [[Starters_guide | starters guide]] that was adapted for the use in &#039;&#039;Dynamo&#039;&#039; workshops.&lt;br /&gt;
&lt;br /&gt;
=Manual particle picking and &#039;&#039;Dynamo&#039;&#039; catalogues=&lt;br /&gt;
The &#039;&#039;Dynamo&#039;&#039; catalogues are databases that manage tomograms and link the tomographic data to the extracted particles. Start the catalogue manager by typing the command:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dcm&amp;lt;/tt&amp;gt;&lt;br /&gt;
After the catalogue manager opens, we create 3 synthetic tomograms that include our particles (thermosomes) in the following way:&lt;br /&gt;
&lt;br /&gt;
[[File:StartersGuideFigure1.png|thumb|center|600px| Figure 1: creating a set of synthetic tomograms with &#039;&#039;Dynamo&#039;&#039; Catalogue Manager]]&lt;br /&gt;
&lt;br /&gt;
You can see the list of your tomograms and their metadata in a table in the bottom of your catalogue manager. When workin on your own projects, you can add tomograms to the catalogue by &#039;&#039;Catalogue -&amp;gt; Browse for new volume&#039;&#039;. The tomograms are situated in the directory &amp;lt;tt&amp;gt;testCatalogue&amp;lt;/tt&amp;gt;. They contain a small amount of noise and a missing wedge associated to rotation around Y-axis. We added the information about location of the particles in the tomograms in an additional catalogue called &amp;lt;tt&amp;gt;testCatalogue_withmodels&amp;lt;/tt&amp;gt;. If needed, it can be opened from the current folder with &#039;&#039;Catalogue -&amp;gt; look for local catalogues&#039;&#039; in the catalogue manager window.&lt;br /&gt;
&lt;br /&gt;
==Viewing tomograms==&lt;br /&gt;
Select the first tomogram in the list and go to &#039;&#039;View volume&amp;gt;Full tomogram file in tomoslice&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
[[ File:StartersSelectTomoSliceInCatalogue.png |thumb| center |600px| Figure 2: Selecting a volume in the catalogue manager to be inspected in &amp;lt;tt&amp;gt;dpreview&amp;lt;/tt&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
The volume browser tomoslicer loads the entire tomograms into memory and allows making annotations to the regions of interest. The tomograms in this tutorial are small, and you can load them directly into memory. For real life tomograms, bear in mind that you will need to [[Prebinned tomograms| prebin]] the files before loading them into memory. Tomoslice has a simple set of controls and is suitable for visualization tasks that require oblique sections through the tomogram. It uses the same tool as other &#039;&#039;Dynamo&#039;&#039; browsers to keep track of your annotations: a pool of models. You might need to adjust the contrast (blue arrow). To move through the tomogram slices, you can either use the mouse wheel, click and drag the tomogram slice up and down (orange arrows), or move the position control left and right (orange box).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[ File:StartersTomoSlice.png |thumb| center |600px|]]&lt;br /&gt;
&lt;br /&gt;
==Picking and extracting particles in tomograms==&lt;br /&gt;
Coordinates of picked particles are represented by data types called models. In the tomoslicer window go to &#039;&#039;Model Pool -&amp;gt; Create new model in pool (choose type) -&amp;gt; General&#039;&#039;. This is the simplest type of [[model]] where each clicked/model point corresponds to a single isolated particle. Now you can navigate up and down the tomogram, place the mouse on the center of a particle and press the [c] key on your keyboard to add a new model point. (Note the &#039;&#039;Help -&amp;gt; all hot keys&#039;&#039; options that lists the different the actions of the different keystrokes). Backspace button deletes the last clicked point (you can also use the right-click to delete single points).&lt;br /&gt;
&lt;br /&gt;
[[File:StartersGuideFigure4.png|thumb|center|600px| Generating a new model]]&lt;br /&gt;
&lt;br /&gt;
After you are done clicking about 10 particles click on &#039;&#039;Active model &amp;gt; Update Crop points&#039;&#039; in the tomoslice window.&lt;br /&gt;
￼￼￼￼&lt;br /&gt;
&lt;br /&gt;
[[File:StartersGuideUpdate.png|thumb|center|600px|]]&lt;br /&gt;
&lt;br /&gt;
Save the model into the catalogue by &#039;&#039;Active model -&amp;gt; Save active model into catalogue (disk)&#039;&#039; and close the slicer window.&lt;br /&gt;
&lt;br /&gt;
[[File:StartersGuideFigure6.png|thumb|center|600px| ]]&lt;br /&gt;
&lt;br /&gt;
Pick particles for tomograms 2 and 3. In total, there are around 30-40 particles in the generated dataset. When you open a new tomogram, make sure that you delete the pool of models from memory when asked. This will have no effect onto the models stored in disk, and it is necessary in order to ensure that you are not mixing models from different tomograms.&lt;br /&gt;
&lt;br /&gt;
==An alternate visualization: orthogonal projections==&lt;br /&gt;
&lt;br /&gt;
Clicking in the menu on &#039;&#039;Projection -&amp;gt; project full shown fragment along z&#039;&#039; (still in dtmslice) and you will get a screen where the x-y projection of the tomogram is shown. Use the secondary click on it to launch the orthogonal views of x-z and y-z planes that traverse that point. These views can also be used to click particles, in case the standard view is not sufficient.&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;margin: 0 auto;&amp;quot;&lt;br /&gt;
| [[File:orthoPickMain.png|thumb|upright|250px| click on the main projection determines two orthogonal slices]]&lt;br /&gt;
| [[File:orthoPickX.png|thumb|upright|250px| Slice xz ]]&lt;br /&gt;
| [[File:orthoPickY.png|thumb|upright|250px| Slice xy]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Extracting particles from tomograms=&lt;br /&gt;
In the catalogue manager window select the rows for tomograms from which you want to extract particles from. You can either select them one by one with a mouse click and holding the [ctrl] key or by clicking the &#039;&#039;Select all&#039;&#039; button. Then, go to &#039;&#039;Crop Particles -&amp;gt; Open Volume List Manager&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:StartersGuideopenVolumeList.png|thumb|center|600px|]]&lt;br /&gt;
&lt;br /&gt;
A new window opens with all the models in the catalogue listed in the bottom. Pick (by checking boxes) the models of type &#039;&#039;general&#039;&#039; that you have just clicked. Click &#039;&#039;Create list&#039;&#039; and then &#039;&#039;Crop particle&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:StartersGuideSelectModels.png|thumb|center|600px|]]&lt;br /&gt;
&lt;br /&gt;
In the new window, change the data name to something meaningful, such as &#039;&#039;thermosomeParticles&#039;&#039;, change the sidelength from 32 to 48 and click start cropping.&lt;br /&gt;
&lt;br /&gt;
[[File:StartersGuideCrop.png|thumb|center|600px|]]&lt;br /&gt;
&lt;br /&gt;
After cropping is done, explore your cropped particles by clicking &#039;&#039;ddbrowse&#039;&#039; (in the window above). A new window opens where you can simply click on &#039;&#039;show&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:StartersGuideShow.png|thumb|center|500px|]]&lt;br /&gt;
&lt;br /&gt;
You see a 2D representation (projections) of all cropped 3D subtomograms. Make sure your particles are well centered and fit the box.&lt;br /&gt;
&lt;br /&gt;
[[File:StartersGuideParticles.png|thumb|center|500px|]]&lt;br /&gt;
&lt;br /&gt;
We also introduce the concept of the &#039;&#039;dynamo&#039;&#039; table: The information about each particle is stored in tables. Each particle has an entry in the table that contains shifts and rotations to describe its orientation (by default these values are initialized as zeroes). It also contains the particle ID (tag), the orientation of the missing wedge and others. For full info type the command &amp;lt;tt&amp;gt;dthelp&amp;lt;/tt&amp;gt;. The &#039;&#039;Dynamo&#039;&#039; catalogue generates an initial table during particle extraction. Its location is in &amp;lt;tt&amp;gt;particles/crop.tbl &amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=Subtomogram alignment and averaging=&lt;br /&gt;
&lt;br /&gt;
==Initial reference generation==&lt;br /&gt;
We want to align the extracted tomograms to a common reference. For that, we need an initial reference (which will later be refined during the iterative alignment). Here, we create such an initial reference by manually align a few particles and average them. We use the command &amp;lt;tt&amp;gt;dgallery&amp;lt;/tt&amp;gt; to generate initial orientations for some of our particles that will be used to generate the initial reference. Close all open &#039;&#039;Dynamo&#039;&#039; windows and type into the &#039;&#039;Dynamo&#039;&#039; command line:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dgallery(&#039;data&#039;,&#039;thermosomeParticles.Data&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gallery opens. Click on &#039;&#039;load&#039;&#039; to load all aprticles in memory, move the &#039;&#039;shown&#039;&#039; bar to display the particles and use the x-, y- and z-buttons to see different views:&lt;br /&gt;
&lt;br /&gt;
[[File:StartersGuideGallery.png|thumb|center|600px|]]&lt;br /&gt;
&lt;br /&gt;
To manually align the particles, do the following for about 10 particles:&lt;br /&gt;
# Place the mouse over the particle center and press the key [c] (this centers the particle).&lt;br /&gt;
# Place the mouse over its top (or bottom) part and press the key [n] (this aligns the particle).&lt;br /&gt;
# Click on the particle to make sure its number turns from red to blue (blue means it is selected for further processing). To de-select a particle use the right-click.&lt;br /&gt;
Change between the x-, y- and z-views to correct the orientations if necessary. This is just done to create an initial reference, so orientations don&#039;t need to be very exact.&lt;br /&gt;
&lt;br /&gt;
[[File:StartersGuideGallery2.png|thumb|center|500px|]]&lt;br /&gt;
&lt;br /&gt;
Save the selected tags and corresponding table by clicking &#039;&#039;quick save&#039;&#039; button in the top right. It saves a quickbuffer.tbl and quickbuffer.tags to the hard drive that will be used later. To generate the average you need to apply the table on the particles. For this click the &#039;&#039;average&#039;&#039; button in the Particle selection field.&lt;br /&gt;
&lt;br /&gt;
[[File:StartersGuideGallery3.png|thumb|center|500px|]]&lt;br /&gt;
&lt;br /&gt;
It opens a new window with a lot of controls. Click &#039;&#039;compute average&#039;&#039; in the bottom of the window. Then, right-lick on the output filename and click &#039;&#039;ok&#039;&#039; in the next window to see the result. If you are not satisfied with the result, close the window and refine your manual alignment and/or add more particles to the average.&lt;br /&gt;
&lt;br /&gt;
[[File:StartersGuideGallery4.png|thumb|center|600px|]]&lt;br /&gt;
&lt;br /&gt;
[[File:StartersGuideGallery5.png|thumb|center|500px|]]&lt;br /&gt;
&lt;br /&gt;
==Alignment projects==&lt;br /&gt;
Iterative alignment of subtomograms to their average is performed by &#039;&#039;dynamo&#039;&#039; projects that you can run in various high-performance computational environments. To run an alignment project you need the particles, an initial reference and a table. All of these files we generated before. Start the alignment project GUI by typing&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt; dcp&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In thw new window, do the following:&lt;br /&gt;
# Add the project name &#039;&#039;drun1&#039;&#039;, press the &#039;&#039;enter&#039;&#039; key and select &#039;&#039;create a new project&#039;&#039; in the pop-up window.&lt;br /&gt;
# Click on &#039;&#039;particles&#039;&#039; and provide the particle folder name &#039;&#039;thermosomeParticles.Data&#039;&#039;. Click ok.&lt;br /&gt;
# Click on &#039;&#039;table&#039;&#039; and provide the table name &#039;&#039;thermosomeParticles.Data/crop.tbl&#039;&#039;. Click ok.&lt;br /&gt;
# Click on &#039;&#039;template&#039;&#039; and provide the initial reference name &#039;&#039;my_average.em&#039;&#039;. Click ok.&lt;br /&gt;
# Click on &#039;&#039;masks&#039;&#039; and simply click on &#039;&#039;use default masks&#039;&#039;. Click ok. You could also specify the semi-axis of the ellipsoid masks or go to “Mask editor” to make more sophisticated masks. Note that &#039;&#039;Dynamo&#039;&#039; by default uses Rossman correlation which eliminates the artefacts associated with hard (non-soft) mask. &lt;br /&gt;
&lt;br /&gt;
[[File:StartersGuideAli1.png|thumb|center|500px|]]&lt;br /&gt;
&lt;br /&gt;
Click on &#039;&#039;numerical parameters&#039;&#039; to set all parameters and details about the different iterations of the alignment project. You can select any parameter in the table with a mouse and click the &#039;&#039;?&#039;&#039; button on the top right of the parameter window to see a description of the parameters. The most important parameters to consider are:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;Number of iterations&#039;&#039;: Make 3 rounds with 2 iterations each. The first round will be a global search with a coarse angular step and the following rounds will be used for refinement.&lt;br /&gt;
* &#039;&#039;Angular search ranges&#039;&#039;: Cone aperture is the scan range for the first two Euler angles around the initial orientation defined in the table. 360 degrees is the full scan range. Azimuth rotation range defines the rotation range around the new vertical axis of the particle.&lt;br /&gt;
* &#039;&#039;High- and lowpass values&#039;&#039;: Fourier voxels to limit the used frequency range.&lt;br /&gt;
*&#039;&#039;Particle dimensions&#039;&#039;: Defined as sidelength of your subvolume. If you put a lower value, the particles will be downsampled for the particular round. This will speed up the process.&lt;br /&gt;
* &#039;&#039;Refine&#039;&#039;: After each angular scan, the search step is reduced by the &#039;&#039;refine factor&#039;&#039;. This is repeated &#039;&#039;refine&#039;&#039; times. I.e., if your cone sampling is 10 degrees, &#039;&#039;refine&#039;&#039; is 3 and &#039;&#039;refine factor&#039;&#039; is 2, then 10, 5, 2.5 and 1.25 degrees will be sampled. This is the optimization of angular search space.&lt;br /&gt;
*&#039;&#039;Shift limits&#039;&#039;: Limits the translation of particles from the center of the box (if shifts limiting way is 1) or from the previously estimated center (if shifts limiting way is 2). The previous estimates for the shifts and rotations are taken from input tables and are updated at the end of each iteration.&lt;br /&gt;
*&#039;&#039;Symmetry&#039;&#039;: If you know the symmetry of your protein it will speed up the convergence and result in higher resolution.&lt;br /&gt;
&lt;br /&gt;
￼￼Set the parameters as follows and click &#039;&#039;ok&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[File:StartersGuideFigure10.png|thumb|center|600px|]]&lt;br /&gt;
&lt;br /&gt;
Click on &#039;&#039;Computing environment&#039;&#039; and select your computing environment (choose &#039;&#039;standalone&#039;&#039; if you are working on the standalone version during a workshop). Set &#039;&#039;CPU cores&#039;&#039; and &#039;&#039;parallelize averaging step&#039;&#039; to the maximum available (e.g., 4). Leave the rest as it is and click &#039;&#039;ok&#039;&#039;. In the alignment GUI click &#039;&#039;check&#039;&#039; and &#039;&#039;unfold&#039;&#039;. To run the project&lt;br /&gt;
&lt;br /&gt;
* in a Matlab session, you can just click on “run”.  &lt;br /&gt;
* in a standalone project it is more convenient to open a new terminal, load &#039;&#039;Dynamo&#039;&#039; (but do not run it) and run the project by typing &amp;lt;tt&amp;gt;./drun1.exe&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
While the project is running, open another Matlab window (or in standalone open another terminal with &#039;&#039;Dynamo&#039;&#039; running) and you can monitor the progress of the alignment project by typing:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dvstatus drun1&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While the project is running, you can look at projections of the intermediate results by typing:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;ddb drun1:a:ite=* -j c10&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or at the latest average by typing:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;ddb drun1:a -v &amp;lt;/tt&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The final result should look similar to:&lt;br /&gt;
&lt;br /&gt;
[[File:StartersGuideResultsAlignment.png|thumb|center|400px| ￼Results of alignment.]]&lt;br /&gt;
￼&lt;br /&gt;
&lt;br /&gt;
=Subtomogram classification=&lt;br /&gt;
To demonstrate a classification example we provide particles with 2 slightly different sizes. We can then classify them with a simple Multi-reference Analysis (MRA). To do that, we first generate a dataset which has 2 populations of particles. For this, type:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dynamo_tutorial(&#039;data_classification&#039;,&#039;M&#039;,8,&#039;N&#039;,8);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It generates two sets of particles, 8 particles in each including their table. The idea behind [[Multireference Analysis|MRA]] is the following: The particles are aligned to several references (here only 2). After each iteration, each particle is assigned to only one single reference where it fits the best. This procedure is repeated iteratively. Similar particles will have higher correlation to similar references and will eventually group together. For classification into N classes we will need N initial references and N initially identical tables.Follow these steps to run the MRA:&lt;br /&gt;
&lt;br /&gt;
# Create a new project by typing “drun2” in the project name of the alignment GUI.&lt;br /&gt;
# Set number of references to 2.&lt;br /&gt;
# Activate the &#039;&#039;Swap particles&#039;&#039; button.&lt;br /&gt;
# Go to &#039;&#039;particles&#039;&#039; and add &amp;lt;tt&amp;gt;data_classification/data&amp;lt;/tt&amp;gt; to the particle data. Click ok.&lt;br /&gt;
# Go to &#039;&#039;table&#039;&#039; and type &amp;lt;tt&amp;gt;data_classification/real.tbl&amp;lt;/tt&amp;gt; into the field &#039;&#039;clone this&#039;&#039; and press &#039;&#039;copy&#039;&#039;. Click ok.&lt;br /&gt;
# Go to &#039;&#039;template&#039;&#039; and clone &amp;lt;tt&amp;gt;data_classification/original_template.em&amp;lt;/tt&amp;gt; with addition of some extra noise with amplitude 1. &lt;br /&gt;
# Click on &#039;&#039;masks&#039;&#039; and click on &#039;&#039;use default masks&#039;&#039;. Click ok.&lt;br /&gt;
# Click on &#039;&#039;numerical parameters&#039;&#039; and set the following parameters. Click ok.&lt;br /&gt;
&lt;br /&gt;
[[File:StartersGuideResultsClassification2.png|thumb|center|400px|]]&lt;br /&gt;
&lt;br /&gt;
Choose the same computing environment as in the previous alignment project and run the project in the same way too. MRA projects usually run longer, because each particle will be aligned to two references. Here, however, we chose the parameters in a way that the process is still fast (e.g., small dimensions). Monitor the progress of the project same as before:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dvstatus drun2&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And visualize the results using the command:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;ddb drun2:a:ref=* -j c5&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should get two averages with particle in one slightly class larger than in the other.&lt;br /&gt;
&lt;br /&gt;
[[File:StartersGuideResultsClassification.png|thumb|center|600px| ￼Results of classification.]]&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=G%C3%B6ttingen_Workshop_2024&amp;diff=5101</id>
		<title>Göttingen Workshop 2024</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=G%C3%B6ttingen_Workshop_2024&amp;diff=5101"/>
		<updated>2024-04-08T11:19:03Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Time Schedule */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Workshop =&lt;br /&gt;
This workshop will take place from April the 10 to April the 12th 2024.&lt;br /&gt;
&lt;br /&gt;
The workshop provides hands-on training in all practical aspects of tomography and sub-tomogram averaging using our software Dynamo, encompassing all stages of the pipeline: alignment and reconstruction of tilt series, tomogram visualization and archiving, particle selection and extraction, and subtomogram alignment, averaging, refinement and classification. No previous experience is required. Computing infrastructure will be provided in place, and we welcome participants to bring their own data sets to work on them during this three-days course.&lt;br /&gt;
&lt;br /&gt;
= Computing resources = &lt;br /&gt;
&lt;br /&gt;
== Laptops ==&lt;br /&gt;
For the first two days, participants will bring their own laptops . However, each participant should also install in their laptop prior to the workshop:&lt;br /&gt;
* (R2024a version), a [https://ch.mathworks.com/campaigns/products/trials.html licence free trial version is available]. &lt;br /&gt;
* [https://www.dynamo-em.org//w/index.php?title=Downloads#Beta_Version  Dynamo ] : prior to installation make sure you have a compiler. On Linux you probably have one by default. On Mac, Xcode needs to be installed. On Windows, the recommended option is to install it via Matlab: &lt;br /&gt;
&lt;br /&gt;
https://es.mathworks.com/help/matlab/matlab_external/install-mingw-support-package.html &lt;br /&gt;
 &lt;br /&gt;
Then, &lt;br /&gt;
&lt;br /&gt;
   &amp;gt;&amp;gt; tar -xvf dynamo_temp_1.1.532.tar&lt;br /&gt;
&lt;br /&gt;
Launch the installed package inside MATLAB.&lt;br /&gt;
&lt;br /&gt;
  &amp;gt;&amp;gt; run &amp;lt;DYNAMO_ROOT&amp;gt;/dynamo_activate.m&lt;br /&gt;
&lt;br /&gt;
Wait while some packages are compiled. Activate it again. &lt;br /&gt;
&lt;br /&gt;
* [https://www.cgl.ucsf.edu/chimera/download.html Chimera]&lt;br /&gt;
&lt;br /&gt;
== Workshop data ==&lt;br /&gt;
&lt;br /&gt;
The data that will be used during the workshop can be downloaded using the google drive link: https://drive.google.com/drive/folders/10lZjjKj1tMfVL_RYJioaK12ji3_RdrNT?usp=drive_link&lt;br /&gt;
&lt;br /&gt;
In detail, the data for the respective modules is as follows (for a total of about 8GB):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Module and data source&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Data source&lt;br /&gt;
|-&lt;br /&gt;
| Starters Guide: subtomogram averaging || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Models: Filaments || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Models: Vesicles || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Models: Surfaces || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Template Matching || https://drive.google.com/drive/folders/1EXXGPMQZhD0lKurzaQ6Nz0Vypj3WUkJP?usp=drive_link (750MB)&lt;br /&gt;
|-&lt;br /&gt;
| Alignment of tilt series || https://drive.google.com/drive/folders/1VPYk91xJ6cLCSy6Mg4UX_dDLHHIhhbp9?usp=drive_link (600MB)&lt;br /&gt;
|-&lt;br /&gt;
| Virus like particles || https://drive.google.com/drive/folders/1Vr108rtKI7knFOmzL06-nfFm1KCKdq4e?usp=drive_link (4.6GB)&lt;br /&gt;
|-&lt;br /&gt;
| Spherical geometries || https://drive.google.com/drive/folders/1arrd1KcscsvCDEasmNISShujWjWCYjlw?usp=drive_link (64 MB)&lt;br /&gt;
|-&lt;br /&gt;
| Principal Component Analysis || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Complete walkthrough on FHV virus || https://drive.google.com/drive/folders/10j1mGTV-4srVV2Hg98eWkAPhPeAbU5BQ?usp=drive_link (2GB)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Access to computational resources==&lt;br /&gt;
On the third day, a more advanced tutorial will be completed. For this we will to access a server which will host the data. Access details will be updated here.&lt;br /&gt;
&lt;br /&gt;
= Time Schedule =&lt;br /&gt;
&lt;br /&gt;
* On the first two days, we will present the basic tools in the Dynamo environment.    &lt;br /&gt;
* The third day will be devoted to a hands-on guide on two practical cases:&lt;br /&gt;
** [https://doi.org/10.3389/fmolb.2018.00082&#039;&#039;Protocols for Subtomogram Averaging of Membrane Proteins in the Dynamo Software Package&#039;&#039;] Navarro PP, Stahlberg H and Castaño-Díez D (2018). Front. Mol. Biosci. 5:82.&lt;br /&gt;
** [https://journals.plos.org/plosbiology/article?id=10.1371/journal.pbio.3001318&#039;&#039;Step-by-step guide to efficient subtomogram averaging of virus-like particles with Dynamo&#039;&#039;] Scaramuzza S, Castaño-Díez D (2021). PLoS biology. 19(8):e3001318.&lt;br /&gt;
&lt;br /&gt;
* On the third day participants are encouraged to make a flash presentation (3 mins, max. slides) describing their past or planned research in tomography. We will study the particular cases of interest of each participant, and identify tools of possible relevance inside the &#039;&#039;Dynamo&#039;&#039; environment, designing with the participants viable processing workflows combining &#039;&#039;Dynamo&#039;&#039; and other packages. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 1 (Morning) General tools&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 09:30 - 10:00|| Research Talk&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 10:00 - 10:45|| General introduction: Hands-on guide to basic tools. &amp;lt;br/&amp;gt; &lt;br /&gt;
[https://wiki.dynamo.biozentrum.unibas.ch/w/doc/misc/conceptsSheet.pdf Basic Dynamo jargon] &amp;lt;br/&amp;gt;&lt;br /&gt;
[https://wiki.dynamo.biozentrum.unibas.ch/w/doc/misc/introductionTablesAndData.pdf Basic formats for data and metadata] &lt;br /&gt;
|-&lt;br /&gt;
| 2 || 11:00 - 12:30 || [[Starters guide (Göttingen 2024) | Starters Guide: subtomogram averaging]]&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| 3 || 13:30 - 14:00 || General modeling&lt;br /&gt;
|-&lt;br /&gt;
| 3a ||14:00 - 14:45  || [[Walkthrough_on_filament_models | Models: Filaments]] &amp;lt;br/&amp;gt;  Additional material: [[Walkthrough model worfklow reuse | Coordinated extraction from several filaments]]&lt;br /&gt;
|-&lt;br /&gt;
| 3b || 14:45 - 15:30 || [[Walkthrough_on_vesicle_models | Models: Vesicles ]] &lt;br /&gt;
|-&lt;br /&gt;
| 3c || 15:30 - 16:30 || [[Walkthrough_on_membrane_models | Models: Surfaces ]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 2  General Tools&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 09:30 - 10:15 || [[Walkthrough for template matching (Göttingen 2024) | Template Matching]]&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 10:15 - 11:30 || [[Walkthrough on PCA through the command line (Göttingen 2024) | Principal Component Analysis ]]&lt;br /&gt;
|-&lt;br /&gt;
| 6a || 11:30 - 12:00 || [[Walkthrough on manual marker clicking | Alignment of tilt series: Manual]] &lt;br /&gt;
|-&lt;br /&gt;
| 6b || 12:00 - 12:30 || [[Walkthrough_on_GUI_based_tilt_series_alignment | Alignment of tilt series: GUI ]]&lt;br /&gt;
|-&lt;br /&gt;
| 6c || 12:30 - 12:45 || [[Walkthrough_on_command_line_based_tilt_series_alignment | Alignment of tilt series: command line]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 2 (Afternoon):  Practical cases&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
| FHV ||  13:30- 17:00 || FHV&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 3 (Whole day):  Practical case: High resolution workflow.&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
| HIV1 || 09:30 - 17:00 || High Resolution workflow for HIV1: preprocessing &amp;lt;br/&amp;gt;&lt;br /&gt;
[[ High resolution walkthrough with HIV1 (Göttingen 2024) | High Resolution workflow for HIV1: Dynamo manipulations ]] &amp;lt;/br&amp;gt;&lt;br /&gt;
High Resolution workflow for HIV1: binding with Relion&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Additional material: &amp;lt;br/&amp;gt;&lt;br /&gt;
* [[Walkthrough for lattices on vesicles | Coordinated extraction from several vesicles]]&lt;br /&gt;
* [[Walkthrough on creation of 3d scenes]]&lt;br /&gt;
* [[Walkthrough on placement of averages on table positions]]&lt;br /&gt;
&lt;br /&gt;
= Instructors =&lt;br /&gt;
* Daniel Castano-Diez (CSIC Bilbao, Spain).&lt;br /&gt;
* Raffaele Coray (CSIC Bilbao, Spain).&lt;br /&gt;
* Alma Vivas-Lago (CSIC Bilbao, Spain).&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=High_resolution_walkthrough_with_HIV1_(G%C3%B6ttingen_2024)&amp;diff=5100</id>
		<title>High resolution walkthrough with HIV1 (Göttingen 2024)</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=High_resolution_walkthrough_with_HIV1_(G%C3%B6ttingen_2024)&amp;diff=5100"/>
		<updated>2024-04-08T11:17:59Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: Created page with &amp;quot;= Goal of the walktrough =  This walktrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experimen...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Goal of the walktrough =&lt;br /&gt;
&lt;br /&gt;
This walktrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this walktrough.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Structure of the walkthrough =&lt;br /&gt;
&lt;br /&gt;
The full HIV1 walkthrough pipeline has been split into multiple sequential steps. Each of these steps corresponds to a subsection of this wiki page. It is possible to reach an average with about ~4 A of resolution starting from 5 tilt series by following all of the steps described in this walkthrough. The only exception is the process to create a tilt series from the microscope movies, which is only discussed in the &amp;quot;Motion correction and dose weighting&amp;quot; subsection.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
However, depending on the hardware available, a full execution of this pipeline can easily take a week of computing time. Additionally, the generated data consumes considerable amounts of memory resources. As such, this walkthrough is has been constructed to be scalable. The full version of the walkthrough code package is divided into two sections: scripts and data. The following figure represents the package tree. The data part includes all of the pre-computed intermediate files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Folder_structure_HIV1_v2.png|centre|thumb|800px| Structure of package containing the data and scripts for the HIV1 walktrough. The full version of the &#039;data&#039; part of the package is 2.2 TB. The &#039;scripts&#039; part is divided into steps. Note the correspondence between the folder names and the subsection names in this wiki page. Each step folder is divided into three parts: inputs, outputs and scripts. The input contains a set of paths to the where the input data is meant to be found in the &#039;data&#039; part of the package. The output contains a set of path of where the generated files of this step should be moved to. The scripts includes the MATLAB codes that will be executed following the practical notes in the wiki page.]]&lt;br /&gt;
&lt;br /&gt;
There are two main approaches on the implementation of walktrough with different scales of memory and computing resource requirements: with pre-computations or full execution. The two approaches are described in the following tables.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! with pre-computations&lt;br /&gt;
|-&lt;br /&gt;
| Requires an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Does not require large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for in-person workshop.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section has been made available from a physical memory.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/1sM8OBQ7LF7OfhMPU0WwfJ31hVeXwTbCh/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The script generally do not need modification.&lt;br /&gt;
|-&lt;br /&gt;
| By default most scripts process only one tilt series. This is done to save computing time.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! full execution&lt;br /&gt;
|-&lt;br /&gt;
| Does not require an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Requires large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for individual practical use.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section starts has mostly empty. The &#039;data&#039; section can be downloaded from https://drive.google.com/file/d/1k4bLLswsacYdIGcNRc76YcbAiycxyPuX/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/1sM8OBQ7LF7OfhMPU0WwfJ31hVeXwTbCh/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts will need modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts need to be modified to process all of the tilt series. The scripts are already structured to simplify the needed modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section. As such, the &#039;data&#039; section needs to be filled with the outputs of the scripts after each step.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As mentioned previously, the &amp;quot;full-execution&amp;quot; approach requires some limited script modifications. The MATLAB scripts have been generally structured so as to present three parts. The first part consists of the paths to the input and output files. The second part is the section of parameters. The third part is a for loop on the input tilt series. As such, the typical modifications necessary for the &amp;quot;full-execution&amp;quot; approach are limited to the first part, ensuring that the inputs for all five tilt series are given.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Additionally, in the &amp;quot;full-execution&amp;quot; approach, the results of the scripts are used to populate the empty &#039;data&#039; section so that the following scripts may be able to access their input files. This means that the files need to be positioned in the correct folder tree location and with a consistent file name. To help with this process, each step has an output text file in its folder with the path and file names that need to be applied to ensure consistency.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+ Time requirements for each step&lt;br /&gt;
|-&lt;br /&gt;
! Step !! Computing time !! Interactive time !! Workshop time !! Notes&lt;br /&gt;
|-&lt;br /&gt;
! Recovery of acquisition parameters &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 5 min &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! Motion correction &lt;br /&gt;
| 1 min per tilt series with GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Not done in this walkthrough&lt;br /&gt;
|-&lt;br /&gt;
! CTF estimation &lt;br /&gt;
| 5 min for all tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using CTFFIND4&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: alignment &lt;br /&gt;
| 8 min per tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: dose weighting &lt;br /&gt;
| 3 min &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default on all tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: CTF correction &lt;br /&gt;
| 1 hour 30 min per tilt series without GPU, 5 min per tilt series with 1 GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using IMOD, executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: tomogram reconstruction &lt;br /&gt;
| 12 min per tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: preparation and management of data &lt;br /&gt;
| 5 min &lt;br /&gt;
| 3 min &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: particle picking &lt;br /&gt;
| - &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| 10 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: particle extraction &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: creation of initial reference &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of first per tomogram average &lt;br /&gt;
| 15 min (CPU) + 1 hour 30 min (8 GPUs) per tilt series &lt;br /&gt;
| 15 min &lt;br /&gt;
| 15 min &lt;br /&gt;
| Use of UCSF Chimera&lt;br /&gt;
|-&lt;br /&gt;
! StA: computing an average of averages &lt;br /&gt;
| 15 min (CPU) &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of second per tomogram average &lt;br /&gt;
| 30 min (CPU) + 3 hours 30 min (8 GPUs) per tilt series &lt;br /&gt;
| 25 min &lt;br /&gt;
| 15 min &lt;br /&gt;
| Use of UCSF Chimera&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of coarse half maps &lt;br /&gt;
| 22 min (CPU) + 48 hours (8 GPUs) &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of refined half maps &lt;br /&gt;
| 1 hour (CPU) + 24 hours (8 GPUs) + 1 hour (CPU) per tilt series &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! FSC computation &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 15 min &lt;br /&gt;
| Using RELION&lt;br /&gt;
|-&lt;br /&gt;
! RELION conversion &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 5 min &lt;br /&gt;
| Using RELION&lt;br /&gt;
|-&lt;br /&gt;
! RELION refinement &lt;br /&gt;
| &amp;gt;40 hours using 8 GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using RELION, split into generation of a RELION template (~1h), extraction of RELION particles (~1h) and then the execution of the RELION refinement&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
= Recovery of acquisition parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the walktrough are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file of a K3 detector inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the links:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
https://relion.readthedocs.io/en/release-3.1/Reference/MovieCompression.html&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the gain correction.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been designed for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this walkthrough after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following walkthrough are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a MATLAB script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags. Note also that if Motioncorr2 cannot find or use the gain file provided, it will not terminate the motion correction and will instead continue computing without gain correction.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, CTFFIND4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, CTFFIND4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal. Note that the CTFFIND4 wrapper has been created for CTFfind version 4.1.5. Using a different CTFfind version may require some limited modifications of the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the CTFFIND4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the CTFFIND4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;change line 178 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. If you are using the pre-computed results, you can load the alignment pipeline object with &amp;lt;code&amp;gt;u = dread(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF&#039;);&amp;lt;/code&amp;gt;, otherwise it will already be in your MATLAB workspace. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD. The tested version of IMOD is 4.11.12.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the line 26 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Note that the reconstruction of a full-size tomogram is resource intensive, especially in memory. In this case, the expected size of a single tomogram is about 100 GB.&amp;lt;/pre&amp;gt; All the tomograms have been pre-computed and stored in the data folder. If you wish to backproject a tomogram it may be done by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GUI will pop up as soon as the catalog &#039;c000.ctlg&#039; is called via   &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dcm c000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create the binned version of the tomogram selecting a factor of 2. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-create-pre-binned-dmmpp.png|centre|thumb|600px| Creation of tomograms binned versions using &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, these versions will be saved inside the folder of the tomograms, not inside the catalogue folder.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow-sta.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
  &#039;&#039;&#039;If the reader is already familiar with &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, they may choose to skip ahead to the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui-sta.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui-sta.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of MATLAB and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui-sta.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and MATLAB (remember that the indexing for your system starts at 0 and for MATLAB at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui-sta.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
Place yourself in the &#039;./scripts&#039; directory. Then, simply move or copy the downloaded wild card script and open it via&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
 open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that all the scripts needed for the StA section have been moved already to the scripts folder.&lt;br /&gt;
&lt;br /&gt;
Within the script, ensure you have updated the environment parameters and paths as necessary. Remember, a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or &#039;&#039;&#039;NaN&#039;&#039;&#039; will precede the lines that require your input. Consider establishing a global variable for consistent use throughout the subsequent scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
 a      = dread(aPath);&lt;br /&gt;
 dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project-sta.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
Let us start by preparing the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
re style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
prepare_average_for_chimera(pr_0)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This function will simply filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera-sta.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera-sta.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer-sta.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-reference-center-gui-sta.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From here, copy and open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering-sta.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
Each project will take about 1 hour 30 min (estimation with 8 gpus). To directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_1{idx} &#039;:as:ite=last&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average-sta.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_average.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. Launch the project by typing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run aligment_for_average.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages-sta.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; procedure, allows for candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script second_aligment_per_tomogram.m There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let us now begin with the hands-on portion of the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open second_aligment_per_tomogram&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before cropping the particles, let us visualize the merged table generated containing the candidate positions before and after subboxing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run second_aligment_per_tomogram.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [root &#039;/catalogue/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
idx = 1;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([pr_1{idx} &#039;:rt&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl-sta.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
We can complete the rest of the script. So, next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). To actually compute the cropping of the particles and the corresponding alignment projects:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_2{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average-sta.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results add the following lines in the loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tips:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue”&amp;gt;You can activate the interactive mode by adding a `keyboard` command in your script, then type in your visualization on the terminal.&lt;br /&gt;
To terminate debug mode and continue execution, use the dbcont command.&lt;br /&gt;
To terminate debug mode and exit the file without completing execution, use the dbquit command.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly to the subboxing section, is interesting to see how the filtering strategy worked. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run coarse_gold_standard_alignment.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification-sta.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference-sta.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration-sta.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, if you have already completed the task filling in the missing parts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aEPath = ddb([pr_EO{1} &#039;:as&#039;]);&lt;br /&gt;
aOPath = ddb([pr_EO{2} &#039;:as&#039;]);&lt;br /&gt;
dshow([dread(aEPath); dread(aOPath)])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps-sta.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration-sta.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask-sta.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus). Launch it via:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run refined_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects.&lt;br /&gt;
&lt;br /&gt;
[[File:final-sta-result-from-refined-gold-standard-sta.png|centre|thumb|600px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;, top left.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to RELION convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, RELION will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera-sta.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this walktrough the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO2.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;half2.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_Sharpen2.png|centre|thumb|600px| RELION Post-process I/O sharpen with automatic B-factor estimation.]]&lt;br /&gt;
[[File:Post_process_Running2.png|centre|thumb|600px| RELION Post-process I/O running with forced mask.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A, force RELION to use your FSC mask and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RELION will compute the FSC curves of the two half map with and without the FSC mask and then will select the best curve to correct and select for the final resolution estimation. It is sometimes the case, especially for membrane protein, that the unmasked FSC will be completely artefactual and this can cause problem for the RELION final resolution estimation. In these cases, RELION will suggest to force the usage of the FSC mask by the &#039;--force_mask&#039; option.&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the resolution even further. However, in this workflow, only the basic RELION steps will be exploited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open the RELION4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click on the RELION4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO_v2.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:RELION_reconstruct_Running.png|centre|thumb|600px| RELION Tomo reconstruct particle running field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make pseudo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make pseudo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make pseudo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make pseudo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make pseudo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_Running.png|centre|thumb|600px| RELION Make pseudo-subtomos running field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here but will not be done because of time limitations. This step took 40h on 8 GPUs and the computed results are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here are some notes on the chosen parameters:&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION requires a certain number of mpi processes to be defined in the Running tab. In the example, by setting 8 GPUs in the compute tab, we require 9 mpi processes: 4 for the even particles, 4 for the odd particles and one mpi master process.&amp;lt;br&amp;gt;&lt;br /&gt;
- By default RELION uses all of the GPU memory available.  GPU device memory (in Mb) to leave free after allocation can be set with the flag --free_gpu_memory.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
[[File:RELION_refine_Reference.png|centre|thumb|600px| RELION 3D auto-refine reference field. Note the low-pass and the symmetry.]]&lt;br /&gt;
[[File:RELION_refine_CTF.png|centre|thumb|600px| RELION 3D auto-refine CTF field.]]&lt;br /&gt;
[[File:RELION_refine_optimisation.png|centre|thumb|600px| RELION 3D auto-refine optimisation field. Note the mask diameter.]]&lt;br /&gt;
[[File:RELION_refine_autosampling.png|centre|thumb|600px| RELION 3D auto-refine auto-sampling field.]]&lt;br /&gt;
[[File:RELION_refine_compute.png|centre|thumb|600px| RELION 3D auto-refine compute field. Note that the ids of the GPUs are separated by the colon symbol &amp;quot;:&amp;quot;.]]&lt;br /&gt;
[[File:RELION_refine_Running.png|centre|thumb|600px| RELION 3D auto-refine running field. Note the number of mpi processes is one more than the number of GPUs]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprocessed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION FSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=G%C3%B6ttingen_Workshop_2024&amp;diff=5099</id>
		<title>Göttingen Workshop 2024</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=G%C3%B6ttingen_Workshop_2024&amp;diff=5099"/>
		<updated>2024-04-08T11:17:41Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Time Schedule */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Workshop =&lt;br /&gt;
This workshop will take place from April the 10 to April the 12th 2024.&lt;br /&gt;
&lt;br /&gt;
The workshop provides hands-on training in all practical aspects of tomography and sub-tomogram averaging using our software Dynamo, encompassing all stages of the pipeline: alignment and reconstruction of tilt series, tomogram visualization and archiving, particle selection and extraction, and subtomogram alignment, averaging, refinement and classification. No previous experience is required. Computing infrastructure will be provided in place, and we welcome participants to bring their own data sets to work on them during this three-days course.&lt;br /&gt;
&lt;br /&gt;
= Computing resources = &lt;br /&gt;
&lt;br /&gt;
== Laptops ==&lt;br /&gt;
For the first two days, participants will bring their own laptops . However, each participant should also install in their laptop prior to the workshop:&lt;br /&gt;
* (R2024a version), a [https://ch.mathworks.com/campaigns/products/trials.html licence free trial version is available]. &lt;br /&gt;
* [https://www.dynamo-em.org//w/index.php?title=Downloads#Beta_Version  Dynamo ] : prior to installation make sure you have a compiler. On Linux you probably have one by default. On Mac, Xcode needs to be installed. On Windows, the recommended option is to install it via Matlab: &lt;br /&gt;
&lt;br /&gt;
https://es.mathworks.com/help/matlab/matlab_external/install-mingw-support-package.html &lt;br /&gt;
 &lt;br /&gt;
Then, &lt;br /&gt;
&lt;br /&gt;
   &amp;gt;&amp;gt; tar -xvf dynamo_temp_1.1.532.tar&lt;br /&gt;
&lt;br /&gt;
Launch the installed package inside MATLAB.&lt;br /&gt;
&lt;br /&gt;
  &amp;gt;&amp;gt; run &amp;lt;DYNAMO_ROOT&amp;gt;/dynamo_activate.m&lt;br /&gt;
&lt;br /&gt;
Wait while some packages are compiled. Activate it again. &lt;br /&gt;
&lt;br /&gt;
* [https://www.cgl.ucsf.edu/chimera/download.html Chimera]&lt;br /&gt;
&lt;br /&gt;
== Workshop data ==&lt;br /&gt;
&lt;br /&gt;
The data that will be used during the workshop can be downloaded using the google drive link: https://drive.google.com/drive/folders/10lZjjKj1tMfVL_RYJioaK12ji3_RdrNT?usp=drive_link&lt;br /&gt;
&lt;br /&gt;
In detail, the data for the respective modules is as follows (for a total of about 8GB):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Module and data source&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Data source&lt;br /&gt;
|-&lt;br /&gt;
| Starters Guide: subtomogram averaging || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Models: Filaments || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Models: Vesicles || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Models: Surfaces || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Template Matching || https://drive.google.com/drive/folders/1EXXGPMQZhD0lKurzaQ6Nz0Vypj3WUkJP?usp=drive_link (750MB)&lt;br /&gt;
|-&lt;br /&gt;
| Alignment of tilt series || https://drive.google.com/drive/folders/1VPYk91xJ6cLCSy6Mg4UX_dDLHHIhhbp9?usp=drive_link (600MB)&lt;br /&gt;
|-&lt;br /&gt;
| Virus like particles || https://drive.google.com/drive/folders/1Vr108rtKI7knFOmzL06-nfFm1KCKdq4e?usp=drive_link (4.6GB)&lt;br /&gt;
|-&lt;br /&gt;
| Spherical geometries || https://drive.google.com/drive/folders/1arrd1KcscsvCDEasmNISShujWjWCYjlw?usp=drive_link (64 MB)&lt;br /&gt;
|-&lt;br /&gt;
| Principal Component Analysis || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Complete walkthrough on FHV virus || https://drive.google.com/drive/folders/10j1mGTV-4srVV2Hg98eWkAPhPeAbU5BQ?usp=drive_link (2GB)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Access to computational resources==&lt;br /&gt;
On the third day, a more advanced tutorial will be completed. For this we will to access a server which will host the data. Access details will be updated here.&lt;br /&gt;
&lt;br /&gt;
= Time Schedule =&lt;br /&gt;
&lt;br /&gt;
* On the first two days, we will present the basic tools in the Dynamo environment.    &lt;br /&gt;
* The third day will be devoted to a hands-on guide on two practical cases:&lt;br /&gt;
** [https://doi.org/10.3389/fmolb.2018.00082&#039;&#039;Protocols for Subtomogram Averaging of Membrane Proteins in the Dynamo Software Package&#039;&#039;] Navarro PP, Stahlberg H and Castaño-Díez D (2018). Front. Mol. Biosci. 5:82.&lt;br /&gt;
** [https://journals.plos.org/plosbiology/article?id=10.1371/journal.pbio.3001318&#039;&#039;Step-by-step guide to efficient subtomogram averaging of virus-like particles with Dynamo&#039;&#039;] Scaramuzza S, Castaño-Díez D (2021). PLoS biology. 19(8):e3001318.&lt;br /&gt;
&lt;br /&gt;
* On the third day participants are encouraged to make a flash presentation (3 mins, max. slides) describing their past or planned research in tomography. We will study the particular cases of interest of each participant, and identify tools of possible relevance inside the &#039;&#039;Dynamo&#039;&#039; environment, designing with the participants viable processing workflows combining &#039;&#039;Dynamo&#039;&#039; and other packages. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 1 (Morning) General tools&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 09:30 - 10:00|| Research Talk&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 10:00 - 10:45|| General introduction: Hands-on guide to basic tools. &amp;lt;br/&amp;gt; &lt;br /&gt;
[https://wiki.dynamo.biozentrum.unibas.ch/w/doc/misc/conceptsSheet.pdf Basic Dynamo jargon] &amp;lt;br/&amp;gt;&lt;br /&gt;
[https://wiki.dynamo.biozentrum.unibas.ch/w/doc/misc/introductionTablesAndData.pdf Basic formats for data and metadata] &lt;br /&gt;
|-&lt;br /&gt;
| 2 || 11:00 - 12:30 || [[Starters guide | Starters Guide: subtomogram averaging]]&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| 3 || 13:30 - 14:00 || General modeling&lt;br /&gt;
|-&lt;br /&gt;
| 3a ||14:00 - 14:45  || [[Walkthrough_on_filament_models | Models: Filaments]] &amp;lt;br/&amp;gt;  Additional material: [[Walkthrough model worfklow reuse | Coordinated extraction from several filaments]]&lt;br /&gt;
|-&lt;br /&gt;
| 3b || 14:45 - 15:30 || [[Walkthrough_on_vesicle_models | Models: Vesicles ]] &lt;br /&gt;
|-&lt;br /&gt;
| 3c || 15:30 - 16:30 || [[Walkthrough_on_membrane_models | Models: Surfaces ]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 2  General Tools&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 09:30 - 10:15 || [[Walkthrough for template matching (Göttingen 2024) | Template Matching]]&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 10:15 - 11:30 || [[Walkthrough on PCA through the command line (Göttingen 2024) | Principal Component Analysis ]]&lt;br /&gt;
|-&lt;br /&gt;
| 6a || 11:30 - 12:00 || [[Walkthrough on manual marker clicking | Alignment of tilt series: Manual]] &lt;br /&gt;
|-&lt;br /&gt;
| 6b || 12:00 - 12:30 || [[Walkthrough_on_GUI_based_tilt_series_alignment | Alignment of tilt series: GUI ]]&lt;br /&gt;
|-&lt;br /&gt;
| 6c || 12:30 - 12:45 || [[Walkthrough_on_command_line_based_tilt_series_alignment | Alignment of tilt series: command line]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 2 (Afternoon):  Practical cases&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
| FHV ||  13:30- 17:00 || FHV&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 3 (Whole day):  Practical case: High resolution workflow.&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
| HIV1 || 09:30 - 17:00 || High Resolution workflow for HIV1: preprocessing &amp;lt;br/&amp;gt;&lt;br /&gt;
[[ High resolution walkthrough with HIV1 (Göttingen 2024) | High Resolution workflow for HIV1: Dynamo manipulations ]] &amp;lt;/br&amp;gt;&lt;br /&gt;
High Resolution workflow for HIV1: binding with Relion&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Additional material: &amp;lt;br/&amp;gt;&lt;br /&gt;
* [[Walkthrough for lattices on vesicles | Coordinated extraction from several vesicles]]&lt;br /&gt;
* [[Walkthrough on creation of 3d scenes]]&lt;br /&gt;
* [[Walkthrough on placement of averages on table positions]]&lt;br /&gt;
&lt;br /&gt;
= Instructors =&lt;br /&gt;
* Daniel Castano-Diez (CSIC Bilbao, Spain).&lt;br /&gt;
* Raffaele Coray (CSIC Bilbao, Spain).&lt;br /&gt;
* Alma Vivas-Lago (CSIC Bilbao, Spain).&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=Walkthrough_on_PCA_through_the_command_line_(G%C3%B6ttingen_2024)&amp;diff=5098</id>
		<title>Walkthrough on PCA through the command line (Göttingen 2024)</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=Walkthrough_on_PCA_through_the_command_line_(G%C3%B6ttingen_2024)&amp;diff=5098"/>
		<updated>2024-04-08T11:16:07Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: Created page with &amp;quot;PCA computations through the command line are governed through &amp;#039;&amp;#039;PCA workflow&amp;#039;&amp;#039; objects. We describe here how to create and handle them:   = C...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Principal component analysis|PCA]] computations through the command line are governed through &#039;&#039;PCA workflow&#039;&#039; objects. We describe here how to create and handle them:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creation of a synthetic data set=&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dtutorial ttest128 -M 64 -N 64 -linear_tags 1 -tight 1&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a set of 128 particles where 64 of the, are slightly smaller than the other 64. The particle subtomogram are randomly oriented, but the alignment parameters are known.&lt;br /&gt;
&lt;br /&gt;
= Creation of a workflow=&lt;br /&gt;
&lt;br /&gt;
== Input elements ==&lt;br /&gt;
The input of a PCA workflow are:&lt;br /&gt;
* a set of particles (called &#039;&#039;data container&#039;&#039; ).&lt;br /&gt;
* a table that expresses the alignment.&lt;br /&gt;
* a mask that indicates the area of each alignment particle that will be taken into account during the classification procedure.&lt;br /&gt;
All three have been generated by the &amp;lt;tt&amp;gt;dtutorial&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
=== Data ===&lt;br /&gt;
 &amp;lt;tt&amp;gt;dataFolder = &#039;ttest128/data&#039;;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Table ===&lt;br /&gt;
 &amp;lt;tt&amp;gt;tableFile  = &#039;ttest128/real.tbl&#039;;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mask ===&lt;br /&gt;
We create a cylindrical mask with the dimensions of the particles (40 pixels)&lt;br /&gt;
 &amp;lt;tt&amp;gt;mask = dcylinder([20,20],40);&amp;lt;/tt&amp;gt;&lt;br /&gt;
===Syntax ===&lt;br /&gt;
We decide a name for the workflow itself, for instance&lt;br /&gt;
 &amp;lt;tt&amp;gt;name = &#039;classtest128&#039;;&amp;lt;/tt&amp;gt;&lt;br /&gt;
Now we are ready to create the workflow:&lt;br /&gt;
  &amp;lt;tt&amp;gt;wb = dpkpca.new(name,&#039;t&#039;,tableFile,&#039;d&#039;,dataFolder,&#039;m&#039;,mask);&amp;lt;/tt&amp;gt;&lt;br /&gt;
This creates an workflow object (arbitrarily called &amp;lt;tt&amp;gt;wb&amp;lt;/tt&amp;gt;) in the workspace during the current session). It also creates a folder called classtest128.PCA where results will be stored as they are produced.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mathematical parameters ==&lt;br /&gt;
The main parameters that can be chosen in this area are:&lt;br /&gt;
* bandpass&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.setBand([0,0.5,2]); % in Nyquist.  % Third parameter is the smoothing factor in pixels&amp;lt;/tt&amp;gt;&lt;br /&gt;
* symmetry&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.setSym(&#039;c8&#039;); &amp;lt;/tt&amp;gt;&lt;br /&gt;
* binning level (to accelerate the computations);&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.settings.general.bin.value = 0;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Computational parameters==&lt;br /&gt;
The main burden of the PCA computation is the creation of the cross correlation matrix.&lt;br /&gt;
=== Computing device ===&lt;br /&gt;
PCA computations can be run on GPUs of on CPUs, in both cases in parallel. In each block, two subsets of (prealigned) particles are read from disk. &lt;br /&gt;
&lt;br /&gt;
To use all the available cores in your local machine, write:&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.settings.computing.cores.value = &#039;*&#039;;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== GPU computing ====&lt;br /&gt;
By default, the ccmatrix computation will run on the CPUs. To force computation in the GPUs  (&#039;&#039;&#039;be certain that you have enough GPUs in your laptop to use this option&#039;&#039;&#039;) you need to active (that is, &amp;lt;code&amp;gt;= true&amp;lt;/code&amp;gt;) them first:&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.settings.computing.useGpus.value = false;&amp;lt;/tt&amp;gt;&lt;br /&gt;
You could also specify specify the device numbers ( &amp;lt;code&amp;gt;wb.settings.computing.gpus.value = [0:7];&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Take into account that your system needs an independent CPU for each used GPU.&lt;br /&gt;
&lt;br /&gt;
=== Size of parallel blocks ===&lt;br /&gt;
The size of the blocks is controlled by the parameter &amp;lt;tt&amp;gt;batch&amp;lt;/tt&amp;gt;. You can tune it with:&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.setBatch(100);&amp;lt;/tt&amp;gt;&lt;br /&gt;
meaning that each block executed in parallel will preload two sets of 100 (prealigned) particles into memory, and then proceed to cross correlate all possible pairs. Ideally, you should tune your &amp;lt;tt&amp;gt;batch&amp;lt;/tt&amp;gt; parameters l to have as many blocks as processing units (CPU cores or GPUs).&lt;br /&gt;
IThis might not be possible, as it might crowd the memory of your device. Thus, in real applications you should aim at using the &amp;lt;tt&amp;gt;batch&amp;lt;/tt&amp;gt; parameter to enforce a tradeoff between performance and  memory usage suited to your system.&lt;br /&gt;
&lt;br /&gt;
If you get an error when running &amp;lt;tt&amp;gt;wb.setBatch(n);&amp;lt;/tt&amp;gt; this is a bug. Try unfolding the project first (&amp;lt;tt&amp;gt;wb.unfold()&amp;lt;/tt&amp;gt;), setting the batch number then unfolding again before running calculations.&lt;br /&gt;
&lt;br /&gt;
==== Utilities to set the batch number ====&lt;br /&gt;
You can get some guidance for the selection of the batch number with &lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.getBlockSize()&amp;lt;/tt&amp;gt;&lt;br /&gt;
which will return the size of each block (in Gibabytes) for the current batch parameter. &lt;br /&gt;
This number depends of the mask, as the block contains in memory only the part of each particle that is inside the mask.&lt;br /&gt;
&lt;br /&gt;
== Unfolding==&lt;br /&gt;
Before running the workflow, it needs to be &#039;&#039;unfolded&#039;&#039;. This operation checks the mutual coherence of the different elements of the workflow, and prepares the file system for runtime.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.unfold();&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Running=&lt;br /&gt;
&lt;br /&gt;
In this workflow we run the steps one by one to discuss them. In real workflows, you can use the &amp;lt;tt&amp;gt;run&amp;lt;/tt&amp;gt; methods to just launch all steps sequentially.&lt;br /&gt;
&lt;br /&gt;
==Prealigning==&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.steps.items.prealign.compute(); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Correlation matrix ==&lt;br /&gt;
All pairs of correlations are computed in blocks, as described above&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.steps.items.ccmatrix.compute(); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Eigentable ==&lt;br /&gt;
The correlation matrix is diagonalised. The eigenvectors are used to expressed as  the particles as combinations of weights.&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.steps.items.eigentable.compute(); &amp;lt;/tt&amp;gt;&lt;br /&gt;
These weights are ordered in descending order relative to their impact on the variance of the set, ideally  a particle should be represented by its few components on this basis. The weights are stored in a regular &#039;&#039;Dynamo&#039;&#039; table. First eigencomponent of a particle goes into column 41.&lt;br /&gt;
&lt;br /&gt;
== Eigenvolumes ==&lt;br /&gt;
The eigenvectors are expressed as three=dimensional volumes.&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.steps.items.eigenvolumes.compute(); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TSNE reduction ==&lt;br /&gt;
TSNE remaps the particles into 2D maps which can be visualised and operated interactively.&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.steps.items.tsne.compute(); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Visualization=&lt;br /&gt;
&lt;br /&gt;
Computed elements have been stored in the workflow folder. Some of them ()  can be directly access through workflow tools. &lt;br /&gt;
&lt;br /&gt;
== Correlation matrix==&lt;br /&gt;
We can visualise the cross correlation matrix&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;m=wb.getCCMatrix();&amp;lt;/tt&amp;gt;&lt;br /&gt;
 &amp;lt;tt&amp;gt;figure;dshow(m);h=gca();&amp;lt;/tt&amp;gt;&lt;br /&gt;
 &amp;lt;tt&amp;gt;h.YDir = &#039;reverse&#039;; &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Eigencomponents ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can use a general browser for &#039;&#039;Dynamo&#039;&#039; tables:&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.exploreGUI;&amp;lt;/tt&amp;gt;&lt;br /&gt;
[[ File:walkthroughPCACommandLine_generalToolForExploringTables.png |thumb|center| 600px|general tool for exploring tables]]&lt;br /&gt;
&lt;br /&gt;
Advanced users: This is just a wrapper to the function &amp;lt;tt&amp;gt;dpktbl.gui&amp;lt;/tt&amp;gt; applied on the eigentable produced by the workflow.&lt;br /&gt;
&lt;br /&gt;
For instance, you can check how two eigencomponents relate to each other:&lt;br /&gt;
&lt;br /&gt;
[[ File:walkthroughPCACommandLine_scatterTabTunedToShowCobehaviourOfFirstTwoEigencomponents.png |thumb|center| 600px|scatter tab tuned to show co-behaviour of first two eigencomponents]]&lt;br /&gt;
&lt;br /&gt;
Pressing the [Scatter 2D] button will create this interactive plot&lt;br /&gt;
[[ File:walkthroughPCACommandLine_scatterplotEigencomponents.png |thumb|center| 600px|scatterplot eigencomponents]]&lt;br /&gt;
Where each point represents a different particle.&lt;br /&gt;
Right-click on it to create a &amp;quot;lasso&amp;quot;, a tool to hand-draw sets of particles.&lt;br /&gt;
[[ File:walkthroughPCACommandLine_rightClickToGetTheOptionsToManuallySelectParticlesThroughALassoTool.png |thumb|center| 600px|right click to get the options to manually select particles through a lasso tool]]&lt;br /&gt;
[[ File:walkthroughPCACommandLine_lassoParticles.png |thumb|center| 200px|lasso particles]]&lt;br /&gt;
&lt;br /&gt;
Right clicking on the &amp;quot;lassoed&amp;quot; particles give you the option of saving the information on the selected set of particles.&lt;br /&gt;
[[ File:walkthroughPCACommandLine_rightClickOnTheLassoToGetOptionsOnThatSubsetOfParticles.png |thumb|center| 600px|right click on the lasso to get options on that subset of particles]]&lt;br /&gt;
&lt;br /&gt;
=== Custom approach===&lt;br /&gt;
You can use your own methods to visualize the eigencomponents. They can be accessed through:&lt;br /&gt;
 &amp;lt;tt&amp;gt;m = wb.getEigencomponents();&amp;lt;/tt&amp;gt;&lt;br /&gt;
will produce a matrix &amp;lt;tt&amp;gt;m&amp;lt;/tt&amp;gt; where each column represents an eigenvector and each row a particle. Thus, to see how a particular eigencomponent distributes among the particles, you can just write (be aware of the single-line requirements for the dynamo shell):&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;for i = 1:5&lt;br /&gt;
      figure; plot(m(:,i), m(:,i+1), &#039;.&#039;);&lt;br /&gt;
 end &amp;lt;/tt&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[ File:walkthroughPCACommandLine_firstEigencomponentOfEachParticle.png |thumb|center| 600px|first eigencomponent of each particle]]&lt;br /&gt;
&lt;br /&gt;
=== Series of plots===&lt;br /&gt;
To check all the eigencomponents, it is a good idea to do some scripting.  The script below uses a handy &#039;&#039;Dynamo&#039;&#039; trick to create several plots in the same figure.&lt;br /&gt;
 &amp;lt;nowiki&amp;gt; gui = mbgraph.montage();&lt;br /&gt;
for i=1:10&lt;br /&gt;
    plot(m(:,i),&#039;.&#039;,&#039;Parent&#039;,gui.gca);&lt;br /&gt;
    % gui.gca captures the&lt;br /&gt;
    gui.step;&lt;br /&gt;
end&lt;br /&gt;
gui.first();&lt;br /&gt;
gui.shg(); &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this will produce ten plots (as i=1:10) collected in a single GUI. Each plot is called a &amp;quot;frame&amp;quot;, and you can view them sequentially or in sets, just play with the layout given by the rows and columns, and use the [Refresh] icon on the top left of the GUI.&lt;br /&gt;
 &lt;br /&gt;
[[ File:walkthroughPCACommandLine_slidingMontageOnTheDistributionOfSeveralEigencomponent.png |thumb|center| 600px|sliding montage on the distribution of several eigencomponent]]&lt;br /&gt;
&lt;br /&gt;
== Eigenvolumes ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;eigSet=wb.getEigenvolume(1:30);&amp;lt;/tt&amp;gt;&lt;br /&gt;
This creates a cell array (arbitrarily called &amp;lt;tt&amp;gt;eigSet&amp;lt;/tt&amp;gt;). We can visualise it through:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;mbvol.groups.montage(eigSet); &amp;lt;/tt&amp;gt;&lt;br /&gt;
[[ File:walkthroughPCACommandLine_eigenvolumes.png |thumb|center| 600px|eigenvolumes ]]&lt;br /&gt;
&lt;br /&gt;
This plot is showing the true relative intensity of the eigenvolumes. In order to compare them, we can show the normalised eigenvolumes instead:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;mbvol.groups.montage(dynamo_normalize_roi(eigSet)); &amp;lt;/tt&amp;gt;&lt;br /&gt;
[[ File:walkthroughPCACommandLine_eigenvolumesAfterNomrmalization.png |thumb|center| 600px|eigenvolumes after nomrmalization]]&lt;br /&gt;
==Correlation of tilts==&lt;br /&gt;
It is a good idea to check if some eigenvolumes correlate strongly with the tilt. &lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.show.correlationEigenvectorTilt(1:10) &amp;lt;/tt&amp;gt;&lt;br /&gt;
[[ File:walkthroughPCACommandLine_correlationOfEigencomponensWithTilt.png |thumb|center| 600px|correlation of eigencomponens with tilt]]&lt;br /&gt;
&lt;br /&gt;
Remember that each particle is accessible through right clicking on it.&lt;br /&gt;
[[ File:walkthroughPCACommandLine_rightClickOnEachPointToAccessTheParticle.png |thumb|center| 600px|right click on each point to access the particle]]&lt;br /&gt;
&lt;br /&gt;
In this plot, each point represents a particle in your data set. We see that in this particular experiment, eigencomponent 3 seems to have been &amp;quot;corrupted by the missing wedge&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==TSNE reduction==&lt;br /&gt;
&lt;br /&gt;
We create on the fly the TSNE reduction for eigencomponents:&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.show.tsne([1,2,4,5]);&amp;lt;/tt&amp;gt;&lt;br /&gt;
will produce the graphics:&lt;br /&gt;
[[ File:walkthroughPCACommandLine_tsneClustering.png |thumb|center| 600px|tsne clustering]]&lt;br /&gt;
TSNE has created a bidimensional proximity map for the 4-dimensional distribution induced by the 4 selected eigenvectors. Note that you can enter a cell array of several sets of indices. You could then navigate through different indices to check the shape of the TSNE reduction for different selections of eigenvolumes:&lt;br /&gt;
 &amp;lt;tt&amp;gt;# wb.show.tsne({[1,2,4,5] , [1:6]});&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Automated clustering ===&lt;br /&gt;
Right clicking on a plot you get an option to automatically segment it using the &amp;lt;tt&amp;gt;dbscan&amp;lt;/tt&amp;gt; method&lt;br /&gt;
[[ File:walkthroughPCACommandLine_rightClickOnTheAxesForAnAutomatedClustering.png |thumb|center| 200px|right click on the axes for an automated clustering]]&lt;br /&gt;
This functionality is intended to let you get a feeling of the results you would get if you would use  &amp;lt;tt&amp;gt;dbscan&amp;lt;/tt&amp;gt; in an algorithm. &lt;br /&gt;
[[ File:walkthroughPCACommandLine_automatedClustering.png |thumb|center| 600px|automated clustering]]&lt;br /&gt;
The results are reasonable, but inferior to what human inspection would yield.&lt;br /&gt;
&lt;br /&gt;
=== Manual clustering ===&lt;br /&gt;
We first right click on the axis to get a lasso tool.&lt;br /&gt;
[[ File:walkthroughPCACommandLine_rightClickOnTheAxesToSelectASetOfParticles.png |thumb|center| 200px|right click on the axes to select a set of particles]]&lt;br /&gt;
Remember that you will have a different plot (depending on the random seed used in TSNE). However, you will probably have at least a well defined cluster.&lt;br /&gt;
[[ File:walkthroughPCACommandLine_useTheLassoToolToSelectAGroup.png |thumb|center| 600px|use the lasso tool to select a group]]&lt;br /&gt;
[[ File:walkthroughPCACommandLine_lassoedParticlesCanBeAveragedTogether.png |thumb|center| 600px|lassoed particles can be averaged together]]&lt;br /&gt;
[[ File:walkthroughPCACommandLine_averageOfParticlesInsideLasso.png |thumb|center| 600px|average of particles inside lasso]]&lt;br /&gt;
[[ File:walkthroughPCACommandLine_aSecondLassoCanBeCreated.png |thumb|center| 100px|a second lasso can be created]]&lt;br /&gt;
&lt;br /&gt;
After delimiting the second subset, we can create the class averages corresponding to this manual selection.&lt;br /&gt;
[[ File:walkthroughPCACommandLine_averageAllManuallySelectedClusters.png |thumb|center| 600px|average all manually selected clusters]]&lt;br /&gt;
&lt;br /&gt;
On opening, &amp;lt;tt&amp;gt;dmapview&amp;lt;/tt&amp;gt; will show all slices of a single volume:&lt;br /&gt;
[[ File:walkthroughPCACommandLine_dmapviewOnOpening.png |thumb|center| 600px|dmapview on opening]]&lt;br /&gt;
Use the &amp;quot;simultaneous view&amp;quot; icon in the toolbar to show the two volumes together.&lt;br /&gt;
[[ File:walkthroughPCACommandLine_showingSeveralVolumesInDmapview.png |thumb|center| 100px|showing several volumes in dmapview]]&lt;br /&gt;
[[ File:walkthroughPCACommandLine_correspondigSlicesOf.png |thumb|center| 600px|correspondig slices of  ]]&lt;br /&gt;
[[ File:walkthroughPCACommandLine_youCanSelectASingleSliceForDepiction.png |thumb|center| 600px|you can select a single slice for depiction]]&lt;br /&gt;
[[ File:walkthroughPCACommandLine_useKeys1And2ToSetAnchors.png |thumb|center| 600px|use keys 1 and 2 to set anchors]]&lt;br /&gt;
[[ File:walkthroughPCACommandLine_rightClickOneAnchorToShowAnIntensityProfile.png |thumb|center| 600px|right click one anchor to show an intensity profile]]&lt;br /&gt;
[[ File:walkthroughPCACommandLine_intensityProfile.png |thumb|center| 600px|intensity profile]]&lt;br /&gt;
&lt;br /&gt;
== Mathematical parameters ==&lt;br /&gt;
The main parameters that can be chosen in this area are:&lt;br /&gt;
* bandpass&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.setBand([0,0.5,2]); % in Nyquist.  % Third parameter is the smoothing factor in pixels&amp;lt;/tt&amp;gt;&lt;br /&gt;
* symmetry&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.setSym(&#039;c8&#039;); &amp;lt;/tt&amp;gt;&lt;br /&gt;
* binning level (to accelerate the computations);&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.settings.general.bin.value = 0;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Computational parameters==&lt;br /&gt;
The main burden of the PCA computation is the creation of the cross correlation matrix.&lt;br /&gt;
=== Computing device ===&lt;br /&gt;
PCA computations can be run on GPUs of on CPUs, in both cases in parallel. In each block, two subsets of (prealigned) particles are read from disk. &lt;br /&gt;
&lt;br /&gt;
To use all the available cores in your local machine, write:&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.settings.computing.cores.value = &#039;*&#039;;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== GPU computing ====&lt;br /&gt;
By default, the ccmatrix computation will run on the CPUs. To force computation in the GPUs  (&#039;&#039;&#039;be certain that you have enough GPUs in your laptop to use this option&#039;&#039;&#039;) you need to active (that is, &amp;lt;code&amp;gt;= true&amp;lt;/code&amp;gt;) them first:&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.settings.computing.useGpus.value = false;&amp;lt;/tt&amp;gt;&lt;br /&gt;
You could also specify specify the device numbers ( &amp;lt;code&amp;gt;wb.settings.computing.gpus.value = [0:7];&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Take into account that your system needs an independent CPU for each used GPU.&lt;br /&gt;
&lt;br /&gt;
=== Size of parallel blocks ===&lt;br /&gt;
The size of the blocks is controlled by the parameter &amp;lt;tt&amp;gt;batch&amp;lt;/tt&amp;gt;. You can tune it with:&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.setBatch(100);&amp;lt;/tt&amp;gt;&lt;br /&gt;
meaning that each block executed in parallel will preload two sets of 100 (prealigned) particles into memory, and then proceed to cross correlate all possible pairs. Ideally, you should tune your &amp;lt;tt&amp;gt;batch&amp;lt;/tt&amp;gt; parameters l to have as many blocks as processing units (CPU cores or GPUs).&lt;br /&gt;
IThis might not be possible, as it might crowd the memory of your device. Thus, in real applications you should aim at using the &amp;lt;tt&amp;gt;batch&amp;lt;/tt&amp;gt; parameter to enforce a tradeoff between performance and  memory usage suited to your system.&lt;br /&gt;
&lt;br /&gt;
If you get an error when running &amp;lt;tt&amp;gt;wb.setBatch(n);&amp;lt;/tt&amp;gt; this is a bug. Try unfolding the project first (&amp;lt;tt&amp;gt;wb.unfold()&amp;lt;/tt&amp;gt;), setting the batch number then unfolding again before running calculations.&lt;br /&gt;
&lt;br /&gt;
==== Utilities to set the batch number ====&lt;br /&gt;
You can get some guidance for the selection of the batch number with &lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.getBlockSize()&amp;lt;/tt&amp;gt;&lt;br /&gt;
which will return the size of each block (in Gibabytes) for the current batch parameter. &lt;br /&gt;
This number depends of the mask, as the block contains in memory only the part of each particle that is inside the mask.&lt;br /&gt;
&lt;br /&gt;
== Unfolding==&lt;br /&gt;
Before running the workflow, it needs to be &#039;&#039;unfolded&#039;&#039;. This operation checks the mutual coherence of the different elements of the workflow, and prepares the file system for runtime.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.unfold();&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Running=&lt;br /&gt;
&lt;br /&gt;
In this workflow we run the steps one by one to discuss them. In real workflows, you can use the &amp;lt;tt&amp;gt;run&amp;lt;/tt&amp;gt; methods to just launch all steps sequentially.&lt;br /&gt;
&lt;br /&gt;
==Prealigning==&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.steps.items.prealign.compute(); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Correlation matrix ==&lt;br /&gt;
All pairs of correlations are computed in blocks, as described above&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.steps.items.ccmatrix.compute(); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Eigentable ==&lt;br /&gt;
The correlation matrix is diagonalised. The eigenvectors are used to expressed as  the particles as combinations of weights.&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.steps.items.eigentable.compute(); &amp;lt;/tt&amp;gt;&lt;br /&gt;
These weights are ordered in descending order relative to their impact on the variance of the set, ideally  a particle should be represented by its few components on this basis. The weights are stored in a regular &#039;&#039;Dynamo&#039;&#039; table. First eigencomponent of a particle goes into column 41.&lt;br /&gt;
&lt;br /&gt;
== Eigenvolumes ==&lt;br /&gt;
The eigenvectors are expressed as three=dimensional volumes.&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.steps.items.eigenvolumes.compute(); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TSNE reduction ==&lt;br /&gt;
TSNE remaps the particles into 2D maps which can be visualised and operated interactively.&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.steps.items.tsne.compute(); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Visualization=&lt;br /&gt;
&lt;br /&gt;
Computed elements have been stored in the workflow folder. Some of them ()  can be directly access through workflow tools. &lt;br /&gt;
&lt;br /&gt;
== Correlation matrix==&lt;br /&gt;
We can visualise the cross correlation matrix&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;m=wb.getCCMatrix();&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;figure;dshow(m);h=gca();&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;h.YDir = &#039;reverse&#039;; &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Eigencomponents ==&lt;br /&gt;
&lt;br /&gt;
=== Predefined exploring  tools===&lt;br /&gt;
You can use a general browser for &#039;&#039;Dynamo&#039;&#039; tables:&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.exploreGUI;&amp;lt;/tt&amp;gt;&lt;br /&gt;
[[ File:walkthroughPCACommandLine_generalToolForExploringTables.png |thumb|center| 600px|general tool for exploring tables]]&lt;br /&gt;
&lt;br /&gt;
Advanced users: This is just a wrapper to the function &amp;lt;tt&amp;gt;dpktbl.gui&amp;lt;/tt&amp;gt; applied on the eigentable produced by the workflow.&lt;br /&gt;
&lt;br /&gt;
For instance, you can check how two eigencomponents relate to each other:&lt;br /&gt;
&lt;br /&gt;
[[ File:walkthroughPCACommandLine_scatterTabTunedToShowCobehaviourOfFirstTwoEigencomponents.png |thumb|center| 600px|scatter tab tuned to show co-behaviour of first two eigencomponents]]&lt;br /&gt;
&lt;br /&gt;
Pressing the [Scatter 2D] button will create this interactive plot&lt;br /&gt;
[[ File:walkthroughPCACommandLine_scatterplotEigencomponents.png |thumb|center| 600px|scatterplot eigencomponents]]&lt;br /&gt;
Where each point represents a different particle.&lt;br /&gt;
Right-click on it to create a &amp;quot;lasso&amp;quot;, a tool to hand-draw sets of particles.&lt;br /&gt;
[[ File:walkthroughPCACommandLine_rightClickToGetTheOptionsToManuallySelectParticlesThroughALassoTool.png |thumb|center| 600px|right click to get the options to manually select particles through a lasso tool]]&lt;br /&gt;
[[ File:walkthroughPCACommandLine_lassoParticles.png |thumb|center| 200px|lasso particles]]&lt;br /&gt;
&lt;br /&gt;
Right clicking on the &amp;quot;lassoed&amp;quot; particles give you the option of saving the information on the selected set of particles.&lt;br /&gt;
[[ File:walkthroughPCACommandLine_rightClickOnTheLassoToGetOptionsOnThatSubsetOfParticles.png |thumb|center| 600px|right click on the lasso to get options on that subset of particles]]&lt;br /&gt;
&lt;br /&gt;
=== Custom approach===&lt;br /&gt;
You can use your own methods to visualize the eigencomponents. They can be accessed through:&lt;br /&gt;
 &amp;lt;tt&amp;gt;m = wb.getEigencomponents();&amp;lt;/tt&amp;gt;&lt;br /&gt;
will produce a matrix &amp;lt;tt&amp;gt;m&amp;lt;/tt&amp;gt; where each column represents an eigenvector and each row a particle. Thus, to see how a particular eigencomponent distributes among the particles, you can just write:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;plot(m(:,i),&#039;.&#039;);&amp;lt;/tt&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[ File:walkthroughPCACommandLine_firstEigencomponentOfEachParticle.png |thumb|center| 600px|first eigencomponent of each particle]]&lt;br /&gt;
&lt;br /&gt;
=== Series of plots===&lt;br /&gt;
To check all the eigencomponents, it is a good idea to do some scripting.  The script below uses a handy &#039;&#039;Dynamo&#039;&#039; trick to create several plots in the same figure.&lt;br /&gt;
 &amp;lt;nowiki&amp;gt; gui = mbgraph.montage();&lt;br /&gt;
for i=1:10&lt;br /&gt;
    plot(m(:,i),&#039;.&#039;,&#039;Parent&#039;,gui.gca);&lt;br /&gt;
    % gui.gca captures the&lt;br /&gt;
      gui.step;&lt;br /&gt;
end&lt;br /&gt;
gui.first();&lt;br /&gt;
gui.shg(); &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this will produce ten plots (as i=1:10) collected in a single GUI. Each plot is called a &amp;quot;frame&amp;quot;, and you can view them sequentially or in sets, just play with the layout given by the rows and columns, and use the [Refresh] icon on the top left of the GUI.&lt;br /&gt;
 &lt;br /&gt;
[[ File:walkthroughPCACommandLine_slidingMontageOnTheDistributionOfSeveralEigencomponent.png |thumb|center| 600px|sliding montage on the distribution of several eigencomponent]]&lt;br /&gt;
&lt;br /&gt;
== Eigenvolumes ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;eigSet=wb.getEigenvolume(1:30);&amp;lt;/tt&amp;gt;&lt;br /&gt;
This creates a cell array (arbitrarily called &amp;lt;tt&amp;gt;eigSet&amp;lt;/tt&amp;gt;). We can visualise it through:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;mbvol.groups.montage(eigSet); &amp;lt;/tt&amp;gt;&lt;br /&gt;
[[ File:walkthroughPCACommandLine_eigenvolumes.png |thumb|center| 600px|eigenvolumes ]]&lt;br /&gt;
&lt;br /&gt;
This plot is showing the true relative intensity of the eigenvolumes. In order to compare them, we can show the normalised eigenvolumes instead:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;mbvol.groups.montage(dynamo_normalize_roi(eigSet)); &amp;lt;/tt&amp;gt;&lt;br /&gt;
[[ File:walkthroughPCACommandLine_eigenvolumesAfterNomrmalization.png |thumb|center| 600px|eigenvolumes after nomrmalization]]&lt;br /&gt;
==Correlation of tilts==&lt;br /&gt;
It is a good idea to check if some eigenvolumes correlate strongly with the tilt. &lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.show.correlationEigenvectorTilt(1:10) &amp;lt;/tt&amp;gt;&lt;br /&gt;
[[ File:walkthroughPCACommandLine_correlationOfEigencomponensWithTilt.png |thumb|center| 600px|correlation of eigencomponens with tilt]]&lt;br /&gt;
&lt;br /&gt;
Remember that each particle is accessible through right clicking on it.&lt;br /&gt;
[[ File:walkthroughPCACommandLine_rightClickOnEachPointToAccessTheParticle.png |thumb|center| 600px|right click on each point to access the particle]]&lt;br /&gt;
&lt;br /&gt;
In this plot, each point represents a particle in your data set. We see that in this particular experiment, eigencomponent 3 seems to have been &amp;quot;corrupted by the missing wedge&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==TSNE reduction==&lt;br /&gt;
&lt;br /&gt;
We create on the fly the TSNE reduction for eigencomponents:&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb.show.tsne([1,2,4,5]);&amp;lt;/tt&amp;gt;&lt;br /&gt;
will produce the graphics:&lt;br /&gt;
[[ File:walkthroughPCACommandLine_tsneClustering.png |thumb|center| 600px|tsne clustering]]&lt;br /&gt;
TSNE has created a bidimensional proximity map for the 4-dimensional distribution induced by the 4 selected eigenvectors. Note that you can enter a cell array of several sets of indices. You could then navigate through different indices to check the shape of the TSNE reduction for different selections of eigenvolumes:&lt;br /&gt;
 &amp;lt;tt&amp;gt;# wb.show.tsne({[1,2,4,5] , [1:6]});&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Automated clustering ===&lt;br /&gt;
Right clicking on a plot you get an option to automatically segment it using the &amp;lt;tt&amp;gt;dbscan&amp;lt;/tt&amp;gt; method&lt;br /&gt;
[[ File:walkthroughPCACommandLine_rightClickOnTheAxesForAnAutomatedClustering.png |thumb|center| 200px|right click on the axes for an automated clustering]]&lt;br /&gt;
This functionality is intended to let you get a feeling of the results you would get if you would use  &amp;lt;tt&amp;gt;dbscan&amp;lt;/tt&amp;gt; in an algorithm. &lt;br /&gt;
[[ File:walkthroughPCACommandLine_automatedClustering.png |thumb|center| 600px|automated clustering]]&lt;br /&gt;
The results are reasonable, but inferior to what human inspection would yield.&lt;br /&gt;
&lt;br /&gt;
=== Manual clustering ===&lt;br /&gt;
We first right click on the axis to get a lasso tool.&lt;br /&gt;
[[ File:walkthroughPCACommandLine_rightClickOnTheAxesToSelectASetOfParticles.png |thumb|center| 200px|right click on the axes to select a set of particles]]&lt;br /&gt;
Remember that you will have a different plot (depending on the random seed used in TSNE). However, you will probably have at least a well defined cluster.&lt;br /&gt;
[[ File:walkthroughPCACommandLine_useTheLassoToolToSelectAGroup.png |thumb|center| 600px|use the lasso tool to select a group]]&lt;br /&gt;
[[ File:walkthroughPCACommandLine_lassoedParticlesCanBeAveragedTogether.png |thumb|center| 600px|lassoed particles can be averaged together]]&lt;br /&gt;
[[ File:walkthroughPCACommandLine_averageOfParticlesInsideLasso.png |thumb|center| 600px|average of particles inside lasso]]&lt;br /&gt;
[[ File:walkthroughPCACommandLine_aSecondLassoCanBeCreated.png |thumb|center| 100px|a second lasso can be created]]&lt;br /&gt;
&lt;br /&gt;
After delimiting the second subset, we can create the class averages corresponding to this manual selection.&lt;br /&gt;
[[ File:walkthroughPCACommandLine_averageAllManuallySelectedClusters.png |thumb|center| 600px|average all manually selected clusters]]&lt;br /&gt;
&lt;br /&gt;
On opening, &amp;lt;tt&amp;gt;dmapview&amp;lt;/tt&amp;gt; will show all slices of a single volume:&lt;br /&gt;
[[ File:walkthroughPCACommandLine_dmapviewOnOpening.png |thumb|center| 600px|dmapview on opening]]&lt;br /&gt;
Use the &amp;quot;simultaneous view&amp;quot; icon in the toolbar to show the two volumes together.&lt;br /&gt;
[[ File:walkthroughPCACommandLine_showingSeveralVolumesInDmapview.png |thumb|center| 100px|showing several volumes in dmapview]]&lt;br /&gt;
[[ File:walkthroughPCACommandLine_correspondigSlicesOf.png |thumb|center| 600px|correspondig slices of  ]]&lt;br /&gt;
[[ File:walkthroughPCACommandLine_youCanSelectASingleSliceForDepiction.png |thumb|center| 600px|you can select a single slice for depiction]]&lt;br /&gt;
[[ File:walkthroughPCACommandLine_useKeys1And2ToSetAnchors.png |thumb|center| 600px|use keys 1 and 2 to set anchors]]&lt;br /&gt;
[[ File:walkthroughPCACommandLine_rightClickOneAnchorToShowAnIntensityProfile.png |thumb|center| 600px|right click one anchor to show an intensity profile]]&lt;br /&gt;
[[ File:walkthroughPCACommandLine_intensityProfile.png |thumb|center| 600px|intensity profile]]&lt;br /&gt;
&lt;br /&gt;
=Manipulation of PCA workflows =&lt;br /&gt;
If you&#039;re exploring this section, you might have encountered an issue with your PCA computation or accidentally closed your Dynamo shell. Alternatively, if you&#039;ve just completed the walkthrough, you might be curious about what this section offers. It is helpful  in both scenarios: recovering from interruptions and providing extra information into managing PCA workflows.&lt;br /&gt;
&lt;br /&gt;
==Reading workflows==&lt;br /&gt;
The workflow object can be recreated by reading the workflow folder.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;wb2 = dread(&#039;classtest128&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that we can name the workflow with an arbitrary variable name. &lt;br /&gt;
&lt;br /&gt;
The workflow needs to be unfolded before being used: &lt;br /&gt;
 &amp;lt;tt&amp;gt;wb2.unfold();&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This concerns not only recomputation of selected steps, but also use of graphical exploration options.&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=G%C3%B6ttingen_Workshop_2024&amp;diff=5097</id>
		<title>Göttingen Workshop 2024</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=G%C3%B6ttingen_Workshop_2024&amp;diff=5097"/>
		<updated>2024-04-08T11:15:51Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Time Schedule */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Workshop =&lt;br /&gt;
This workshop will take place from April the 10 to April the 12th 2024.&lt;br /&gt;
&lt;br /&gt;
The workshop provides hands-on training in all practical aspects of tomography and sub-tomogram averaging using our software Dynamo, encompassing all stages of the pipeline: alignment and reconstruction of tilt series, tomogram visualization and archiving, particle selection and extraction, and subtomogram alignment, averaging, refinement and classification. No previous experience is required. Computing infrastructure will be provided in place, and we welcome participants to bring their own data sets to work on them during this three-days course.&lt;br /&gt;
&lt;br /&gt;
= Computing resources = &lt;br /&gt;
&lt;br /&gt;
== Laptops ==&lt;br /&gt;
For the first two days, participants will bring their own laptops . However, each participant should also install in their laptop prior to the workshop:&lt;br /&gt;
* (R2024a version), a [https://ch.mathworks.com/campaigns/products/trials.html licence free trial version is available]. &lt;br /&gt;
* [https://www.dynamo-em.org//w/index.php?title=Downloads#Beta_Version  Dynamo ] : prior to installation make sure you have a compiler. On Linux you probably have one by default. On Mac, Xcode needs to be installed. On Windows, the recommended option is to install it via Matlab: &lt;br /&gt;
&lt;br /&gt;
https://es.mathworks.com/help/matlab/matlab_external/install-mingw-support-package.html &lt;br /&gt;
 &lt;br /&gt;
Then, &lt;br /&gt;
&lt;br /&gt;
   &amp;gt;&amp;gt; tar -xvf dynamo_temp_1.1.532.tar&lt;br /&gt;
&lt;br /&gt;
Launch the installed package inside MATLAB.&lt;br /&gt;
&lt;br /&gt;
  &amp;gt;&amp;gt; run &amp;lt;DYNAMO_ROOT&amp;gt;/dynamo_activate.m&lt;br /&gt;
&lt;br /&gt;
Wait while some packages are compiled. Activate it again. &lt;br /&gt;
&lt;br /&gt;
* [https://www.cgl.ucsf.edu/chimera/download.html Chimera]&lt;br /&gt;
&lt;br /&gt;
== Workshop data ==&lt;br /&gt;
&lt;br /&gt;
The data that will be used during the workshop can be downloaded using the google drive link: https://drive.google.com/drive/folders/10lZjjKj1tMfVL_RYJioaK12ji3_RdrNT?usp=drive_link&lt;br /&gt;
&lt;br /&gt;
In detail, the data for the respective modules is as follows (for a total of about 8GB):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Module and data source&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Data source&lt;br /&gt;
|-&lt;br /&gt;
| Starters Guide: subtomogram averaging || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Models: Filaments || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Models: Vesicles || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Models: Surfaces || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Template Matching || https://drive.google.com/drive/folders/1EXXGPMQZhD0lKurzaQ6Nz0Vypj3WUkJP?usp=drive_link (750MB)&lt;br /&gt;
|-&lt;br /&gt;
| Alignment of tilt series || https://drive.google.com/drive/folders/1VPYk91xJ6cLCSy6Mg4UX_dDLHHIhhbp9?usp=drive_link (600MB)&lt;br /&gt;
|-&lt;br /&gt;
| Virus like particles || https://drive.google.com/drive/folders/1Vr108rtKI7knFOmzL06-nfFm1KCKdq4e?usp=drive_link (4.6GB)&lt;br /&gt;
|-&lt;br /&gt;
| Spherical geometries || https://drive.google.com/drive/folders/1arrd1KcscsvCDEasmNISShujWjWCYjlw?usp=drive_link (64 MB)&lt;br /&gt;
|-&lt;br /&gt;
| Principal Component Analysis || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Complete walkthrough on FHV virus || https://drive.google.com/drive/folders/10j1mGTV-4srVV2Hg98eWkAPhPeAbU5BQ?usp=drive_link (2GB)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Access to computational resources==&lt;br /&gt;
On the third day, a more advanced tutorial will be completed. For this we will to access a server which will host the data. Access details will be updated here.&lt;br /&gt;
&lt;br /&gt;
= Time Schedule =&lt;br /&gt;
&lt;br /&gt;
* On the first two days, we will present the basic tools in the Dynamo environment.    &lt;br /&gt;
* The third day will be devoted to a hands-on guide on two practical cases:&lt;br /&gt;
** [https://doi.org/10.3389/fmolb.2018.00082&#039;&#039;Protocols for Subtomogram Averaging of Membrane Proteins in the Dynamo Software Package&#039;&#039;] Navarro PP, Stahlberg H and Castaño-Díez D (2018). Front. Mol. Biosci. 5:82.&lt;br /&gt;
** [https://journals.plos.org/plosbiology/article?id=10.1371/journal.pbio.3001318&#039;&#039;Step-by-step guide to efficient subtomogram averaging of virus-like particles with Dynamo&#039;&#039;] Scaramuzza S, Castaño-Díez D (2021). PLoS biology. 19(8):e3001318.&lt;br /&gt;
&lt;br /&gt;
* On the third day participants are encouraged to make a flash presentation (3 mins, max. slides) describing their past or planned research in tomography. We will study the particular cases of interest of each participant, and identify tools of possible relevance inside the &#039;&#039;Dynamo&#039;&#039; environment, designing with the participants viable processing workflows combining &#039;&#039;Dynamo&#039;&#039; and other packages. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 1 (Morning) General tools&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 09:30 - 10:00|| Research Talk&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 10:00 - 10:45|| General introduction: Hands-on guide to basic tools. &amp;lt;br/&amp;gt; &lt;br /&gt;
[https://wiki.dynamo.biozentrum.unibas.ch/w/doc/misc/conceptsSheet.pdf Basic Dynamo jargon] &amp;lt;br/&amp;gt;&lt;br /&gt;
[https://wiki.dynamo.biozentrum.unibas.ch/w/doc/misc/introductionTablesAndData.pdf Basic formats for data and metadata] &lt;br /&gt;
|-&lt;br /&gt;
| 2 || 11:00 - 12:30 || [[Starters guide | Starters Guide: subtomogram averaging]]&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| 3 || 13:30 - 14:00 || General modeling&lt;br /&gt;
|-&lt;br /&gt;
| 3a ||14:00 - 14:45  || [[Walkthrough_on_filament_models | Models: Filaments]] &amp;lt;br/&amp;gt;  Additional material: [[Walkthrough model worfklow reuse | Coordinated extraction from several filaments]]&lt;br /&gt;
|-&lt;br /&gt;
| 3b || 14:45 - 15:30 || [[Walkthrough_on_vesicle_models | Models: Vesicles ]] &lt;br /&gt;
|-&lt;br /&gt;
| 3c || 15:30 - 16:30 || [[Walkthrough_on_membrane_models | Models: Surfaces ]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 2  General Tools&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 09:30 - 10:15 || [[Walkthrough for template matching (Göttingen 2024) | Template Matching]]&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 10:15 - 11:30 || [[Walkthrough on PCA through the command line (Göttingen 2024) | Principal Component Analysis ]]&lt;br /&gt;
|-&lt;br /&gt;
| 6a || 11:30 - 12:00 || [[Walkthrough on manual marker clicking | Alignment of tilt series: Manual]] &lt;br /&gt;
|-&lt;br /&gt;
| 6b || 12:00 - 12:30 || [[Walkthrough_on_GUI_based_tilt_series_alignment | Alignment of tilt series: GUI ]]&lt;br /&gt;
|-&lt;br /&gt;
| 6c || 12:30 - 12:45 || [[Walkthrough_on_command_line_based_tilt_series_alignment | Alignment of tilt series: command line]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 2 (Afternoon):  Practical cases&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
| FHV ||  13:30- 17:00 || FHV&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 3 (Whole day):  Practical case: High resolution workflow.&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
| HIV1 || 09:30 - 17:00 || High Resolution workflow for HIV1: preprocessing &amp;lt;br/&amp;gt;&lt;br /&gt;
[[ High resolution walkthrough with HIV1 | High Resolution workflow for HIV1: Dynamo manipulations ]] &amp;lt;/br&amp;gt;&lt;br /&gt;
High Resolution workflow for HIV1: binding with Relion&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Additional material: &amp;lt;br/&amp;gt;&lt;br /&gt;
* [[Walkthrough for lattices on vesicles | Coordinated extraction from several vesicles]]&lt;br /&gt;
* [[Walkthrough on creation of 3d scenes]]&lt;br /&gt;
* [[Walkthrough on placement of averages on table positions]]&lt;br /&gt;
&lt;br /&gt;
= Instructors =&lt;br /&gt;
* Daniel Castano-Diez (CSIC Bilbao, Spain).&lt;br /&gt;
* Raffaele Coray (CSIC Bilbao, Spain).&lt;br /&gt;
* Alma Vivas-Lago (CSIC Bilbao, Spain).&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=Walkthrough_for_template_matching/_G%C3%B6ttingen_2024&amp;diff=5096</id>
		<title>Walkthrough for template matching/ Göttingen 2024</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=Walkthrough_for_template_matching/_G%C3%B6ttingen_2024&amp;diff=5096"/>
		<updated>2024-04-08T11:14:09Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Walkthroughs]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Dynamo&#039;&#039; includes a set of tools for location of particles inside tomograms. The most simple one is &#039;&#039;template matching&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Template matching ==&lt;br /&gt;
In this technique, a template representing a molecule of interest is systematically cross-correlated against a tomogram, producing a &#039;&#039;cross-correlation map&#039;&#039; 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.&lt;br /&gt;
This similarity is measured exclusively inside a mask.&lt;br /&gt;
&lt;br /&gt;
==Data set ==&lt;br /&gt;
&lt;br /&gt;
=== Tomogram description ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Acknowledgements ===&lt;br /&gt;
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].&lt;br /&gt;
&lt;br /&gt;
=== Getting the tomogram ===&lt;br /&gt;
You should have already a local version of the data. Therefore, navigate to the directory where you just created the tutorial dataset and project.&lt;br /&gt;
&lt;br /&gt;
=== Visualizing the tomogram ===&lt;br /&gt;
&lt;br /&gt;
We can get a first glance on how the tomogram looks like:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dtmshow -otf t20s.mrc &amp;lt;/tt&amp;gt; &lt;br /&gt;
&lt;br /&gt;
to use the &#039;&#039;on-the-fly&#039;&#039; access to the slice shown at each given moment, or &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;v = dread(&#039;t20s.mrc&#039;);dtmshow(v);&amp;lt;/tt&amp;gt; &lt;br /&gt;
&lt;br /&gt;
to preload the full tomogram into a memory variable (arbitrarily called &amp;lt;tt&amp;gt;v&amp;lt;/tt&amp;gt;). 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 &#039;&#039;z&#039;&#039; or &#039;&#039;y&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingTomoshowZ.png |thumb|center|500px| &amp;lt;tt&amp;gt;dtmshow&amp;lt;/tt&amp;gt; on the pt20s tomogram, View along &#039;&#039;z&#039;&#039; ]]&lt;br /&gt;
&lt;br /&gt;
Navigating on-the-fly you&#039;ll see that transitions in &#039;&#039;y&#039;&#039; are slower than transitions in &#039;&#039;z&#039;&#039;, because all the pixels of the same slice are stored sequentially in the disk. &lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingTomoshowY.png |thumb|center|500px| &amp;lt;tt&amp;gt;dtmshow&amp;lt;/tt&amp;gt; on the pt20s tomogram, View along &#039;&#039;y&#039;&#039; ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Estimation of the missing wedge ====&lt;br /&gt;
&lt;br /&gt;
We can quickly check the extent of the missing wedge in the tomogram. We extract a sample of the tomogram:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;fragment = dynamo_read_subtomogram(&#039;t20s.mrc&#039;, &#039;r&#039;,64,&#039;c&#039;,[450,450,100]); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and plot a map of the distribution of the Fourier coefficients:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dynamo_wedge_estimate(fragment,&#039;show&#039;,1); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingWedgeEstimation.png |thumb|center|500px| Estimation of the missing wedge&#039; ]]&lt;br /&gt;
&lt;br /&gt;
== Creating a template ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Through manual alignment ===&lt;br /&gt;
&lt;br /&gt;
We will use a model inside [[Dtmslice | &amp;lt;tt&amp;gt;dtmslice&amp;lt;/tt&amp;gt;]] to pick a set of ~10 particles. We will then crop them, and align them manually using &amp;lt;tt&amp;gt;dgallery&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Manual selection of some particles ====&lt;br /&gt;
&lt;br /&gt;
We use for this our tool &amp;lt;tt&amp;gt;dtmslice&amp;lt;/tt&amp;gt;. As the tomogram is provided is fairly small you can probably just open it without any further binning.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dtmslice t20s.mrc -c ct20s&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingTomosliceGeneral.png |thumb|center|500px| &amp;lt;tt&amp;gt;dtmslice&amp;lt;/tt&amp;gt; on tomogram ]]&lt;br /&gt;
&lt;br /&gt;
Use the &amp;lt;tt&amp;gt;model pool&amp;lt;/tt&amp;gt; menu to add a new model of type &amp;lt;tt&amp;gt;General&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingTomosliceModel.png |thumb|center|500px| Opening a model ]]&lt;br /&gt;
&lt;br /&gt;
Try to pick particles on different orientations, both in top and side views.  Particles are picked with the key &amp;lt;tt&amp;gt;C&amp;lt;/tt&amp;gt;, use &amp;lt;tt&amp;gt;backspace&amp;lt;/tt&amp;gt; to clear the latest selection.&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingTomoslicePick.png |thumb|center|500px| Pick particles with the &amp;lt;tt&amp;gt;C&amp;lt;/tt&amp;gt; key ]]&lt;br /&gt;
&lt;br /&gt;
You can move the slice with the &#039;&#039;z&#039;&#039; slidebar in the control panel, or dragging it while the mouse button is pressed. Top views are more abundant below the crowded accumulation of side views in the central slice.&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingTomoslicePickTop.png |thumb|center|500px| Use the wheel to go up and down in the tomogram to locate top views ]]&lt;br /&gt;
&lt;br /&gt;
When you have clicked around ten, we will prepare to crop them out of the tomogram. For this, we first need to get an approximative idea of how big should be  the box. With the keys [1] and [2] you can place anchor points in the scene. Auxiliary click in the bar between them shows the distance (in pixels of the unbinned tomogram). In view of the measured distance of around 32, we will use a cropping box  size of 48 pixels, in order to ensure that the particles will comfortably fit inside the boxes, as our clicks will not be very precise. &lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingMeasure.png |thumb|center|500px| Measure distances with the [1] and [2] anchors  ]]&lt;br /&gt;
&lt;br /&gt;
Now we can open the &amp;lt;tt&amp;gt;dtcrop&amp;lt;/tt&amp;gt; utility for this model, by visiting the &#039;&#039;Active model&#039;&#039; menu.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingMenuForDtcrop.png |thumb|center|500px | invoking the &amp;lt;tt&amp;gt;dtcrop&amp;lt;/tt&amp;gt; GUI for the active model. ]]&lt;br /&gt;
&lt;br /&gt;
In the GUI that pops up we can fix the sidelength to the value 48. &lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingDtcrop.png |thumb|center|500px  | &amp;lt;tt&amp;gt;dtcrop&amp;lt;/tt&amp;gt; GUI ]]&lt;br /&gt;
&lt;br /&gt;
After completion of the cropping process, you will get a [[data folder]] called  &amp;lt;tt&amp;gt;t20s_Particles.Data&amp;lt;/tt&amp;gt;, which will also contain a [[table]] file called &amp;lt;tt&amp;gt;t20s_Particles.Data/crop.tbl&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Manual alignment of some particles ====&lt;br /&gt;
&lt;br /&gt;
Now we want to align the particles. We open them inside the &amp;lt;tt&amp;gt;dgallery&amp;lt;/tt&amp;gt; browser:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dgallery -d t20s_Particles.Data -t t20s_Particles.Data/crop.tbl &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This GUI has several functionalities. We will focus in using it to quickly get an alignment of the particles.  For this, we first load the particles expressed in the table into the internal memory of the &amp;lt;tt&amp;gt;gallery&amp;lt;/tt&amp;gt; by clicking into &#039;&#039;Load&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingGalleryLoad.png |thumb|center|500px | Preload all the particles into memory ]]&lt;br /&gt;
&lt;br /&gt;
This seems not to have any effect in the depiction: you need to fix the range of the depicted particles moving the slider bar. When you do so, each particle will appear in the scene as  a single red box.&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingGalleryShowAll.png |thumb|center|500px  | Adjust the scene to show all the particles ]]&lt;br /&gt;
&lt;br /&gt;
You can play with different settings for viewing, like the direction (&#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; or &#039;&#039;z&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingControlViewing.png |thumb|center|500px| viewing direction controls  ]]&lt;br /&gt;
&lt;br /&gt;
or the number of slices that are projected into the depicted image for each particle.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingControlThickness.png |thumb|center|500px | Thickness controls  ]]&lt;br /&gt;
&lt;br /&gt;
Then, you go through each particle and indicate a point that you considere that could lay in the central axis of the particle by clicking on &amp;lt;tt&amp;gt;[N]&amp;lt;/tt&amp;gt;. The particle will rotate on screen to match this direction.  The center of the particle can also be set by clicking on &amp;lt;tt&amp;gt;[C]&amp;lt;/tt&amp;gt;. In this case, the particle will not rotate, but will shift to put its center on the spot where the click was operated.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingClickNorth.png |thumb|center|500px| Select the north direction with &amp;lt;tt&amp;gt;N&amp;lt;/tt&amp;gt;  ]]&lt;br /&gt;
&lt;br /&gt;
Top views viewed along &#039;&#039;z&#039;&#039; should not be changed with the &amp;lt;tt&amp;gt;N&amp;lt;/tt&amp;gt; click, only with the &amp;lt;tt&amp;gt;C&amp;lt;/tt&amp;gt; to recenter them if necessary.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingClickNorthTopViewX.png |thumb|center|500px |  Select the north direction with &amp;lt;tt&amp;gt;N&amp;lt;/tt&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
You may need to complete two rounds of operating on the particles, changing the viewing direction (first in &#039;&#039;x&#039;&#039;, then in &#039;&#039;y&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
==== Averaging manually aligned particles ====&lt;br /&gt;
&lt;br /&gt;
We export the table we have computed &lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingQuickSave.png  |thumb|center|500px  ]]&lt;br /&gt;
&lt;br /&gt;
Now we can use the table (saved as file &amp;lt;tt&amp;gt;quickbuffer.tbl&amp;lt;/tt&amp;gt; by default) to create an average of the manually aligned particles:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;oa = daverage(&#039;t20s_Particles.Data&#039;,&#039;t&#039;,&#039;quickbuffer.tbl&#039;); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which can be visualized in &amp;lt;tt&amp;gt;mapview&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dpkdev.legacy.dynamo_mapview(oa.average);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingAverageManual.png |thumb|center|500px  ]]&lt;br /&gt;
&lt;br /&gt;
==== Creating a tight mask  ====&lt;br /&gt;
===== Measure distances =====&lt;br /&gt;
&lt;br /&gt;
Open the computed average in &amp;lt;tt&amp;gt;mapview&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dpkdev.legacy.dynamo_mapview(oa.average); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
set the view to the XZ or YZ planes, &lt;br /&gt;
&lt;br /&gt;
Hit the buttons next to the anchors [C] and [N] then place them with left and right click respectively. This is to measure the semiaxis of the average. Here, we want to click well outside of the signal, as we are measuring the distances that define a mask that needs to contain the average.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingMarkZaxis.png |thumb|center|500px| Measuring the semiaxis in the longitudinal direction in &amp;lt;tt&amp;gt;mapview&amp;lt;/tt&amp;gt; ]]&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;solid&#039;&#039; button to make the points more visible (as solid circles instead of rings). Now, move the [N] anchor to move the radius of the average in the xy plane,&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingMarkXYPlane.png |thumb|center|500px| Measuring the semiaxis in the transversal direction in &amp;lt;tt&amp;gt;mapview&amp;lt;/tt&amp;gt;  ]]&lt;br /&gt;
&lt;br /&gt;
===== Create mask =====&lt;br /&gt;
&lt;br /&gt;
We now symmetrize the density map. Use an arbitrary high value, we have use 17 in our example. The goal is simply to have a strong representation of the signal and to check how the template fits inside the mask that we will create later. &lt;br /&gt;
&lt;br /&gt;
Now, we create a cylindrical mask using the lengths of the semiaxes that we have measured using the anchor points.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingMaskOptions.png |thumb|center|500px  | Creating a cylindrical mask inside  &amp;lt;tt&amp;gt;mapview&amp;lt;/tt&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
We save the created mask into a file&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingMaskSave.png |thumb|center|500px | exporting the created mask into file inside &amp;lt;tt&amp;gt;mapview&amp;lt;/tt&amp;gt; ]]&lt;br /&gt;
&lt;br /&gt;
====Cropping the borders of a template====&lt;br /&gt;
&lt;br /&gt;
We check how the mask looks like on the template&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;shifted =circshift(dsym(oa.average,&#039;c17&#039;),[0,0,-1]);dslices(shifted,&#039;y&#039;,&#039;overlay&#039;,&#039;maskTight.em&#039;,&#039;overlay_as&#039;,&#039;mask&#039;); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;circshift&amp;lt;/tt&amp;gt; operation is just shifting the template, as it seems that it is not well centered. It&#039;s normal: it&#039;s difficult to catch a perfect centering in a manual alignment. Probably in your own data set things will look slightly different. If necessary, you should try with different parameters, and stick with the one that looks like the best alignment. Then save it into a variable in the memory space:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;shifted = circshift(dsym(oa.average,&#039;c17&#039;),[0,0,-1]); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingCircshiftTemplate.png |thumb|center|500px  ]]&lt;br /&gt;
&lt;br /&gt;
Now  we can extract the part of the created template where we actually have signal:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;cropped = dynamo_crop(shifted ,32);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which can be visualized with: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dslices(cropped,&#039;y&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingTemplateInterior.png |thumb|center|500px| Template cropped to 32 pixels ]]&lt;br /&gt;
&lt;br /&gt;
We create a file to contain this cropped template:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt; dwrite(cropped,&#039;average32.em&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and proceed similarly with the mask:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt; dwrite(dcrop(dread(&#039;maskTight.em&#039;),32),&#039;maskTight32.em&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Through geometrical shapes ===&lt;br /&gt;
Alternatively, you can use &amp;lt;tt&amp;gt;dynamo_mask&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;dynamo_tube&amp;lt;/tt&amp;gt; to create a synthetic model.&lt;br /&gt;
&lt;br /&gt;
== Creating a template matching process==&lt;br /&gt;
&lt;br /&gt;
The main function is &amp;lt;tt&amp;gt;dynamo_match&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;pts = dynamo_match(&#039;t20s.mrc&#039;,&#039;average32.em&#039;,&#039;mask&#039;,&#039;maskTight32.em&#039;,...&lt;br /&gt;
    &#039;outputFolder&#039;,&#039;cs30&#039;,...&lt;br /&gt;
    &#039;ytilt&#039;,[-39,36],&#039;sc&#039;,[256,256,256],&#039;cr&#039;,360,&#039;cs&#039;,30,&#039;bin&#039;,1);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: when working in the [[standalone]], you cannot write the &amp;lt;tt&amp;gt;...&amp;lt;/tt&amp;gt; to break the lines, so you&#039;ll need to write in one single line.&lt;br /&gt;
&lt;br /&gt;
* &#039;bin&#039; &amp;lt;br/&amp;gt;  allows binning on the fly. Template, mask and tomograms are input in original size.&lt;br /&gt;
* &#039;sc&#039; : size of chunk &amp;lt;br/&amp;gt; This is the maximum extent of a block in the unbinned tomogram that will be kept in memory by each one of the processors working in parallel (only one in this experiment). We need to be careful not to crowd the available memory.&lt;br /&gt;
* &#039;cr&#039; : cone range &amp;lt;br/&amp;gt; orientations will be looked for inside a cone. In this context, the most usual values are 360 (sample the full sphere) or 0 (do not scan orientations)&lt;br /&gt;
* &#039;cs&#039; : cone sampling &amp;lt;br/&amp;gt; Determines the scanning density inside the sphere.&lt;br /&gt;
* &#039;ir&#039; : in plane range &amp;lt;br/&amp;gt; in plane rotation range&lt;br /&gt;
* &#039;is&#039; : in plane sampling &amp;lt;br/&amp;gt; determines the scanning density for in plane rotations&lt;br /&gt;
* &#039;mw&#039; : number of matlab workers for parallel computation&lt;br /&gt;
&lt;br /&gt;
&#039;ir&#039; and &#039;is&#039; are not used here to speed up computation and because the proteasome has a high rotational symmetry.&lt;br /&gt;
&lt;br /&gt;
&#039;mw&#039; is not used here for compatibility with all systems.&lt;br /&gt;
&lt;br /&gt;
You should get the following response on the screen (will take around 5 minutes to complete)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;------------------------------------------------------------&lt;br /&gt;
 &lt;br /&gt;
 Template matching process.&lt;br /&gt;
 computing in CPU&lt;br /&gt;
 Output folder: cs30.TM&lt;br /&gt;
A total of 1 tiles have been created&lt;br /&gt;
  - Mb per tile (reading)   : 724.19&lt;br /&gt;
  - Mb per tile (operation) : 663.84&lt;br /&gt;
 ... initializing output elements&lt;br /&gt;
Preparing to run on 25 blocks&lt;br /&gt;
Running on single processor&lt;br /&gt;
 Computing tile 1&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Information for each block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ... tile 1 finished in 387 seconds (8 for setup;  7.73 per triplet)&lt;br /&gt;
  [ok] ... template matching process completed upto creation of cross correlation&lt;br /&gt;
       you can proceed to peak location and particle extraction.&lt;br /&gt;
------------------------------------------------------------&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main result of &amp;lt;tt&amp;gt;dynamo_match&amp;lt;/tt&amp;gt; is  a volume (&#039;&#039;cross correlation&#039;&#039; volume) that assigns a score to each pixel. This tomogram is written in the file &amp;lt;tt&amp;gt;cs30/CC.mrc&amp;lt;/tt&amp;gt;. Some auxiliary outputs are other volumes that store the angles [tdrot,tilt,narot] that maximize the cross-correlation for each pixel in the volume. It also creates a binned version of the tomogram, which will be useful to quickly crop particles for the purpose of evaluating the quality of the template matching. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Performance note &amp;lt;/b&amp;gt;: it is possible to run &amp;lt;tt&amp;gt;dynamo_match&amp;lt;/tt&amp;gt; with several CPU cores in parallel, or with several GPUs. Both options increase the performance of the computation.&lt;br /&gt;
* The use of several CPUs can be called by the flag &amp;lt;tt&amp;gt;&#039;matlabWorkers&#039;&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;&#039;mw&#039;&amp;lt;/tt&amp;gt; . The value &amp;lt;tt&amp;gt;&#039;*&#039;&amp;lt;/tt&amp;gt;  will instruct Matlab to use all available cores.&lt;br /&gt;
* You can activate the GPUs by the flag &amp;lt;tt&amp;gt;&#039;gpus&#039;&amp;lt;/tt&amp;gt;. For this, take into account that in this command, the numbers that identify each GPU device are the ones assigned by Matlab; they typically start with 1. This is in opposition to the device counting that you would get from the system, for instance through &amp;lt;tt&amp;gt;nvidia-smi&amp;lt;/tt&amp;gt;, where the counting starts typically with 0. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The &amp;lt;tt&amp;gt;Process&amp;lt;/tt&amp;gt; object ===&lt;br /&gt;
The return &amp;lt;tt&amp;gt;pts&amp;lt;/tt&amp;gt; of the function &amp;lt;tt&amp;gt;dynamo_match&amp;lt;/tt&amp;gt; is an object that keeps track of the location of all the created output, and is used in the subsequent steps that extract the actual location of the peaks&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if you need to reload this object after closing a matlab shell, simply use dynamo_read() on the process.mat file in the template matching directory&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;pts = dread(&#039;cs30.TM/process.mat&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Locating cross correlation peaks  ==&lt;br /&gt;
&lt;br /&gt;
Now we need to identify which peaks of the cross correlation correspond to actual particles.&lt;br /&gt;
&lt;br /&gt;
=== Looking at the cross correlation map ===&lt;br /&gt;
&lt;br /&gt;
We first examine the cross correlation map.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;pts.showCC&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingCCRaw.png |thumb|center|500px| &amp;lt;tt&amp;gt;tmshow&amp;lt;/tt&amp;gt; on the CC volume  ]]&lt;br /&gt;
&lt;br /&gt;
It is possible to operate on the map (through bandpassing or gaussian filtering) to smoothen the volume and get rid of many spurious peaks, but  we won&#039;t do it like thtr in this exercise.&lt;br /&gt;
&lt;br /&gt;
=== Looking at the cross correlation profile ===&lt;br /&gt;
&lt;br /&gt;
We can get a plot of the cross-correlation value found on the local maxima of the cc volume wiith the order&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;pts.peaks.plotCCPeaks(&#039;sidelength&#039;,32);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The cross-correlation values of the peaks appear in ascending order. We can check the quality of the peaks by auxiliary clicking on the curve to select one particle and then selecting some visualization option. &lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingPeakGood.png |thumb|center|500px|  auxiliary click on the area of good peaks ]]&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;sidelength&amp;lt;/tt&amp;gt; that we pass will be used for this visualization options to crop the particle around the peak.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingPeakGoodVolume.png |thumb|center|500px  |  particle cropped around the selected correlation peak]]&lt;br /&gt;
&lt;br /&gt;
We click on a couple of particles in the area of kink in the cross-correlation to roughly estimate the cross-correlation threshold. In our case, it seems to be around 0.37 (being rather conservative)&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingPeakKink.png |thumb|center|500px |  Looking for an area of transition between good and bad peaks]]&lt;br /&gt;
&lt;br /&gt;
In the gaussian distribution below this ara , the peaks do not correspond to particles&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingPeakBad.png |thumb|center|500px | false positives ]]&lt;br /&gt;
&lt;br /&gt;
=== Extracting a table ===&lt;br /&gt;
A table can be extracted through:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;myTable = pts.peaks.computeTable(&#039;mcc&#039;,0.38);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this procedure, the template is first placed back in the position of highest correlation, using the alignment parameters. Then the next correlation maximum is considered, and the template is placed in its location. If the second placement overlaps with the previous one, the second one is considered an spurious maximum and skipped. This procedure is repeated till a threshold of cross correlation is attained (0.38 in this case).&lt;br /&gt;
&lt;br /&gt;
This order creates the variable &amp;lt;tt&amp;gt;myTable&amp;lt;/tt&amp;gt; in the workspace, and stores a copy of it inside the &amp;lt;tt&amp;gt;pts&amp;lt;/tt&amp;gt; objects, so that we can use it to invoke some axiliary functions to evaluate the result of our experiment.&lt;br /&gt;
&lt;br /&gt;
== Visual evaluation of results ==&lt;br /&gt;
&lt;br /&gt;
=== Looking at  table positions===&lt;br /&gt;
&lt;br /&gt;
A sketch of the 3d positions of the particles can be created through&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dtplot(myTable,&#039;pf&#039;,&#039;oriented_positions&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;tt&amp;gt;&#039;pf&#039;&amp;lt;/tt&amp;gt; stands for &#039;&#039;profile&#039;&#039;. There are different predefined visualization profiles that can be passed to &amp;lt;tt&amp;gt;dtplot&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[   File:TemplateMatchingTable3d.png |thumb|center|500px | Particle positions ]]&lt;br /&gt;
&lt;br /&gt;
When rotated to show the YZ plane we see the shape of the layer were proteosomes are packing. This indicates that we don&#039;t have too many false positives.&lt;br /&gt;
&lt;br /&gt;
[[   File:TemplateMatchingTable3dSide.png |thumb|center|500px  ]]&lt;br /&gt;
&lt;br /&gt;
=== Looking at cropped particles ===&lt;br /&gt;
We can check how the individual particles look like on a gallery modus:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;pts.peaks.browse();&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This order just opens &amp;lt;tt&amp;gt;ddbrowse&amp;lt;/tt&amp;gt;. We are using here the support object &amp;lt;tt&amp;gt;peaks&amp;lt;/tt&amp;gt;, but this command is equivalent to just invoking &amp;lt;tt&amp;gt;ddbrowse&amp;lt;/tt&amp;gt; as &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;ddbrowse(&#039;d&#039;,&#039;cs30.TM/binnedTomogram.mrc&#039;,&#039;t&#039;,myTable); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingDDBrowseNoTable.png |thumb|center|500px| &amp;lt;tt&amp;gt;ddbrowse&amp;lt;/tt&amp;gt; with a tomogram as a data source, needing the input of a sidelength in pixels]]&lt;br /&gt;
&lt;br /&gt;
We check the first 100 particles, as they appear inside the tomogram (i.e., without aligning them). We use the &#039;&#039;z&#039;&#039; direction (corresponding to the direction of the electron beam)&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingDDBrowseZ.png |thumb|center|500px| Result launched by &amp;lt;tt&amp;gt;ddbrowse&amp;lt;/tt&amp;gt;  without a connected table  ]]&lt;br /&gt;
&lt;br /&gt;
Now we look at them along the &#039;&#039;z&#039;&#039; direction of the aligned particles.&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingDDBrowseWithTable.png |thumb|center|500px| The table must be connected to align the particles   ]]&lt;br /&gt;
&lt;br /&gt;
Along the z direction we can only recognize particles that were already in a top view/&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingDDBrowseZAligned.png|thumb|center|500px|  &#039;&#039;z&#039;&#039;-view of aligned particles ]]&lt;br /&gt;
&lt;br /&gt;
Note the different appearance of the particles along the &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039; direction.&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;margin: 0 auto;&amp;quot;&lt;br /&gt;
| [[ File:TemplateMatchingDDBrowseXAligned.png |thumb|center|350px| &#039;&#039;x&#039;&#039;-view of aligned particles   ]]&lt;br /&gt;
| [[ File:TemplateMatchingDDBrowseYAligned.png |thumb|center|350px|  &#039;&#039;y&#039;&#039;-view of aligned particles  ]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This different behaviour occurs because we haven&#039;t used any rotational search during the template matching procedure. Thus, the azimuthal angle is initialized to zero, creating this bias.&lt;br /&gt;
&lt;br /&gt;
=== Looking at averages ===&lt;br /&gt;
&lt;br /&gt;
The bias visualized in the aligned particles is not important for the purpose of locating the particles, but we need to take it into account if we want to produce a new template on the results we just computed. A simple averaging&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;oap = pts.peaks.average(48);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will produce a density map showing this different behaviour along &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;. Note that we need to introduce a sidelength (48), as the particles have never been cropped to this point, we are extracting them continuously from the binned tomogram.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;tt&amp;gt;dview(oap);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingAverageRaw.png |thumb|center|500px  ]]&lt;br /&gt;
&lt;br /&gt;
We should randomize the azimuthal angle &lt;br /&gt;
&lt;br /&gt;
  &amp;lt;tt&amp;gt;oapRandomized = pts.peaks.average(48,&#039;ra&#039;,1);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in order to get a well balanced template&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingAverageRandomized.png |thumb|center|500px  ]]&lt;br /&gt;
&lt;br /&gt;
== Getting the tables back into the catalogue ==&lt;br /&gt;
&lt;br /&gt;
You don&#039;t need to operate with the catalogue: you could just use &amp;lt;tt&amp;gt;dtcrop&amp;lt;/tt&amp;gt; on the just computed table  to extract particles from the original tomogram into a [[data folder]]. However, cataloguing has to advantages:&lt;br /&gt;
* Eases keeping track of all the steps you&#039;ve performed, specially if you are going to use several tomograms, and..&lt;br /&gt;
*allows you to visualize the peaks on the tomogram interactively, so that you can delete false positives or add peaks that were not located by the template matching.&lt;br /&gt;
&lt;br /&gt;
===Rescaling the table ===&lt;br /&gt;
&lt;br /&gt;
Remember that the table that we are working with has the scale of the auxiliary binned volume that has been created along with the CC matrix. In the catalogue, we want to work with the particles in their original scale.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;tableOriginalScale = dynamo_table_rescale(myTable,&#039;factor&#039;,2);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the syntax of &amp;lt;tt&amp;gt; dynamo_table_rescale&amp;lt;/tt&amp;gt;, the &amp;lt;tt&amp;gt;factor&amp;lt;/tt&amp;gt; is expressed in terms of how many times is the apix in the original table bigger than in the target table to be computed. In our case, the target table was computed with an apix of 14 Angstrom (one time binned in relation to the tomogram &amp;lt;tt&amp;gt;t20s.rec&amp;lt;/tt&amp;gt;, with an apix of 7.04A). The factor is thus 2. In case of doubt, it is convenient to just run &lt;br /&gt;
&lt;br /&gt;
  &amp;lt;tt&amp;gt;dtinfo(tableOriginalScale);&amp;lt;/tt&amp;gt; &lt;br /&gt;
&lt;br /&gt;
to check the extent of the entries in the columns 24, 25 and 26, which are positions (in pixels) of the particles indexed by the table.  &lt;br /&gt;
Now, if we write the upscaled table into a file&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;tt&amp;gt;dwrite(tableOriginalScale,&#039;peaks.tbl&#039;);&amp;lt;/tt&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Entering result in catalogue ===&lt;br /&gt;
we can just put this table back into the catalogue through:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;tt&amp;gt;dmimport -t peaks.tbl -c ct20s -i 1 -mn ccpeaks&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which will create a model called &amp;lt;tt&amp;gt;ccpeaks&amp;lt;/tt&amp;gt; and assign it to the first volume (&amp;lt;tt&amp;gt;-i 1&amp;lt;/tt&amp;gt;) in the catalogue &amp;lt;tt&amp;gt;ct20s&amp;lt;/tt&amp;gt;. You can check it by writing:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;tt&amp;gt;dcm -c ct20s -i 1 -l m&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which asks for a listing of models (&amp;lt;tt&amp;gt;-l m&amp;lt;/tt&amp;gt;) in the first volume of the catalogue.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingIntoCatalogue.png |thumb|center|500px  ]]&lt;br /&gt;
[[  File:TemplateMatchingIntoCatalogueZoom.png |thumb|center|500px | Zooming inside &amp;lt;tt&amp;gt;dtmslice&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;Ctrl+ mouse wheell&amp;lt;/tt&amp;gt; ]]&lt;br /&gt;
&lt;br /&gt;
The model is editable and you can add or remove individual points.&lt;br /&gt;
&lt;br /&gt;
== Discarding regions ==&lt;br /&gt;
&lt;br /&gt;
Below the planar area that contains the most proteosomes, we see several false positives. Some false positives insist in having high correlation peaks and cannot be discarded  by thresholding. In order to remove them, we can inspect and remove them individually. If they are too many, we will probably prefer to mark regions in the tomogram where we want to keep of discard peaks. In this case we will mark a polygon in the XZ plane, and keep those peaks that fall inside (indepently of the y coordinate). &lt;br /&gt;
&lt;br /&gt;
To to this, press [Y] to get a slice orthogonal to this direction, and adjust the transparence in order to see the points behind the slice.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingDiscardTransparence.png |thumb|center|500px  ]]&lt;br /&gt;
&lt;br /&gt;
Now, we create a surface model, and change its name to &amp;lt;tt&amp;gt;boundary&amp;lt;/tt&amp;gt; for future reference.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingSurfaceMenu.png |thumb|center|500px  ]]&lt;br /&gt;
&lt;br /&gt;
Use  the mouse while keeping CTRL pressed to adjust the view and see along the &#039;&#039;direction&#039;&#039;. Then, use C to draw a line that enclose the area where we see valid peaks.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingSurface.png |thumb|center|600px  ]]&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to save the model when you are done.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingSurfaceSave.png |thumb|center|200px  ]]&lt;br /&gt;
&lt;br /&gt;
=== Keeping peaks inside the selected polygon ===&lt;br /&gt;
&lt;br /&gt;
Now, we can read both models into memory&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;dcmodels ct20s -nc peaks -ws output&lt;br /&gt;
p = dread(output.files{1});&lt;br /&gt;
dcmodels ct20s -nc bound -ws output&lt;br /&gt;
b = dread(output.files{1});&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider only the XZ coordinates in both&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;pXZ = p.points(:,[1,3]);&lt;br /&gt;
bXZ = b.points(:,[1,3]);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compute the indices of the points in the &amp;lt;tt&amp;gt;peaks&amp;lt;/tt&amp;gt; model that are enclosed inside the &amp;lt;tt&amp;gt;boundary&amp;lt;/tt&amp;gt; model (in the xz plane).&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;indicesOfPInsideB = inpolygon(pXZ(:,1),pXZ(:,2),bXZ(:,1),bXZ(:,2));&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the kept peaks ===&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;f = figure();&lt;br /&gt;
hs1 = subplot(2,1,1);&lt;br /&gt;
h = dpkgeom.plotCloud(p.points); axis equal&lt;br /&gt;
h.Marker = &#039;.&#039;;&lt;br /&gt;
view([0,1,0]);&lt;br /&gt;
hs1.ZLim = [0,200];&lt;br /&gt;
hs1.XLim = [0,1000];&lt;br /&gt;
title(&#039;Original peaks&#039;);&lt;br /&gt;
&lt;br /&gt;
hs2 = subplot(2,1,2);&lt;br /&gt;
h = dpkgeom.plotCloud(p.points(indicesOfPInsideB,:)); axis equal; &lt;br /&gt;
h.Marker = &#039;.&#039;;&lt;br /&gt;
hold on;&lt;br /&gt;
hB = dpkgeom.plotCloud(b.points); axis equal&lt;br /&gt;
hB.Marker = &#039;o&#039;;&lt;br /&gt;
hB.LineStyle = &#039;--&#039;;&lt;br /&gt;
hB.MarkerFaceColor = &#039;b&#039;;&lt;br /&gt;
hB.Color = &#039;k&#039;;&lt;br /&gt;
title(&#039;Peaks inside boundary&#039;);&lt;br /&gt;
view([0,1,0]);&lt;br /&gt;
axis(hs2,axis(hs1)); &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingDiscardTPlot.png  |thumb|center|500px  ]]&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=Walkthrough_for_template_matching/_G%C3%B6ttingen_2024&amp;diff=5095</id>
		<title>Walkthrough for template matching/ Göttingen 2024</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=Walkthrough_for_template_matching/_G%C3%B6ttingen_2024&amp;diff=5095"/>
		<updated>2024-04-08T11:12:25Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: Created page with &amp;quot;Category:Walkthroughs  &amp;#039;&amp;#039;Dynamo&amp;#039;&amp;#039; includes a set of tools for location of particles inside tomograms. The most simple one is &amp;#039;&amp;#039;template matching&amp;#039;&amp;#039;.  == Template matching =...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Walkthroughs]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Dynamo&#039;&#039; includes a set of tools for location of particles inside tomograms. The most simple one is &#039;&#039;template matching&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Template matching ==&lt;br /&gt;
In this technique, a template representing a molecule of interest is systematically cross-correlated against a tomogram, producing a &#039;&#039;cross-correlation map&#039;&#039; 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.&lt;br /&gt;
This similarity is measured exclusively inside a mask.&lt;br /&gt;
&lt;br /&gt;
==Data set ==&lt;br /&gt;
&lt;br /&gt;
=== Tomogram description ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Acknowledgements ===&lt;br /&gt;
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].&lt;br /&gt;
&lt;br /&gt;
=== Getting the tomogram ===&lt;br /&gt;
You should have received a local upload the previous day. &#039;&#039;&#039;Otherwise&#039;&#039;&#039;: &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open a new local terminal and navigate to the directory where you just created the tutorial dataset and project.&lt;br /&gt;
 &amp;lt;tt &amp;gt;rsync -av /data/project/bio/tomoworkshop/backup_for_first_day/t20s.mrc ./&lt;br /&gt;
&lt;br /&gt;
=== Visualizing the tomogram ===&lt;br /&gt;
&lt;br /&gt;
We can get a first glance on how the tomogram looks like:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dtmshow -otf t20s.mrc &amp;lt;/tt&amp;gt; &lt;br /&gt;
&lt;br /&gt;
to use the &#039;&#039;on-the-fly&#039;&#039; access to the slice shown at each given moment, or &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;v = dread(&#039;t20s.mrc&#039;);dtmshow(v);&amp;lt;/tt&amp;gt; &lt;br /&gt;
&lt;br /&gt;
to preload the full tomogram into a memory variable (arbitrarily called &amp;lt;tt&amp;gt;v&amp;lt;/tt&amp;gt;). 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 &#039;&#039;z&#039;&#039; or &#039;&#039;y&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingTomoshowZ.png |thumb|center|500px| &amp;lt;tt&amp;gt;dtmshow&amp;lt;/tt&amp;gt; on the pt20s tomogram, View along &#039;&#039;z&#039;&#039; ]]&lt;br /&gt;
&lt;br /&gt;
Navigating on-the-fly you&#039;ll see that transitions in &#039;&#039;y&#039;&#039; are slower than transitions in &#039;&#039;z&#039;&#039;, because all the pixels of the same slice are stored sequentially in the disk. &lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingTomoshowY.png |thumb|center|500px| &amp;lt;tt&amp;gt;dtmshow&amp;lt;/tt&amp;gt; on the pt20s tomogram, View along &#039;&#039;y&#039;&#039; ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Estimation of the missing wedge ====&lt;br /&gt;
&lt;br /&gt;
We can quickly check the extent of the missing wedge in the tomogram. We extract a sample of the tomogram:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;fragment = dynamo_read_subtomogram(&#039;t20s.mrc&#039;, &#039;r&#039;,64,&#039;c&#039;,[450,450,100]); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and plot a map of the distribution of the Fourier coefficients:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dynamo_wedge_estimate(fragment,&#039;show&#039;,1); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingWedgeEstimation.png |thumb|center|500px| Estimation of the missing wedge&#039; ]]&lt;br /&gt;
&lt;br /&gt;
== Creating a template ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Through manual alignment ===&lt;br /&gt;
&lt;br /&gt;
We will use a model inside [[Dtmslice | &amp;lt;tt&amp;gt;dtmslice&amp;lt;/tt&amp;gt;]] to pick a set of ~10 particles. We will then crop them, and align them manually using &amp;lt;tt&amp;gt;dgallery&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Manual selection of some particles ====&lt;br /&gt;
&lt;br /&gt;
We use for this our tool &amp;lt;tt&amp;gt;dtmslice&amp;lt;/tt&amp;gt;. As the tomogram is provided is fairly small you can probably just open it without any further binning.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dtmslice t20s.mrc -c ct20s&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingTomosliceGeneral.png |thumb|center|500px| &amp;lt;tt&amp;gt;dtmslice&amp;lt;/tt&amp;gt; on tomogram ]]&lt;br /&gt;
&lt;br /&gt;
Use the &amp;lt;tt&amp;gt;model pool&amp;lt;/tt&amp;gt; menu to add a new model of type &amp;lt;tt&amp;gt;General&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingTomosliceModel.png |thumb|center|500px| Opening a model ]]&lt;br /&gt;
&lt;br /&gt;
Try to pick particles on different orientations, both in top and side views.  Particles are picked with the key &amp;lt;tt&amp;gt;C&amp;lt;/tt&amp;gt;, use &amp;lt;tt&amp;gt;backspace&amp;lt;/tt&amp;gt; to clear the latest selection.&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingTomoslicePick.png |thumb|center|500px| Pick particles with the &amp;lt;tt&amp;gt;C&amp;lt;/tt&amp;gt; key ]]&lt;br /&gt;
&lt;br /&gt;
You can move the slice with the &#039;&#039;z&#039;&#039; slidebar in the control panel, or dragging it while the mouse button is pressed. Top views are more abundant below the crowded accumulation of side views in the central slice.&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingTomoslicePickTop.png |thumb|center|500px| Use the wheel to go up and down in the tomogram to locate top views ]]&lt;br /&gt;
&lt;br /&gt;
When you have clicked around ten, we will prepare to crop them out of the tomogram. For this, we first need to get an approximative idea of how big should be  the box. With the keys [1] and [2] you can place anchor points in the scene. Auxiliary click in the bar between them shows the distance (in pixels of the unbinned tomogram). In view of the measured distance of around 32, we will use a cropping box  size of 48 pixels, in order to ensure that the particles will comfortably fit inside the boxes, as our clicks will not be very precise. &lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingMeasure.png |thumb|center|500px| Measure distances with the [1] and [2] anchors  ]]&lt;br /&gt;
&lt;br /&gt;
Now we can open the &amp;lt;tt&amp;gt;dtcrop&amp;lt;/tt&amp;gt; utility for this model, by visiting the &#039;&#039;Active model&#039;&#039; menu.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingMenuForDtcrop.png |thumb|center|500px | invoking the &amp;lt;tt&amp;gt;dtcrop&amp;lt;/tt&amp;gt; GUI for the active model. ]]&lt;br /&gt;
&lt;br /&gt;
In the GUI that pops up we can fix the sidelength to the value 48. &lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingDtcrop.png |thumb|center|500px  | &amp;lt;tt&amp;gt;dtcrop&amp;lt;/tt&amp;gt; GUI ]]&lt;br /&gt;
&lt;br /&gt;
After completion of the cropping process, you will get a [[data folder]] called  &amp;lt;tt&amp;gt;t20s_Particles.Data&amp;lt;/tt&amp;gt;, which will also contain a [[table]] file called &amp;lt;tt&amp;gt;t20s_Particles.Data/crop.tbl&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Manual alignment of some particles ====&lt;br /&gt;
&lt;br /&gt;
Now we want to align the particles. We open them inside the &amp;lt;tt&amp;gt;dgallery&amp;lt;/tt&amp;gt; browser:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dgallery -d t20s_Particles.Data -t t20s_Particles.Data/crop.tbl &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This GUI has several functionalities. We will focus in using it to quickly get an alignment of the particles.  For this, we first load the particles expressed in the table into the internal memory of the &amp;lt;tt&amp;gt;gallery&amp;lt;/tt&amp;gt; by clicking into &#039;&#039;Load&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingGalleryLoad.png |thumb|center|500px | Preload all the particles into memory ]]&lt;br /&gt;
&lt;br /&gt;
This seems not to have any effect in the depiction: you need to fix the range of the depicted particles moving the slider bar. When you do so, each particle will appear in the scene as  a single red box.&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingGalleryShowAll.png |thumb|center|500px  | Adjust the scene to show all the particles ]]&lt;br /&gt;
&lt;br /&gt;
You can play with different settings for viewing, like the direction (&#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; or &#039;&#039;z&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingControlViewing.png |thumb|center|500px| viewing direction controls  ]]&lt;br /&gt;
&lt;br /&gt;
or the number of slices that are projected into the depicted image for each particle.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingControlThickness.png |thumb|center|500px | Thickness controls  ]]&lt;br /&gt;
&lt;br /&gt;
Then, you go through each particle and indicate a point that you considere that could lay in the central axis of the particle by clicking on &amp;lt;tt&amp;gt;[N]&amp;lt;/tt&amp;gt;. The particle will rotate on screen to match this direction.  The center of the particle can also be set by clicking on &amp;lt;tt&amp;gt;[C]&amp;lt;/tt&amp;gt;. In this case, the particle will not rotate, but will shift to put its center on the spot where the click was operated.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingClickNorth.png |thumb|center|500px| Select the north direction with &amp;lt;tt&amp;gt;N&amp;lt;/tt&amp;gt;  ]]&lt;br /&gt;
&lt;br /&gt;
Top views viewed along &#039;&#039;z&#039;&#039; should not be changed with the &amp;lt;tt&amp;gt;N&amp;lt;/tt&amp;gt; click, only with the &amp;lt;tt&amp;gt;C&amp;lt;/tt&amp;gt; to recenter them if necessary.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingClickNorthTopViewX.png |thumb|center|500px |  Select the north direction with &amp;lt;tt&amp;gt;N&amp;lt;/tt&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
You may need to complete two rounds of operating on the particles, changing the viewing direction (first in &#039;&#039;x&#039;&#039;, then in &#039;&#039;y&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
==== Averaging manually aligned particles ====&lt;br /&gt;
&lt;br /&gt;
We export the table we have computed &lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingQuickSave.png  |thumb|center|500px  ]]&lt;br /&gt;
&lt;br /&gt;
Now we can use the table (saved as file &amp;lt;tt&amp;gt;quickbuffer.tbl&amp;lt;/tt&amp;gt; by default) to create an average of the manually aligned particles:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;oa = daverage(&#039;t20s_Particles.Data&#039;,&#039;t&#039;,&#039;quickbuffer.tbl&#039;); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which can be visualized in &amp;lt;tt&amp;gt;mapview&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dpkdev.legacy.dynamo_mapview(oa.average);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingAverageManual.png |thumb|center|500px  ]]&lt;br /&gt;
&lt;br /&gt;
==== Creating a tight mask  ====&lt;br /&gt;
===== Measure distances =====&lt;br /&gt;
&lt;br /&gt;
Open the computed average in &amp;lt;tt&amp;gt;mapview&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dpkdev.legacy.dynamo_mapview(oa.average); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
set the view to the XZ or YZ planes, &lt;br /&gt;
&lt;br /&gt;
Hit the buttons next to the anchors [C] and [N] then place them with left and right click respectively. This is to measure the semiaxis of the average. Here, we want to click well outside of the signal, as we are measuring the distances that define a mask that needs to contain the average.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingMarkZaxis.png |thumb|center|500px| Measuring the semiaxis in the longitudinal direction in &amp;lt;tt&amp;gt;mapview&amp;lt;/tt&amp;gt; ]]&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;solid&#039;&#039; button to make the points more visible (as solid circles instead of rings). Now, move the [N] anchor to move the radius of the average in the xy plane,&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingMarkXYPlane.png |thumb|center|500px| Measuring the semiaxis in the transversal direction in &amp;lt;tt&amp;gt;mapview&amp;lt;/tt&amp;gt;  ]]&lt;br /&gt;
&lt;br /&gt;
===== Create mask =====&lt;br /&gt;
&lt;br /&gt;
We now symmetrize the density map. Use an arbitrary high value, we have use 17 in our example. The goal is simply to have a strong representation of the signal and to check how the template fits inside the mask that we will create later. &lt;br /&gt;
&lt;br /&gt;
Now, we create a cylindrical mask using the lengths of the semiaxes that we have measured using the anchor points.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingMaskOptions.png |thumb|center|500px  | Creating a cylindrical mask inside  &amp;lt;tt&amp;gt;mapview&amp;lt;/tt&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
We save the created mask into a file&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingMaskSave.png |thumb|center|500px | exporting the created mask into file inside &amp;lt;tt&amp;gt;mapview&amp;lt;/tt&amp;gt; ]]&lt;br /&gt;
&lt;br /&gt;
====Cropping the borders of a template====&lt;br /&gt;
&lt;br /&gt;
We check how the mask looks like on the template&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;shifted =circshift(dsym(oa.average,&#039;c17&#039;),[0,0,-1]);dslices(shifted,&#039;y&#039;,&#039;overlay&#039;,&#039;maskTight.em&#039;,&#039;overlay_as&#039;,&#039;mask&#039;); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;circshift&amp;lt;/tt&amp;gt; operation is just shifting the template, as it seems that it is not well centered. It&#039;s normal: it&#039;s difficult to catch a perfect centering in a manual alignment. Probably in your own data set things will look slightly different. If necessary, you should try with different parameters, and stick with the one that looks like the best alignment. Then save it into a variable in the memory space:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;shifted = circshift(dsym(oa.average,&#039;c17&#039;),[0,0,-1]); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingCircshiftTemplate.png |thumb|center|500px  ]]&lt;br /&gt;
&lt;br /&gt;
Now  we can extract the part of the created template where we actually have signal:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;cropped = dynamo_crop(shifted ,32);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which can be visualized with: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dslices(cropped,&#039;y&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingTemplateInterior.png |thumb|center|500px| Template cropped to 32 pixels ]]&lt;br /&gt;
&lt;br /&gt;
We create a file to contain this cropped template:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt; dwrite(cropped,&#039;average32.em&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and proceed similarly with the mask:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt; dwrite(dcrop(dread(&#039;maskTight.em&#039;),32),&#039;maskTight32.em&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Through geometrical shapes ===&lt;br /&gt;
Alternatively, you can use &amp;lt;tt&amp;gt;dynamo_mask&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;dynamo_tube&amp;lt;/tt&amp;gt; to create a synthetic model.&lt;br /&gt;
&lt;br /&gt;
== Creating a template matching process==&lt;br /&gt;
&lt;br /&gt;
The main function is &amp;lt;tt&amp;gt;dynamo_match&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;pts = dynamo_match(&#039;t20s.mrc&#039;,&#039;average32.em&#039;,&#039;mask&#039;,&#039;maskTight32.em&#039;,...&lt;br /&gt;
    &#039;outputFolder&#039;,&#039;cs30&#039;,...&lt;br /&gt;
    &#039;ytilt&#039;,[-39,36],&#039;sc&#039;,[256,256,256],&#039;cr&#039;,360,&#039;cs&#039;,30,&#039;bin&#039;,1);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: when working in the [[standalone]], you cannot write the &amp;lt;tt&amp;gt;...&amp;lt;/tt&amp;gt; to break the lines, so you&#039;ll need to write in one single line.&lt;br /&gt;
&lt;br /&gt;
* &#039;bin&#039; &amp;lt;br/&amp;gt;  allows binning on the fly. Template, mask and tomograms are input in original size.&lt;br /&gt;
* &#039;sc&#039; : size of chunk &amp;lt;br/&amp;gt; This is the maximum extent of a block in the unbinned tomogram that will be kept in memory by each one of the processors working in parallel (only one in this experiment). We need to be careful not to crowd the available memory.&lt;br /&gt;
* &#039;cr&#039; : cone range &amp;lt;br/&amp;gt; orientations will be looked for inside a cone. In this context, the most usual values are 360 (sample the full sphere) or 0 (do not scan orientations)&lt;br /&gt;
* &#039;cs&#039; : cone sampling &amp;lt;br/&amp;gt; Determines the scanning density inside the sphere.&lt;br /&gt;
* &#039;ir&#039; : in plane range &amp;lt;br/&amp;gt; in plane rotation range&lt;br /&gt;
* &#039;is&#039; : in plane sampling &amp;lt;br/&amp;gt; determines the scanning density for in plane rotations&lt;br /&gt;
* &#039;mw&#039; : number of matlab workers for parallel computation&lt;br /&gt;
&lt;br /&gt;
&#039;ir&#039; and &#039;is&#039; are not used here to speed up computation and because the proteasome has a high rotational symmetry.&lt;br /&gt;
&lt;br /&gt;
&#039;mw&#039; is not used here for compatibility with all systems.&lt;br /&gt;
&lt;br /&gt;
You should get the following response on the screen (will take around 5 minutes to complete)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;------------------------------------------------------------&lt;br /&gt;
 &lt;br /&gt;
 Template matching process.&lt;br /&gt;
 computing in CPU&lt;br /&gt;
 Output folder: cs30.TM&lt;br /&gt;
A total of 1 tiles have been created&lt;br /&gt;
  - Mb per tile (reading)   : 724.19&lt;br /&gt;
  - Mb per tile (operation) : 663.84&lt;br /&gt;
 ... initializing output elements&lt;br /&gt;
Preparing to run on 25 blocks&lt;br /&gt;
Running on single processor&lt;br /&gt;
 Computing tile 1&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Information for each block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ... tile 1 finished in 387 seconds (8 for setup;  7.73 per triplet)&lt;br /&gt;
  [ok] ... template matching process completed upto creation of cross correlation&lt;br /&gt;
       you can proceed to peak location and particle extraction.&lt;br /&gt;
------------------------------------------------------------&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main result of &amp;lt;tt&amp;gt;dynamo_match&amp;lt;/tt&amp;gt; is  a volume (&#039;&#039;cross correlation&#039;&#039; volume) that assigns a score to each pixel. This tomogram is written in the file &amp;lt;tt&amp;gt;cs30/CC.mrc&amp;lt;/tt&amp;gt;. Some auxiliary outputs are other volumes that store the angles [tdrot,tilt,narot] that maximize the cross-correlation for each pixel in the volume. It also creates a binned version of the tomogram, which will be useful to quickly crop particles for the purpose of evaluating the quality of the template matching. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Performance note &amp;lt;/b&amp;gt;: it is possible to run &amp;lt;tt&amp;gt;dynamo_match&amp;lt;/tt&amp;gt; with several CPU cores in parallel, or with several GPUs. Both options increase the performance of the computation.&lt;br /&gt;
* The use of several CPUs can be called by the flag &amp;lt;tt&amp;gt;&#039;matlabWorkers&#039;&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;&#039;mw&#039;&amp;lt;/tt&amp;gt; . The value &amp;lt;tt&amp;gt;&#039;*&#039;&amp;lt;/tt&amp;gt;  will instruct Matlab to use all available cores.&lt;br /&gt;
* You can activate the GPUs by the flag &amp;lt;tt&amp;gt;&#039;gpus&#039;&amp;lt;/tt&amp;gt;. For this, take into account that in this command, the numbers that identify each GPU device are the ones assigned by Matlab; they typically start with 1. This is in opposition to the device counting that you would get from the system, for instance through &amp;lt;tt&amp;gt;nvidia-smi&amp;lt;/tt&amp;gt;, where the counting starts typically with 0. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The &amp;lt;tt&amp;gt;Process&amp;lt;/tt&amp;gt; object ===&lt;br /&gt;
The return &amp;lt;tt&amp;gt;pts&amp;lt;/tt&amp;gt; of the function &amp;lt;tt&amp;gt;dynamo_match&amp;lt;/tt&amp;gt; is an object that keeps track of the location of all the created output, and is used in the subsequent steps that extract the actual location of the peaks&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if you need to reload this object after closing a matlab shell, simply use dynamo_read() on the process.mat file in the template matching directory&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;pts = dread(&#039;cs30.TM/process.mat&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Locating cross correlation peaks  ==&lt;br /&gt;
&lt;br /&gt;
Now we need to identify which peaks of the cross correlation correspond to actual particles.&lt;br /&gt;
&lt;br /&gt;
=== Looking at the cross correlation map ===&lt;br /&gt;
&lt;br /&gt;
We first examine the cross correlation map.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;pts.showCC&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingCCRaw.png |thumb|center|500px| &amp;lt;tt&amp;gt;tmshow&amp;lt;/tt&amp;gt; on the CC volume  ]]&lt;br /&gt;
&lt;br /&gt;
It is possible to operate on the map (through bandpassing or gaussian filtering) to smoothen the volume and get rid of many spurious peaks, but  we won&#039;t do it like thtr in this exercise.&lt;br /&gt;
&lt;br /&gt;
=== Looking at the cross correlation profile ===&lt;br /&gt;
&lt;br /&gt;
We can get a plot of the cross-correlation value found on the local maxima of the cc volume wiith the order&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;pts.peaks.plotCCPeaks(&#039;sidelength&#039;,32);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The cross-correlation values of the peaks appear in ascending order. We can check the quality of the peaks by auxiliary clicking on the curve to select one particle and then selecting some visualization option. &lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingPeakGood.png |thumb|center|500px|  auxiliary click on the area of good peaks ]]&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;sidelength&amp;lt;/tt&amp;gt; that we pass will be used for this visualization options to crop the particle around the peak.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingPeakGoodVolume.png |thumb|center|500px  |  particle cropped around the selected correlation peak]]&lt;br /&gt;
&lt;br /&gt;
We click on a couple of particles in the area of kink in the cross-correlation to roughly estimate the cross-correlation threshold. In our case, it seems to be around 0.37 (being rather conservative)&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingPeakKink.png |thumb|center|500px |  Looking for an area of transition between good and bad peaks]]&lt;br /&gt;
&lt;br /&gt;
In the gaussian distribution below this ara , the peaks do not correspond to particles&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingPeakBad.png |thumb|center|500px | false positives ]]&lt;br /&gt;
&lt;br /&gt;
=== Extracting a table ===&lt;br /&gt;
A table can be extracted through:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;myTable = pts.peaks.computeTable(&#039;mcc&#039;,0.38);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this procedure, the template is first placed back in the position of highest correlation, using the alignment parameters. Then the next correlation maximum is considered, and the template is placed in its location. If the second placement overlaps with the previous one, the second one is considered an spurious maximum and skipped. This procedure is repeated till a threshold of cross correlation is attained (0.38 in this case).&lt;br /&gt;
&lt;br /&gt;
This order creates the variable &amp;lt;tt&amp;gt;myTable&amp;lt;/tt&amp;gt; in the workspace, and stores a copy of it inside the &amp;lt;tt&amp;gt;pts&amp;lt;/tt&amp;gt; objects, so that we can use it to invoke some axiliary functions to evaluate the result of our experiment.&lt;br /&gt;
&lt;br /&gt;
== Visual evaluation of results ==&lt;br /&gt;
&lt;br /&gt;
=== Looking at  table positions===&lt;br /&gt;
&lt;br /&gt;
A sketch of the 3d positions of the particles can be created through&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;dtplot(myTable,&#039;pf&#039;,&#039;oriented_positions&#039;);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;tt&amp;gt;&#039;pf&#039;&amp;lt;/tt&amp;gt; stands for &#039;&#039;profile&#039;&#039;. There are different predefined visualization profiles that can be passed to &amp;lt;tt&amp;gt;dtplot&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[   File:TemplateMatchingTable3d.png |thumb|center|500px | Particle positions ]]&lt;br /&gt;
&lt;br /&gt;
When rotated to show the YZ plane we see the shape of the layer were proteosomes are packing. This indicates that we don&#039;t have too many false positives.&lt;br /&gt;
&lt;br /&gt;
[[   File:TemplateMatchingTable3dSide.png |thumb|center|500px  ]]&lt;br /&gt;
&lt;br /&gt;
=== Looking at cropped particles ===&lt;br /&gt;
We can check how the individual particles look like on a gallery modus:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;pts.peaks.browse();&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This order just opens &amp;lt;tt&amp;gt;ddbrowse&amp;lt;/tt&amp;gt;. We are using here the support object &amp;lt;tt&amp;gt;peaks&amp;lt;/tt&amp;gt;, but this command is equivalent to just invoking &amp;lt;tt&amp;gt;ddbrowse&amp;lt;/tt&amp;gt; as &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;ddbrowse(&#039;d&#039;,&#039;cs30.TM/binnedTomogram.mrc&#039;,&#039;t&#039;,myTable); &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingDDBrowseNoTable.png |thumb|center|500px| &amp;lt;tt&amp;gt;ddbrowse&amp;lt;/tt&amp;gt; with a tomogram as a data source, needing the input of a sidelength in pixels]]&lt;br /&gt;
&lt;br /&gt;
We check the first 100 particles, as they appear inside the tomogram (i.e., without aligning them). We use the &#039;&#039;z&#039;&#039; direction (corresponding to the direction of the electron beam)&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingDDBrowseZ.png |thumb|center|500px| Result launched by &amp;lt;tt&amp;gt;ddbrowse&amp;lt;/tt&amp;gt;  without a connected table  ]]&lt;br /&gt;
&lt;br /&gt;
Now we look at them along the &#039;&#039;z&#039;&#039; direction of the aligned particles.&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingDDBrowseWithTable.png |thumb|center|500px| The table must be connected to align the particles   ]]&lt;br /&gt;
&lt;br /&gt;
Along the z direction we can only recognize particles that were already in a top view/&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingDDBrowseZAligned.png|thumb|center|500px|  &#039;&#039;z&#039;&#039;-view of aligned particles ]]&lt;br /&gt;
&lt;br /&gt;
Note the different appearance of the particles along the &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039; direction.&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;margin: 0 auto;&amp;quot;&lt;br /&gt;
| [[ File:TemplateMatchingDDBrowseXAligned.png |thumb|center|350px| &#039;&#039;x&#039;&#039;-view of aligned particles   ]]&lt;br /&gt;
| [[ File:TemplateMatchingDDBrowseYAligned.png |thumb|center|350px|  &#039;&#039;y&#039;&#039;-view of aligned particles  ]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This different behaviour occurs because we haven&#039;t used any rotational search during the template matching procedure. Thus, the azimuthal angle is initialized to zero, creating this bias.&lt;br /&gt;
&lt;br /&gt;
=== Looking at averages ===&lt;br /&gt;
&lt;br /&gt;
The bias visualized in the aligned particles is not important for the purpose of locating the particles, but we need to take it into account if we want to produce a new template on the results we just computed. A simple averaging&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;oap = pts.peaks.average(48);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will produce a density map showing this different behaviour along &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;. Note that we need to introduce a sidelength (48), as the particles have never been cropped to this point, we are extracting them continuously from the binned tomogram.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;tt&amp;gt;dview(oap);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingAverageRaw.png |thumb|center|500px  ]]&lt;br /&gt;
&lt;br /&gt;
We should randomize the azimuthal angle &lt;br /&gt;
&lt;br /&gt;
  &amp;lt;tt&amp;gt;oapRandomized = pts.peaks.average(48,&#039;ra&#039;,1);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in order to get a well balanced template&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingAverageRandomized.png |thumb|center|500px  ]]&lt;br /&gt;
&lt;br /&gt;
== Getting the tables back into the catalogue ==&lt;br /&gt;
&lt;br /&gt;
You don&#039;t need to operate with the catalogue: you could just use &amp;lt;tt&amp;gt;dtcrop&amp;lt;/tt&amp;gt; on the just computed table  to extract particles from the original tomogram into a [[data folder]]. However, cataloguing has to advantages:&lt;br /&gt;
* Eases keeping track of all the steps you&#039;ve performed, specially if you are going to use several tomograms, and..&lt;br /&gt;
*allows you to visualize the peaks on the tomogram interactively, so that you can delete false positives or add peaks that were not located by the template matching.&lt;br /&gt;
&lt;br /&gt;
===Rescaling the table ===&lt;br /&gt;
&lt;br /&gt;
Remember that the table that we are working with has the scale of the auxiliary binned volume that has been created along with the CC matrix. In the catalogue, we want to work with the particles in their original scale.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;tableOriginalScale = dynamo_table_rescale(myTable,&#039;factor&#039;,2);&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the syntax of &amp;lt;tt&amp;gt; dynamo_table_rescale&amp;lt;/tt&amp;gt;, the &amp;lt;tt&amp;gt;factor&amp;lt;/tt&amp;gt; is expressed in terms of how many times is the apix in the original table bigger than in the target table to be computed. In our case, the target table was computed with an apix of 14 Angstrom (one time binned in relation to the tomogram &amp;lt;tt&amp;gt;t20s.rec&amp;lt;/tt&amp;gt;, with an apix of 7.04A). The factor is thus 2. In case of doubt, it is convenient to just run &lt;br /&gt;
&lt;br /&gt;
  &amp;lt;tt&amp;gt;dtinfo(tableOriginalScale);&amp;lt;/tt&amp;gt; &lt;br /&gt;
&lt;br /&gt;
to check the extent of the entries in the columns 24, 25 and 26, which are positions (in pixels) of the particles indexed by the table.  &lt;br /&gt;
Now, if we write the upscaled table into a file&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;tt&amp;gt;dwrite(tableOriginalScale,&#039;peaks.tbl&#039;);&amp;lt;/tt&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Entering result in catalogue ===&lt;br /&gt;
we can just put this table back into the catalogue through:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;tt&amp;gt;dmimport -t peaks.tbl -c ct20s -i 1 -mn ccpeaks&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which will create a model called &amp;lt;tt&amp;gt;ccpeaks&amp;lt;/tt&amp;gt; and assign it to the first volume (&amp;lt;tt&amp;gt;-i 1&amp;lt;/tt&amp;gt;) in the catalogue &amp;lt;tt&amp;gt;ct20s&amp;lt;/tt&amp;gt;. You can check it by writing:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;tt&amp;gt;dcm -c ct20s -i 1 -l m&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which asks for a listing of models (&amp;lt;tt&amp;gt;-l m&amp;lt;/tt&amp;gt;) in the first volume of the catalogue.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingIntoCatalogue.png |thumb|center|500px  ]]&lt;br /&gt;
[[  File:TemplateMatchingIntoCatalogueZoom.png |thumb|center|500px | Zooming inside &amp;lt;tt&amp;gt;dtmslice&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;Ctrl+ mouse wheell&amp;lt;/tt&amp;gt; ]]&lt;br /&gt;
&lt;br /&gt;
The model is editable and you can add or remove individual points.&lt;br /&gt;
&lt;br /&gt;
== Discarding regions ==&lt;br /&gt;
&lt;br /&gt;
Below the planar area that contains the most proteosomes, we see several false positives. Some false positives insist in having high correlation peaks and cannot be discarded  by thresholding. In order to remove them, we can inspect and remove them individually. If they are too many, we will probably prefer to mark regions in the tomogram where we want to keep of discard peaks. In this case we will mark a polygon in the XZ plane, and keep those peaks that fall inside (indepently of the y coordinate). &lt;br /&gt;
&lt;br /&gt;
To to this, press [Y] to get a slice orthogonal to this direction, and adjust the transparence in order to see the points behind the slice.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingDiscardTransparence.png |thumb|center|500px  ]]&lt;br /&gt;
&lt;br /&gt;
Now, we create a surface model, and change its name to &amp;lt;tt&amp;gt;boundary&amp;lt;/tt&amp;gt; for future reference.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingSurfaceMenu.png |thumb|center|500px  ]]&lt;br /&gt;
&lt;br /&gt;
Use  the mouse while keeping CTRL pressed to adjust the view and see along the &#039;&#039;direction&#039;&#039;. Then, use C to draw a line that enclose the area where we see valid peaks.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingSurface.png |thumb|center|600px  ]]&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to save the model when you are done.&lt;br /&gt;
&lt;br /&gt;
[[  File:TemplateMatchingSurfaceSave.png |thumb|center|200px  ]]&lt;br /&gt;
&lt;br /&gt;
=== Keeping peaks inside the selected polygon ===&lt;br /&gt;
&lt;br /&gt;
Now, we can read both models into memory&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;dcmodels ct20s -nc peaks -ws output&lt;br /&gt;
p = dread(output.files{1});&lt;br /&gt;
dcmodels ct20s -nc bound -ws output&lt;br /&gt;
b = dread(output.files{1});&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider only the XZ coordinates in both&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;pXZ = p.points(:,[1,3]);&lt;br /&gt;
bXZ = b.points(:,[1,3]);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compute the indices of the points in the &amp;lt;tt&amp;gt;peaks&amp;lt;/tt&amp;gt; model that are enclosed inside the &amp;lt;tt&amp;gt;boundary&amp;lt;/tt&amp;gt; model (in the xz plane).&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;indicesOfPInsideB = inpolygon(pXZ(:,1),pXZ(:,2),bXZ(:,1),bXZ(:,2));&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the kept peaks ===&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;f = figure();&lt;br /&gt;
hs1 = subplot(2,1,1);&lt;br /&gt;
h = dpkgeom.plotCloud(p.points); axis equal&lt;br /&gt;
h.Marker = &#039;.&#039;;&lt;br /&gt;
view([0,1,0]);&lt;br /&gt;
hs1.ZLim = [0,200];&lt;br /&gt;
hs1.XLim = [0,1000];&lt;br /&gt;
title(&#039;Original peaks&#039;);&lt;br /&gt;
&lt;br /&gt;
hs2 = subplot(2,1,2);&lt;br /&gt;
h = dpkgeom.plotCloud(p.points(indicesOfPInsideB,:)); axis equal; &lt;br /&gt;
h.Marker = &#039;.&#039;;&lt;br /&gt;
hold on;&lt;br /&gt;
hB = dpkgeom.plotCloud(b.points); axis equal&lt;br /&gt;
hB.Marker = &#039;o&#039;;&lt;br /&gt;
hB.LineStyle = &#039;--&#039;;&lt;br /&gt;
hB.MarkerFaceColor = &#039;b&#039;;&lt;br /&gt;
hB.Color = &#039;k&#039;;&lt;br /&gt;
title(&#039;Peaks inside boundary&#039;);&lt;br /&gt;
view([0,1,0]);&lt;br /&gt;
axis(hs2,axis(hs1)); &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[ File:TemplateMatchingDiscardTPlot.png  |thumb|center|500px  ]]&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=G%C3%B6ttingen_Workshop_2024&amp;diff=5094</id>
		<title>Göttingen Workshop 2024</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=G%C3%B6ttingen_Workshop_2024&amp;diff=5094"/>
		<updated>2024-04-08T11:10:42Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Time Schedule */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Workshop =&lt;br /&gt;
This workshop will take place from April the 10 to April the 12th 2024.&lt;br /&gt;
&lt;br /&gt;
The workshop provides hands-on training in all practical aspects of tomography and sub-tomogram averaging using our software Dynamo, encompassing all stages of the pipeline: alignment and reconstruction of tilt series, tomogram visualization and archiving, particle selection and extraction, and subtomogram alignment, averaging, refinement and classification. No previous experience is required. Computing infrastructure will be provided in place, and we welcome participants to bring their own data sets to work on them during this three-days course.&lt;br /&gt;
&lt;br /&gt;
= Computing resources = &lt;br /&gt;
&lt;br /&gt;
== Laptops ==&lt;br /&gt;
For the first two days, participants will bring their own laptops . However, each participant should also install in their laptop prior to the workshop:&lt;br /&gt;
* (R2024a version), a [https://ch.mathworks.com/campaigns/products/trials.html licence free trial version is available]. &lt;br /&gt;
* [https://www.dynamo-em.org//w/index.php?title=Downloads#Beta_Version  Dynamo ] : prior to installation make sure you have a compiler. On Linux you probably have one by default. On Mac, Xcode needs to be installed. On Windows, the recommended option is to install it via Matlab: &lt;br /&gt;
&lt;br /&gt;
https://es.mathworks.com/help/matlab/matlab_external/install-mingw-support-package.html &lt;br /&gt;
 &lt;br /&gt;
Then, &lt;br /&gt;
&lt;br /&gt;
   &amp;gt;&amp;gt; tar -xvf dynamo_temp_1.1.532.tar&lt;br /&gt;
&lt;br /&gt;
Launch the installed package inside MATLAB.&lt;br /&gt;
&lt;br /&gt;
  &amp;gt;&amp;gt; run &amp;lt;DYNAMO_ROOT&amp;gt;/dynamo_activate.m&lt;br /&gt;
&lt;br /&gt;
Wait while some packages are compiled. Activate it again. &lt;br /&gt;
&lt;br /&gt;
* [https://www.cgl.ucsf.edu/chimera/download.html Chimera]&lt;br /&gt;
&lt;br /&gt;
== Workshop data ==&lt;br /&gt;
&lt;br /&gt;
The data that will be used during the workshop can be downloaded using the google drive link: https://drive.google.com/drive/folders/10lZjjKj1tMfVL_RYJioaK12ji3_RdrNT?usp=drive_link&lt;br /&gt;
&lt;br /&gt;
In detail, the data for the respective modules is as follows (for a total of about 8GB):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Module and data source&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Data source&lt;br /&gt;
|-&lt;br /&gt;
| Starters Guide: subtomogram averaging || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Models: Filaments || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Models: Vesicles || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Models: Surfaces || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Template Matching || https://drive.google.com/drive/folders/1EXXGPMQZhD0lKurzaQ6Nz0Vypj3WUkJP?usp=drive_link (750MB)&lt;br /&gt;
|-&lt;br /&gt;
| Alignment of tilt series || https://drive.google.com/drive/folders/1VPYk91xJ6cLCSy6Mg4UX_dDLHHIhhbp9?usp=drive_link (600MB)&lt;br /&gt;
|-&lt;br /&gt;
| Virus like particles || https://drive.google.com/drive/folders/1Vr108rtKI7knFOmzL06-nfFm1KCKdq4e?usp=drive_link (4.6GB)&lt;br /&gt;
|-&lt;br /&gt;
| Spherical geometries || https://drive.google.com/drive/folders/1arrd1KcscsvCDEasmNISShujWjWCYjlw?usp=drive_link (64 MB)&lt;br /&gt;
|-&lt;br /&gt;
| Principal Component Analysis || Data generated locally by Dynamo&lt;br /&gt;
|-&lt;br /&gt;
| Complete walkthrough on FHV virus || https://drive.google.com/drive/folders/10j1mGTV-4srVV2Hg98eWkAPhPeAbU5BQ?usp=drive_link (2GB)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Access to computational resources==&lt;br /&gt;
On the third day, a more advanced tutorial will be completed. For this we will to access a server which will host the data. Access details will be updated here.&lt;br /&gt;
&lt;br /&gt;
= Time Schedule =&lt;br /&gt;
&lt;br /&gt;
* On the first two days, we will present the basic tools in the Dynamo environment.    &lt;br /&gt;
* The third day will be devoted to a hands-on guide on two practical cases:&lt;br /&gt;
** [https://doi.org/10.3389/fmolb.2018.00082&#039;&#039;Protocols for Subtomogram Averaging of Membrane Proteins in the Dynamo Software Package&#039;&#039;] Navarro PP, Stahlberg H and Castaño-Díez D (2018). Front. Mol. Biosci. 5:82.&lt;br /&gt;
** [https://journals.plos.org/plosbiology/article?id=10.1371/journal.pbio.3001318&#039;&#039;Step-by-step guide to efficient subtomogram averaging of virus-like particles with Dynamo&#039;&#039;] Scaramuzza S, Castaño-Díez D (2021). PLoS biology. 19(8):e3001318.&lt;br /&gt;
&lt;br /&gt;
* On the third day participants are encouraged to make a flash presentation (3 mins, max. slides) describing their past or planned research in tomography. We will study the particular cases of interest of each participant, and identify tools of possible relevance inside the &#039;&#039;Dynamo&#039;&#039; environment, designing with the participants viable processing workflows combining &#039;&#039;Dynamo&#039;&#039; and other packages. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 1 (Morning) General tools&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 09:30 - 10:00|| Research Talk&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 10:00 - 10:45|| General introduction: Hands-on guide to basic tools. &amp;lt;br/&amp;gt; &lt;br /&gt;
[https://wiki.dynamo.biozentrum.unibas.ch/w/doc/misc/conceptsSheet.pdf Basic Dynamo jargon] &amp;lt;br/&amp;gt;&lt;br /&gt;
[https://wiki.dynamo.biozentrum.unibas.ch/w/doc/misc/introductionTablesAndData.pdf Basic formats for data and metadata] &lt;br /&gt;
|-&lt;br /&gt;
| 2 || 11:00 - 12:30 || [[Starters guide | Starters Guide: subtomogram averaging]]&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| 3 || 13:30 - 14:00 || General modeling&lt;br /&gt;
|-&lt;br /&gt;
| 3a ||14:00 - 14:45  || [[Walkthrough_on_filament_models | Models: Filaments]] &amp;lt;br/&amp;gt;  Additional material: [[Walkthrough model worfklow reuse | Coordinated extraction from several filaments]]&lt;br /&gt;
|-&lt;br /&gt;
| 3b || 14:45 - 15:30 || [[Walkthrough_on_vesicle_models | Models: Vesicles ]] &lt;br /&gt;
|-&lt;br /&gt;
| 3c || 15:30 - 16:30 || [[Walkthrough_on_membrane_models | Models: Surfaces ]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 2  General Tools&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 09:30 - 10:15 || [[Walkthrough for template matching (PSI 2023) | Template Matching]]&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 10:15 - 11:30 || [[Walkthrough on PCA through the command line PSI 2023 | Principal Component Analysis ]]&lt;br /&gt;
|-&lt;br /&gt;
| 6a || 11:30 - 12:00 || [[Walkthrough on manual marker clicking | Alignment of tilt series: Manual]] &lt;br /&gt;
|-&lt;br /&gt;
| 6b || 12:00 - 12:30 || [[Walkthrough_on_GUI_based_tilt_series_alignment | Alignment of tilt series: GUI ]]&lt;br /&gt;
|-&lt;br /&gt;
| 6c || 12:30 - 12:45 || [[Walkthrough_on_command_line_based_tilt_series_alignment | Alignment of tilt series: command line]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 2 (Afternoon):  Practical cases&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
| FHV ||  13:30- 17:00 || FHV&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|+ Day 3 (Whole day):  Practical case: High resolution workflow.&lt;br /&gt;
|-&lt;br /&gt;
! Module !! Time !! Subject&lt;br /&gt;
| HIV1 || 09:30 - 17:00 || High Resolution workflow for HIV1: preprocessing &amp;lt;br/&amp;gt;&lt;br /&gt;
[[ High resolution walkthrough with HIV1 | High Resolution workflow for HIV1: Dynamo manipulations ]] &amp;lt;/br&amp;gt;&lt;br /&gt;
High Resolution workflow for HIV1: binding with Relion&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Additional material: &amp;lt;br/&amp;gt;&lt;br /&gt;
* [[Walkthrough for lattices on vesicles | Coordinated extraction from several vesicles]]&lt;br /&gt;
* [[Walkthrough on creation of 3d scenes]]&lt;br /&gt;
* [[Walkthrough on placement of averages on table positions]]&lt;br /&gt;
&lt;br /&gt;
= Instructors =&lt;br /&gt;
* Daniel Castano-Diez (CSIC Bilbao, Spain).&lt;br /&gt;
* Raffaele Coray (CSIC Bilbao, Spain).&lt;br /&gt;
* Alma Vivas-Lago (CSIC Bilbao, Spain).&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=Walkthrough_on_hexagonal_lattice_coherence_through_neighborhood_analysis&amp;diff=5085</id>
		<title>Walkthrough on hexagonal lattice coherence through neighborhood analysis</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=Walkthrough_on_hexagonal_lattice_coherence_through_neighborhood_analysis&amp;diff=5085"/>
		<updated>2024-04-08T09:06:27Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Walkthroughs]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Neighborhood analysis==&lt;br /&gt;
&lt;br /&gt;
Neighbourhood analysis stands at the forefront of methods used to investigate geometrical lattice parameters and offers a wide spectrum of visualization tools. This technique is precise, targeting specific elements, yet broad enough to facilitate overarching interpretive analysis. At its core, the method constructs a latent space of connections by mapping the relative positions of neighbouring particles onto a reference framework. This mapping involves a reorientation process, wherein the &#039;N&#039; closest neighbours are repositioned within the reference particle&#039;s coordinate system, adjusted for its orientation. The richness of the latent space—characterized by the number and nature of these repositioned features—is dictated by a defined distance threshold. This threshold ranges from a minimal couple, representing the closest inter-particle distance, to the maximal extent, linking every particle within the neighbourhood to the reference point.&lt;br /&gt;
&lt;br /&gt;
For additional insights into neighborhood analysis, visit [https://www.dynamo-em.org//w/index.php?title=Neighborhood_analysis this page.]  &lt;br /&gt;
&lt;br /&gt;
==Data==&lt;br /&gt;
&lt;br /&gt;
We will use data from the initial gold standard alignment derived from five tomograms of immature HIV-1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
===Downloading===&lt;br /&gt;
&lt;br /&gt;
The data can be downloaded from [https://drive.google.com/drive/folders/1jberboXIRNp32GvZ14XV_6N2R-tnYESD this google drive.]  &lt;br /&gt;
&lt;br /&gt;
===Inspecting data===&lt;br /&gt;
&lt;br /&gt;
First, open a new local terminal and navigate to the directory containing the tutorial dataset and project.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s inspect the contents:&lt;br /&gt;
&lt;br /&gt;
 &amp;gt;&amp;gt; dfile template.em&lt;br /&gt;
    &lt;br /&gt;
    filetype: volume&lt;br /&gt;
    &lt;br /&gt;
    size: 192 x 192 x 192 &lt;br /&gt;
&lt;br /&gt;
 &amp;gt;&amp;gt; dfile table.tbl&lt;br /&gt;
  &lt;br /&gt;
    filetype: table&lt;br /&gt;
    &lt;br /&gt;
    size: 7068  x 35, aligns: 7068, averages: 7068 &lt;br /&gt;
&lt;br /&gt;
These files represent an average as a template and its associated metadata (i.e., table). We will focus on the table data.&lt;br /&gt;
&lt;br /&gt;
To visualize the particles along with their normals:&lt;br /&gt;
&lt;br /&gt;
 tbl = dread(&#039;table.tbl&#039;);&lt;br /&gt;
 figure;&lt;br /&gt;
 h = dpktbl.plots.sketch(tbl,&#039;haxis&#039;,gca());&lt;br /&gt;
 h.zlength.value=100;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:tbl-positions-normals-vlps.png|centre|thumb|450px| VLPs particle positions and normals.]]&lt;br /&gt;
&lt;br /&gt;
== Prepare (meta)data ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s select a couple of Virus-Like Particles (VLPs):&lt;br /&gt;
&lt;br /&gt;
 tblT2V2 = tbl(tbl(:,20) == 2 &amp;amp; tbl(:,22) == 2, :);&lt;br /&gt;
 tblT2V5 = tbl(tbl(:,20) == 2 &amp;amp; tbl(:,22) == 5, :);&lt;br /&gt;
 tblT2V3 = tbl(tbl(:,20) == 2 &amp;amp; tbl(:,22) == 3, :);&lt;br /&gt;
&lt;br /&gt;
To visualize:&lt;br /&gt;
&lt;br /&gt;
 figure;&lt;br /&gt;
 &lt;br /&gt;
 subplot(1, 3, 1);&lt;br /&gt;
 dpktbl.plots.sketch(tblT2V5);&lt;br /&gt;
 title(&#039;Ideal&#039;);&lt;br /&gt;
 pbaspect([1 1 1]);&lt;br /&gt;
 &lt;br /&gt;
 subplot(1, 3, 2);&lt;br /&gt;
 dpktbl.plots.sketch(tblT2V2); &lt;br /&gt;
 title(&#039;Slightly flat surface&#039;);&lt;br /&gt;
 pbaspect([1 1 1]); &lt;br /&gt;
 &lt;br /&gt;
 subplot(1, 3, 3);&lt;br /&gt;
 dpktbl.plots.sketch(tblT2V3); &lt;br /&gt;
 title(&#039;1/4 missing, flat top&#039;);&lt;br /&gt;
 pbaspect([1 1 1]); &lt;br /&gt;
&lt;br /&gt;
[[File:selected-vlps.png|centre|thumb|800px|  Selected VLPs. From left to right: ideal, medium, and low quality instances.]]&lt;br /&gt;
&lt;br /&gt;
Indeed, we will analyze three different VLP quality instances.&lt;br /&gt;
&lt;br /&gt;
== Get mean distance to closest neighbor ==&lt;br /&gt;
&lt;br /&gt;
To find the optimal distance threshold, we will use the following function to calculate the mean distance to the closest neighbor:&lt;br /&gt;
&lt;br /&gt;
 function [meanDst, stdDsts] = mean_distance_to_closest_neighbor(pts);&lt;br /&gt;
 numPts = size(pts, 1);&lt;br /&gt;
 minDsts = zeros(numPts, 1);&lt;br /&gt;
 &lt;br /&gt;
 for i = 1:numPts&lt;br /&gt;
    dsts = pdist2(pts(i,:), pts);&lt;br /&gt;
    dsts(i) = Inf;&lt;br /&gt;
    minDsts(i) = min(dsts);&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 meanDst = mean(minDsts);&lt;br /&gt;
 stdDsts = std(minDsts);&lt;br /&gt;
 fprintf(&#039;Mean distance: %.4f\nStandard deviation: %.4f \n&#039;, meanDst, stdDsts);&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Invoke the function like so: &lt;br /&gt;
&lt;br /&gt;
 [meanDst, stdDsts] =   mean_distance_to_closest_neighbor(tbl(:,24:26)+tbl(:,4:6));&lt;br /&gt;
&lt;br /&gt;
The mean distance to the closest neighbor is around 50-60 pixels.&lt;br /&gt;
 Mean distance: 50.42&lt;br /&gt;
 Standard deviation: 12.23&lt;br /&gt;
&lt;br /&gt;
For a sanity check, you might also measure the lattice directly on the average volume:&lt;br /&gt;
&lt;br /&gt;
 dshow template.em&lt;br /&gt;
&lt;br /&gt;
[[File:average-overplot-hexagonal-lattice-measurements.png|centre|thumb|400px|  Overplot average and hexagonal lattice measurements.]]&lt;br /&gt;
&lt;br /&gt;
== Neighborhood analysis computation ==&lt;br /&gt;
&lt;br /&gt;
Here, we conduct the neighborhood analysis with a distance threshold set as the mean distance plus the standard deviation:&lt;br /&gt;
&lt;br /&gt;
 tblT2V3N = dpktbl.neighborhood.analize(tblT2V3,&#039;distance&#039;,meanDst+stdDsts,&#039;modelColumn&#039;,22);&lt;br /&gt;
 tblT2V2N = dpktbl.neighborhood.analize(tblT2V2,&#039;distance&#039;,meanDst+stdDsts,&#039;modelColumn&#039;,22);&lt;br /&gt;
 tblT2V5N = dpktbl.neighborhood.analize(tblT2V5,&#039;distance&#039;,meanDst+stdDsts,&#039;modelColumn&#039;,22);&lt;br /&gt;
&lt;br /&gt;
Then, we will need the couple table since it is our new represetation (i.e., latent space):&lt;br /&gt;
&lt;br /&gt;
 tblT2V3NC = real(tblT2V3N.coupleTable);&lt;br /&gt;
 tblT2V2NC = real(tblT2V2N.coupleTable);&lt;br /&gt;
 tblT2V5NC = real(tblT2V5N.coupleTable);&lt;br /&gt;
&lt;br /&gt;
Now, let&#039;s visualize first-order distance clusters with synchronized viewing:&lt;br /&gt;
&lt;br /&gt;
 datasets = {tblT2V3NC, tblT2V2NC, tblT2V5NC};&lt;br /&gt;
 titles = {&amp;quot;Incomplete + flat surface&amp;quot;, &amp;quot;Slightly flat surface&amp;quot;, &amp;quot;Ideal&amp;quot;};&lt;br /&gt;
 &lt;br /&gt;
 fig = figure;&lt;br /&gt;
 ax = gobjects(1, length(datasets));&lt;br /&gt;
 &lt;br /&gt;
 for i = 1:length(datasets)&lt;br /&gt;
    ax(i) = subplot(1, length(datasets), i, &#039;Parent&#039;, fig);&lt;br /&gt;
    pcshow(datasets{i}(:, 24:26), &#039;Parent&#039;, ax(i));&lt;br /&gt;
    pbaspect(ax(i), [1 1 1]);&lt;br /&gt;
    % Set titles using text, since the title function was not working&lt;br /&gt;
    xl = xlim(ax(i));&lt;br /&gt;
    yl = ylim(ax(i));&lt;br /&gt;
    zl = zlim(ax(i));&lt;br /&gt;
    titlePos = [mean(xl), yl(2), zl(2)];&lt;br /&gt;
    text(ax(i), titlePos(1), titlePos(2), titlePos(3), titles{i}, ...&lt;br /&gt;
        &#039;HorizontalAlignment&#039;, &#039;center&#039;, &#039;Color&#039;, &#039;white&#039;, ...&lt;br /&gt;
        &#039;FontSize&#039;, 14, &#039;FontWeight&#039;, &#039;bold&#039;, &#039;BackgroundColor&#039;, &#039;black&#039;);&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 link = linkprop(ax, {&#039;CameraUpVector&#039;, &#039;CameraPosition&#039;, &#039;CameraTarget&#039;, &#039;CameraViewAngle&#039;, &#039;XLim&#039;, &#039;YLim&#039;, &#039;ZLim&#039;});&lt;br /&gt;
 setappdata(gcf, &#039;StoreTheLink&#039;, link);&lt;br /&gt;
 &lt;br /&gt;
 for a = ax&lt;br /&gt;
    rotate3d(a, &#039;on&#039;);&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
[[File:first-order-distance-clusters-three-different-vlps.png|centre|thumb|800px|   First-order distance clusters obtained vía neighborhood analysis. From left to right: low, medium, and high quality instances.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The color, by default, represents the Z-axis. Notice that the better the quality of the VLP, the less sparse each cluster is.&lt;br /&gt;
&lt;br /&gt;
== Local analysis - lattice coherence ==&lt;br /&gt;
&lt;br /&gt;
To quantify lattice coherence, we apply k-means clustering and calculate the Euclidean norms for each centroid. The standard deviation of these norms provides a measure of cluster sparsity and hence, lattice coherence.&lt;br /&gt;
&lt;br /&gt;
We encapsulate this process in a function:&lt;br /&gt;
&lt;br /&gt;
 function [idx, cc_final, results, results_std] = perform_lattice_analysis(data, symm)&lt;br /&gt;
    [idx, cc_final] = kmeans(data, symm);&lt;br /&gt;
    results = vecnorm(cc_final, 2, 2); &lt;br /&gt;
    results_std = std(results); &lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Then, execute the analysis:&lt;br /&gt;
&lt;br /&gt;
 symm = 6; &lt;br /&gt;
 [idx_ideal, cc_ideal_final, results_ideal, std_ideal] = perform_lattice_analysis(tblT2V5NC(:,24:26),symm);&lt;br /&gt;
 [idx_slightly_flat, cc_sf_final, results_sf, std_sf] = perform_lattice_analysis(tblT2V2NC(:,24:26),symm);&lt;br /&gt;
 [idx_incomplete_and_flat, cc_implt_final, results_implt, std_implt] = perform_lattice_analysis(tblT2V3NC(:,24:26),symm);&lt;br /&gt;
&lt;br /&gt;
Display results neatly in a table&lt;br /&gt;
&lt;br /&gt;
 resultsTable = table(std_ideal, std_sf, std_implt, &#039;VariableNames&#039;, {&#039;Ideal&#039;, &#039;SlightlyFlat&#039;, &#039;IncompleteFlat&#039;}, &#039;RowNames&#039;, {&#039;StandardDeviation&#039;});&lt;br /&gt;
 &lt;br /&gt;
 disp(resultsTable);&lt;br /&gt;
&lt;br /&gt;
This will output:&lt;br /&gt;
        &lt;br /&gt;
                               Ideal             SlightlyFlat        IncompleteFlat                       &lt;br /&gt;
                         __________________    _________________    _________________&lt;br /&gt;
                           &lt;br /&gt;
    Standard deviation    0.0933777687916592    0.321031652546273    0.574732108201886&lt;br /&gt;
&lt;br /&gt;
As demonstrated, the qualitative degree of imperfection correlates with our lattice coherence measurements.&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=Walkthrough_on_hexagonal_lattice_coherence_through_neighborhood_analysis&amp;diff=5084</id>
		<title>Walkthrough on hexagonal lattice coherence through neighborhood analysis</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=Walkthrough_on_hexagonal_lattice_coherence_through_neighborhood_analysis&amp;diff=5084"/>
		<updated>2024-04-08T09:00:34Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Walkthroughs]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Neighborhood analysis==&lt;br /&gt;
&lt;br /&gt;
Neighbourhood analysis stands at the forefront of methods used to investigate geometrical lattice parameters and offers a wide spectrum of visualization tools. This technique is precise, targeting specific elements, yet broad enough to facilitate overarching interpretive analysis. At its core, the method constructs a latent space of connections by mapping the relative positions of neighbouring particles onto a reference framework. This mapping involves a reorientation process, wherein the &#039;N&#039; closest neighbours are repositioned within the reference particle&#039;s coordinate system, adjusted for its orientation. The richness of the latent space—characterized by the number and nature of these repositioned features—is dictated by a defined distance threshold. This threshold ranges from a minimal couple, representing the closest inter-particle distance, to the maximal extent, linking every particle within the neighbourhood to the reference point.&lt;br /&gt;
&lt;br /&gt;
For additional insights into neighborhood analysis, visit [https://www.dynamo-em.org//w/index.php?title=Neighborhood_analysis this page.]  &lt;br /&gt;
&lt;br /&gt;
==Data==&lt;br /&gt;
&lt;br /&gt;
We will use data from the initial gold standard alignment derived from five tomograms of immature HIV-1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
===Downloading===&lt;br /&gt;
&lt;br /&gt;
The data can be downloaded from [https://drive.google.com/drive/folders/1jberboXIRNp32GvZ14XV_6N2R-tnYESD this google drive.]  &lt;br /&gt;
&lt;br /&gt;
===Inspecting data===&lt;br /&gt;
&lt;br /&gt;
First, open a new local terminal and navigate to the directory containing the tutorial dataset and project.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s inspect the contents:&lt;br /&gt;
&lt;br /&gt;
 &amp;gt;&amp;gt; dfile template.em&lt;br /&gt;
    &lt;br /&gt;
    filetype: volume&lt;br /&gt;
    &lt;br /&gt;
    size: 192 x 192 x 192 &lt;br /&gt;
&lt;br /&gt;
 &amp;gt;&amp;gt; dfile table.tbl&lt;br /&gt;
  &lt;br /&gt;
    filetype: table&lt;br /&gt;
    &lt;br /&gt;
    size: 7068  x 35, aligns: 7068, averages: 7068 &lt;br /&gt;
&lt;br /&gt;
These files represent an average as a template and its associated metadata (i.e., table). We will focus on the table data.&lt;br /&gt;
&lt;br /&gt;
To visualize the particles along with their normals:&lt;br /&gt;
&lt;br /&gt;
 tbl = dread(&#039;table.tbl&#039;);&lt;br /&gt;
 figure;&lt;br /&gt;
 h = dpktbl.plots.sketch(tbl,&#039;haxis&#039;,gca());&lt;br /&gt;
 h.zlength.value=100;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:tbl-positions-normals-vlps.png|centre|thumb|450px| VLPs particle positions and normals.]]&lt;br /&gt;
&lt;br /&gt;
== Prepare (meta)data ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s select a couple of Virus-Like Particles (VLPs):&lt;br /&gt;
&lt;br /&gt;
 tblT2V2 = tbl(tbl(:,20) == 2 &amp;amp; tbl(:,22) == 2, :);&lt;br /&gt;
 tblT2V5 = tbl(tbl(:,20) == 2 &amp;amp; tbl(:,22) == 5, :);&lt;br /&gt;
 tblT2V3 = tbl(tbl(:,20) == 2 &amp;amp; tbl(:,22) == 3, :);&lt;br /&gt;
&lt;br /&gt;
To visualize:&lt;br /&gt;
&lt;br /&gt;
 figure;&lt;br /&gt;
 &lt;br /&gt;
 subplot(1, 3, 1);&lt;br /&gt;
 dpktbl.plots.sketch(tblT2V5);&lt;br /&gt;
 title(&#039;Ideal&#039;);&lt;br /&gt;
 pbaspect([1 1 1]);&lt;br /&gt;
 &lt;br /&gt;
 subplot(1, 3, 2);&lt;br /&gt;
 dpktbl.plots.sketch(tblT2V2); &lt;br /&gt;
 title(&#039;Slightly flat surface&#039;);&lt;br /&gt;
 pbaspect([1 1 1]); &lt;br /&gt;
 &lt;br /&gt;
 subplot(1, 3, 3);&lt;br /&gt;
 dpktbl.plots.sketch(tblT2V3); &lt;br /&gt;
 title(&#039;1/4 missing, flat top&#039;);&lt;br /&gt;
 pbaspect([1 1 1]); &lt;br /&gt;
&lt;br /&gt;
[[File:selected-vlps.png|centre|thumb|800px|  Selected VLPs. From left to right: ideal, medium, and low quality instances.]]&lt;br /&gt;
&lt;br /&gt;
Indeed, we will analyze three different VLP quality instances.&lt;br /&gt;
&lt;br /&gt;
== Get Mean Distance to Closest Neighbor ==&lt;br /&gt;
&lt;br /&gt;
To find the optimal distance threshold, we will use the following function to calculate the mean distance to the closest neighbor:&lt;br /&gt;
&lt;br /&gt;
 function [meanDst, stdDsts] = mean_distance_to_closest_neighbor(pts);&lt;br /&gt;
 numPts = size(pts, 1);&lt;br /&gt;
 minDsts = zeros(numPts, 1);&lt;br /&gt;
 &lt;br /&gt;
 for i = 1:numPts&lt;br /&gt;
    dsts = pdist2(pts(i,:), pts);&lt;br /&gt;
    dsts(i) = Inf;&lt;br /&gt;
    minDsts(i) = min(dsts);&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 meanDst = mean(minDsts);&lt;br /&gt;
 stdDsts = std(minDsts);&lt;br /&gt;
 fprintf(&#039;Mean distance: %.4f\nStandard deviation: %.4f \n&#039;, meanDst, stdDsts);&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Invoke the function like so: &lt;br /&gt;
&lt;br /&gt;
 [meanDst, stdDsts] =   mean_distance_to_closest_neighbor(tbl(:,24:26)+tbl(:,4:6));&lt;br /&gt;
&lt;br /&gt;
The mean distance to the closest neighbor is around 50-60 pixels.&lt;br /&gt;
 Mean distance: 50.42&lt;br /&gt;
 Standard deviation: 12.23&lt;br /&gt;
&lt;br /&gt;
For a sanity check, you might also measure the lattice directly on the average volume:&lt;br /&gt;
&lt;br /&gt;
 dshow template.em&lt;br /&gt;
&lt;br /&gt;
[[File:average-overplot-hexagonal-lattice-measurements.png|centre|thumb|400px|  Overplot average and hexagonal lattice measurements.]]&lt;br /&gt;
&lt;br /&gt;
== Neighborhood Analysis Computation ==&lt;br /&gt;
&lt;br /&gt;
Here, we conduct the neighborhood analysis with a distance threshold set as the mean distance plus the standard deviation:&lt;br /&gt;
&lt;br /&gt;
 tblT2V3N = dpktbl.neighborhood.analize(tblT2V3,&#039;distance&#039;,meanDst+stdDsts,&#039;modelColumn&#039;,22);&lt;br /&gt;
 tblT2V2N = dpktbl.neighborhood.analize(tblT2V2,&#039;distance&#039;,meanDst+stdDsts,&#039;modelColumn&#039;,22);&lt;br /&gt;
 tblT2V5N = dpktbl.neighborhood.analize(tblT2V5,&#039;distance&#039;,meanDst+stdDsts,&#039;modelColumn&#039;,22);&lt;br /&gt;
&lt;br /&gt;
Then, we will need the couple table since it is our new represetation (i.e., latent space):&lt;br /&gt;
&lt;br /&gt;
 tblT2V3NC = real(tblT2V3N.coupleTable);&lt;br /&gt;
 tblT2V2NC = real(tblT2V2N.coupleTable);&lt;br /&gt;
 tblT2V5NC = real(tblT2V5N.coupleTable);&lt;br /&gt;
&lt;br /&gt;
Now, let&#039;s visualize first-order distance clusters with synchronized viewing:&lt;br /&gt;
&lt;br /&gt;
 datasets = {tblT2V3NC, tblT2V2NC, tblT2V5NC};&lt;br /&gt;
 titles = {&amp;quot;Incomplete + flat surface&amp;quot;, &amp;quot;Slightly flat surface&amp;quot;, &amp;quot;Ideal&amp;quot;};&lt;br /&gt;
 &lt;br /&gt;
 fig = figure;&lt;br /&gt;
 ax = gobjects(1, length(datasets));&lt;br /&gt;
 &lt;br /&gt;
 for i = 1:length(datasets)&lt;br /&gt;
    ax(i) = subplot(1, length(datasets), i, &#039;Parent&#039;, fig);&lt;br /&gt;
    pcshow(datasets{i}(:, 24:26), &#039;Parent&#039;, ax(i));&lt;br /&gt;
    pbaspect(ax(i), [1 1 1]);&lt;br /&gt;
    % Set titles using text, since the title function was not working&lt;br /&gt;
    xl = xlim(ax(i));&lt;br /&gt;
    yl = ylim(ax(i));&lt;br /&gt;
    zl = zlim(ax(i));&lt;br /&gt;
    titlePos = [mean(xl), yl(2), zl(2)];&lt;br /&gt;
    text(ax(i), titlePos(1), titlePos(2), titlePos(3), titles{i}, ...&lt;br /&gt;
        &#039;HorizontalAlignment&#039;, &#039;center&#039;, &#039;Color&#039;, &#039;white&#039;, ...&lt;br /&gt;
        &#039;FontSize&#039;, 14, &#039;FontWeight&#039;, &#039;bold&#039;, &#039;BackgroundColor&#039;, &#039;black&#039;);&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 link = linkprop(ax, {&#039;CameraUpVector&#039;, &#039;CameraPosition&#039;, &#039;CameraTarget&#039;, &#039;CameraViewAngle&#039;, &#039;XLim&#039;, &#039;YLim&#039;, &#039;ZLim&#039;});&lt;br /&gt;
 setappdata(gcf, &#039;StoreTheLink&#039;, link);&lt;br /&gt;
 &lt;br /&gt;
 for a = ax&lt;br /&gt;
    rotate3d(a, &#039;on&#039;);&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
[[File:first-order-distance-clusters-three-different-vlps.png|centre|thumb|800px|   First-order distance clusters obtained vía neighborhood analysis. From left to right: low, medium, and high quality instances.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The color, by default, represents the Z-axis. Notice that the better the quality of the VLP, the less sparse each cluster is.&lt;br /&gt;
&lt;br /&gt;
== Local Analysis - Lattice Coherence ==&lt;br /&gt;
&lt;br /&gt;
To quantify lattice coherence, we apply k-means clustering and calculate the Euclidean norms for each centroid. The standard deviation of these norms provides a measure of cluster sparsity and hence, lattice coherence.&lt;br /&gt;
&lt;br /&gt;
We encapsulate this process in a function:&lt;br /&gt;
&lt;br /&gt;
 function [idx, cc_final, results, results_std] = perform_lattice_analysis(data, symm)&lt;br /&gt;
    [idx, cc_final] = kmeans(data, symm);&lt;br /&gt;
    results = vecnorm(cc_final, 2, 2); &lt;br /&gt;
    results_std = std(results); &lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Then, execute the analysis:&lt;br /&gt;
&lt;br /&gt;
 symm = 6; &lt;br /&gt;
 [idx_ideal, cc_ideal_final, results_ideal, std_ideal] = perform_lattice_analysis(tblT2V5NC(:,24:26),symm);&lt;br /&gt;
 [idx_slightly_flat, cc_sf_final, results_sf, std_sf] = perform_lattice_analysis(tblT2V2NC(:,24:26),symm);&lt;br /&gt;
 [idx_incomplete_and_flat, cc_implt_final, results_implt, std_implt] = perform_lattice_analysis(tblT2V3NC(:,24:26),symm);&lt;br /&gt;
&lt;br /&gt;
Display results neatly in a table&lt;br /&gt;
&lt;br /&gt;
 resultsTable = table(std_ideal, std_sf, std_implt, &#039;VariableNames&#039;, {&#039;Ideal&#039;, &#039;SlightlyFlat&#039;, &#039;IncompleteFlat&#039;}, &#039;RowNames&#039;, {&#039;StandardDeviation&#039;});&lt;br /&gt;
 &lt;br /&gt;
 disp(resultsTable);&lt;br /&gt;
&lt;br /&gt;
This will output:&lt;br /&gt;
        &lt;br /&gt;
                               Ideal             SlightlyFlat        IncompleteFlat                       &lt;br /&gt;
                         __________________    _________________    _________________&lt;br /&gt;
                           &lt;br /&gt;
    Standard deviation    0.0933777687916592    0.321031652546273    0.574732108201886&lt;br /&gt;
&lt;br /&gt;
As demonstrated, the qualitative degree of imperfection correlates with our lattice coherence measurements.&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=File:First-order-distance-clusters-three-different-vlps.png&amp;diff=5083</id>
		<title>File:First-order-distance-clusters-three-different-vlps.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=File:First-order-distance-clusters-three-different-vlps.png&amp;diff=5083"/>
		<updated>2024-04-08T08:58:00Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=File:Average-overplot-hexagonal-lattice-measurements.png&amp;diff=5082</id>
		<title>File:Average-overplot-hexagonal-lattice-measurements.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=File:Average-overplot-hexagonal-lattice-measurements.png&amp;diff=5082"/>
		<updated>2024-04-08T08:57:46Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=File:Selected-vlps.png&amp;diff=5081</id>
		<title>File:Selected-vlps.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=File:Selected-vlps.png&amp;diff=5081"/>
		<updated>2024-04-08T08:57:34Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=File:Tbl-positions-normals-vlps.png&amp;diff=5080</id>
		<title>File:Tbl-positions-normals-vlps.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=File:Tbl-positions-normals-vlps.png&amp;diff=5080"/>
		<updated>2024-04-08T08:57:16Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=Walkthrough_on_hexagonal_lattice_coherence_through_neighborhood_analysis&amp;diff=5079</id>
		<title>Walkthrough on hexagonal lattice coherence through neighborhood analysis</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=Walkthrough_on_hexagonal_lattice_coherence_through_neighborhood_analysis&amp;diff=5079"/>
		<updated>2024-04-08T08:55:54Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: Created page with &amp;quot;Category:Walkthroughs   ==Neighborhood analysis==  Neighbourhood analysis stands at the forefront of methods used to investigate geometrical lattice parameters and offers...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Walkthroughs]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Neighborhood analysis==&lt;br /&gt;
&lt;br /&gt;
Neighbourhood analysis stands at the forefront of methods used to investigate geometrical lattice parameters and offers a wide spectrum of visualization tools. This technique is precise, targeting specific elements, yet broad enough to facilitate overarching interpretive analysis. At its core, the method constructs a latent space of connections by mapping the relative positions of neighbouring particles onto a reference framework. This mapping involves a reorientation process, wherein the &#039;N&#039; closest neighbours are repositioned within the reference particle&#039;s coordinate system, adjusted for its orientation. The richness of the latent space—characterized by the number and nature of these repositioned features—is dictated by a defined distance threshold. This threshold ranges from a minimal couple, representing the closest inter-particle distance, to the maximal extent, linking every particle within the neighbourhood to the reference point.&lt;br /&gt;
&lt;br /&gt;
For additional insights into neighborhood analysis, visit [https://www.dynamo-em.org//w/index.php?title=Neighborhood_analysis this page.]  &lt;br /&gt;
&lt;br /&gt;
==Data==&lt;br /&gt;
&lt;br /&gt;
We will use data from the initial gold standard alignment derived from five tomograms of immature HIV-1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
===Downloading===&lt;br /&gt;
&lt;br /&gt;
The data can be downloaded from [https://drive.google.com/drive/folders/1jberboXIRNp32GvZ14XV_6N2R-tnYESD this google drive.]  &lt;br /&gt;
&lt;br /&gt;
===Inspecting data===&lt;br /&gt;
&lt;br /&gt;
First, open a new local terminal and navigate to the directory containing the tutorial dataset and project.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s inspect the contents:&lt;br /&gt;
&lt;br /&gt;
 &amp;gt;&amp;gt; dfile template.em&lt;br /&gt;
    &lt;br /&gt;
    filetype: volume&lt;br /&gt;
    &lt;br /&gt;
    size: 192 x 192 x 192 &lt;br /&gt;
&lt;br /&gt;
 &amp;gt;&amp;gt; dfile table.tbl&lt;br /&gt;
  &lt;br /&gt;
    filetype: table&lt;br /&gt;
    &lt;br /&gt;
    size: 7068  x 35, aligns: 7068, averages: 7068 &lt;br /&gt;
&lt;br /&gt;
These files represent an average as a template and its associated metadata (i.e., table). We will focus on the table data.&lt;br /&gt;
&lt;br /&gt;
To visualize the particles along with their normals:&lt;br /&gt;
&lt;br /&gt;
 tbl = dread(&#039;table.tbl&#039;);&lt;br /&gt;
 figure;&lt;br /&gt;
 h = dpktbl.plots.sketch(tbl,&#039;haxis&#039;,gca());&lt;br /&gt;
 h.zlength.value=100;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:tbl-positions-normals-vlps.png|centre|thumb|450px| VLPs particle positions and normals.]]&lt;br /&gt;
&lt;br /&gt;
== Prepare (meta)data ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s select a couple of Virus-Like Particles (VLPs):&lt;br /&gt;
&lt;br /&gt;
 tblT2V2 = tbl(tbl(:,20) == 2 &amp;amp; tbl(:,22) == 2, :);&lt;br /&gt;
 tblT2V5 = tbl(tbl(:,20) == 2 &amp;amp; tbl(:,22) == 5, :);&lt;br /&gt;
 tblT2V3 = tbl(tbl(:,20) == 2 &amp;amp; tbl(:,22) == 3, :);&lt;br /&gt;
&lt;br /&gt;
To visualize:&lt;br /&gt;
&lt;br /&gt;
 figure;&lt;br /&gt;
 &lt;br /&gt;
 subplot(1, 3, 1);&lt;br /&gt;
 dpktbl.plots.sketch(tblT2V5);&lt;br /&gt;
 title(&#039;Ideal&#039;);&lt;br /&gt;
 pbaspect([1 1 1]);&lt;br /&gt;
 &lt;br /&gt;
 subplot(1, 3, 2);&lt;br /&gt;
 dpktbl.plots.sketch(tblT2V2); &lt;br /&gt;
 title(&#039;Slightly flat surface&#039;);&lt;br /&gt;
 pbaspect([1 1 1]); &lt;br /&gt;
 &lt;br /&gt;
 subplot(1, 3, 3);&lt;br /&gt;
 dpktbl.plots.sketch(tblT2V3); &lt;br /&gt;
 title(&#039;1/4 missing, flat top&#039;);&lt;br /&gt;
 pbaspect([1 1 1]); &lt;br /&gt;
&lt;br /&gt;
[[File:selected-vlps.png|centre|thumb|800px|  Selected VLPs. From left to right: ideal, medium, and low quality instances.]]&lt;br /&gt;
&lt;br /&gt;
Indeed, we will analyze three different VLP quality instances.&lt;br /&gt;
&lt;br /&gt;
== Get Mean Distance to Closest Neighbor ==&lt;br /&gt;
&lt;br /&gt;
To find the optimal distance threshold, we will use the following function to calculate the mean distance to the closest neighbor:&lt;br /&gt;
&lt;br /&gt;
 function [meanDst, stdDsts] = mean_distance_to_closest_neighbor(pts);&lt;br /&gt;
 numPts = size(pts, 1);&lt;br /&gt;
 minDsts = zeros(numPts, 1);&lt;br /&gt;
 &lt;br /&gt;
 for i = 1:numPts&lt;br /&gt;
    dsts = pdist2(pts(i,:), pts);&lt;br /&gt;
    dsts(i) = Inf;&lt;br /&gt;
    minDsts(i) = min(dsts);&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 meanDst = mean(minDsts);&lt;br /&gt;
 stdDsts = std(minDsts);&lt;br /&gt;
 fprintf(&#039;Mean distance: %.4f\nStandard deviation: %.4f \n&#039;, meanDst, stdDsts);&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Invoke the function like so: &lt;br /&gt;
&lt;br /&gt;
 [meanDst, stdDsts] =   mean_distance_to_closest_neighbor(tbl(:,24:26)+tbl(:,4:6));&lt;br /&gt;
&lt;br /&gt;
The mean distance to the closest neighbor is around 50-60 pixels.&lt;br /&gt;
 Mean distance: 50.42&lt;br /&gt;
 Standard deviation: 12.23&lt;br /&gt;
&lt;br /&gt;
For a sanity check, you might also measure the lattice directly on the average volume:&lt;br /&gt;
&lt;br /&gt;
 dshow template.em&lt;br /&gt;
&lt;br /&gt;
[[File:average-overplot-hexagonal-lattice-measurements.png|centre|thumb|400px|  Overplot average and hexagonal lattice measurements.]]&lt;br /&gt;
&lt;br /&gt;
== Neighborhood Analysis Computation ==&lt;br /&gt;
&lt;br /&gt;
Here, we conduct the neighborhood analysis with a distance threshold set as the mean distance plus the standard deviation:&lt;br /&gt;
&lt;br /&gt;
 tblT2V3N = dpktbl.neighborhood.analize(tblT2V3,&#039;distance&#039;, meanDst+stdDsts ,&#039;modelColumn&#039;, 22);&lt;br /&gt;
 tblT2V2N = dpktbl.neighborhood.analize(tblT2V2,&#039;distance&#039;,  meanDst+stdDsts ,&#039;modelColumn&#039;, 22);&lt;br /&gt;
 tblT2V5N = dpktbl.neighborhood.analize(tblT2V5,&#039;distance&#039;,  meanDst+stdDsts ,&#039;modelColumn&#039;, 22);&lt;br /&gt;
&lt;br /&gt;
Then, we will need the couple table since it is our new represetation (i.e., latent space):&lt;br /&gt;
&lt;br /&gt;
 tblT2V3NC = real(tblT2V3N.coupleTable);&lt;br /&gt;
 tblT2V2NC = real(tblT2V2N.coupleTable);&lt;br /&gt;
 tblT2V5NC = real(tblT2V5N.coupleTable);&lt;br /&gt;
&lt;br /&gt;
Now, let&#039;s visualize first-order distance clusters with synchronized viewing:&lt;br /&gt;
&lt;br /&gt;
 datasets = {tblT2V3NC, tblT2V2NC, tblT2V5NC};&lt;br /&gt;
 titles = {&amp;quot;Incomplete + flat surface&amp;quot;, &amp;quot;Slightly flat surface&amp;quot;, &amp;quot;Ideal&amp;quot;};&lt;br /&gt;
 &lt;br /&gt;
 fig = figure;&lt;br /&gt;
 ax = gobjects(1, length(datasets));&lt;br /&gt;
 &lt;br /&gt;
 for i = 1:length(datasets)&lt;br /&gt;
    ax(i) = subplot(1, length(datasets), i, &#039;Parent&#039;, fig);&lt;br /&gt;
    pcshow(datasets{i}(:, 24:26), &#039;Parent&#039;, ax(i));&lt;br /&gt;
    pbaspect(ax(i), [1 1 1]);&lt;br /&gt;
    % Set titles using text, since the title function was not working&lt;br /&gt;
    xl = xlim(ax(i));&lt;br /&gt;
    yl = ylim(ax(i));&lt;br /&gt;
    zl = zlim(ax(i));&lt;br /&gt;
    titlePos = [mean(xl), yl(2), zl(2)];&lt;br /&gt;
    text(ax(i), titlePos(1), titlePos(2), titlePos(3), titles{i}, ...&lt;br /&gt;
        &#039;HorizontalAlignment&#039;, &#039;center&#039;, &#039;Color&#039;, &#039;white&#039;, ...&lt;br /&gt;
        &#039;FontSize&#039;, 14, &#039;FontWeight&#039;, &#039;bold&#039;, &#039;BackgroundColor&#039;, &#039;black&#039;);&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 link = linkprop(ax, {&#039;CameraUpVector&#039;, &#039;CameraPosition&#039;, &#039;CameraTarget&#039;, &#039;CameraViewAngle&#039;, &#039;XLim&#039;, &#039;YLim&#039;, &#039;ZLim&#039;});&lt;br /&gt;
 setappdata(gcf, &#039;StoreTheLink&#039;, link);&lt;br /&gt;
 &lt;br /&gt;
 for a = ax&lt;br /&gt;
    rotate3d(a, &#039;on&#039;);&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
[[File:first-order-distance-clusters-three-different-vlps.png|centre|thumb|800px|   First-order distance clusters obtained vía neighborhood analysis. From left to right: low, medium, and high quality instances.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The color, by default, represents the Z-axis. Notice that the better the quality of the VLP, the less sparse each cluster is.&lt;br /&gt;
&lt;br /&gt;
== Local Analysis - Lattice Coherence ==&lt;br /&gt;
&lt;br /&gt;
To quantify lattice coherence, we apply k-means clustering and calculate the Euclidean norms for each centroid. The standard deviation of these norms provides a measure of cluster sparsity and hence, lattice coherence.&lt;br /&gt;
&lt;br /&gt;
We encapsulate this process in a function:&lt;br /&gt;
&lt;br /&gt;
 function [idx, cc_final, results, results_std] = perform_lattice_analysis(data, symm)&lt;br /&gt;
    [idx, cc_final] = kmeans(data, symm);&lt;br /&gt;
    results = vecnorm(cc_final, 2, 2); &lt;br /&gt;
    results_std = std(results); &lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Then, execute the analysis:&lt;br /&gt;
&lt;br /&gt;
 symm = 6; &lt;br /&gt;
 [idx_ideal, cc_ideal_final, results_ideal, std_ideal] = perform_lattice_analysis(tblT2V5NC(:, 24:26),symm);&lt;br /&gt;
 [idx_slightly_flat, cc_sf_final, results_sf, std_sf] = perform_lattice_analysis(tblT2V2NC(:, 24:26),symm);&lt;br /&gt;
 [idx_incomplete_and_flat, cc_implt_final, results_implt, std_implt] = perform_lattice_analysis(tblT2V3NC(:, 24:26),symm);&lt;br /&gt;
&lt;br /&gt;
Display results neatly in a table&lt;br /&gt;
&lt;br /&gt;
 resultsTable = table(std_ideal, std_sf, std_implt, &#039;VariableNames&#039;, {&#039;Ideal&#039;, &#039;SlightlyFlat&#039;, &#039;IncompleteFlat&#039;}, &#039;RowNames&#039;, {&#039;StandardDeviation&#039;});&lt;br /&gt;
 &lt;br /&gt;
 disp(resultsTable);&lt;br /&gt;
&lt;br /&gt;
This will output:&lt;br /&gt;
        &lt;br /&gt;
                               Ideal             SlightlyFlat        IncompleteFlat                       &lt;br /&gt;
                         __________________    _________________    _________________&lt;br /&gt;
                           &lt;br /&gt;
    Standard deviation    0.0933777687916592    0.321031652546273    0.574732108201886&lt;br /&gt;
&lt;br /&gt;
As demonstrated, the qualitative degree of imperfection correlates with our lattice coherence measurements.&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=Compact_HIV1_walkthrough_(PSI_2023)&amp;diff=5009</id>
		<title>Compact HIV1 walkthrough (PSI 2023)</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=Compact_HIV1_walkthrough_(PSI_2023)&amp;diff=5009"/>
		<updated>2024-03-06T12:29:24Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Subtomogram averaging */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= The compact version of the HIV1 walkthrough  =&lt;br /&gt;
&lt;br /&gt;
The compact version of the HIV1 walkthrough is meant to be a faster and less resource requiring version of the HIV1 walkthrough.&lt;br /&gt;
&lt;br /&gt;
The main scripts of the workshop will not be run, but only inspected. The script have already been run and their output has already been generated. As such, only the inspection of the results will be done. This will render the precess faster since no computing time will be required.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;As such, do NOT do the step highlighted in red. Only do the steps highlighted in blue&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Software that would have been used for the full HIV1 walkthrough can be loaded in the PSI setup with:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
module load ctffind4/4.1.14&lt;br /&gt;
&lt;br /&gt;
module load IMOD/4.9.5&lt;br /&gt;
&lt;br /&gt;
module load relion/4.0.1&lt;br /&gt;
&lt;br /&gt;
Chimera will also be used but it is best to use a local Chimera installation and download the the density maps you wish to inspect on the local machine.&lt;br /&gt;
&lt;br /&gt;
= Goal  =&lt;br /&gt;
&lt;br /&gt;
This walkthrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this workshop.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Recovery of experiments parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the workshop are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the link:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the dose weighting.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been deigned for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this workshop after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following workshop are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a Matlab script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, ctffind4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, ctffind4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find thye ctffind4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the ctffind4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;change line 179 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since this is the lightweight version of the HIV1 walkthrough, the script make_AWF.m has not been run. This means that the AWF result structure is not yet in the MATLAB workspace. You can load it by:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u = dtsa(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the line 24 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Launch the reconstruction by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
The binned version of the tomogram is already computed. The factor selected was 2. In any case, these versions will be saved inside the folder of the tomograms, not inside the catalogue.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow-sta.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
  &#039;&#039;&#039;If the reader is already familiar with &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, they may choose to skip ahead to the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui-sta.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui-sta.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of MATLAB and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui-sta.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and MATLAB (remember that the indexing for your system starts at 0 and for MATLAB at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui-sta.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
Place yourself in the &#039;./scripts&#039; directory. Then, simply move or copy the downloaded wild card script and open it via&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
 open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that all the scripts needed for the StA section have been moved already to the scripts folder.&lt;br /&gt;
&lt;br /&gt;
Within the script, ensure you have updated the environment parameters and paths as necessary. Remember, a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or &#039;&#039;&#039;NaN&#039;&#039;&#039; will precede the lines that require your input. Consider establishing a global variable for consistent use throughout the subsequent scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
 a      = dread(aPath);&lt;br /&gt;
 dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project-sta.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
Let us start by preparing the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
re style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
prepare_average_for_chimera(pr_0)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This function will simply filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera-sta.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera-sta.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer-sta.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-reference-center-gui-sta.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From here, copy and open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering-sta.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
Each project will take about 1 hour 30 min (estimation with 8 gpus). To directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_1{idx} &#039;:as:ite=last&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average-sta.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_average.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. Launch the project by typing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run aligment_for_average.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages-sta.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; procedure, allows for candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script second_aligment_per_tomogram.m There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let us now begin with the hands-on portion of the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open second_aligment_per_tomogram&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before cropping the particles, let us visualize the merged table generated containing the candidate positions before and after subboxing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run second_aligment_per_tomogram.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [root &#039;/catalogue/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
idx = 1;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([pr_1{idx} &#039;:rt&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl-sta.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
We can complete the rest of the script. So, next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). To actually compute the cropping of the particles and the corresponding alignment projects:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_2{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average-sta.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results add the following lines in the loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tips:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue”&amp;gt;You can activate the interactive mode by adding a `keyboard` command in your script, then type in your visualization on the terminal.&lt;br /&gt;
To terminate debug mode and continue execution, use the dbcont command.&lt;br /&gt;
To terminate debug mode and exit the file without completing execution, use the dbquit command.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly to the subboxing section, is interesting to see how the filtering strategy worked. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run coarse_gold_standard_alignment.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification-sta.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference-sta.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration-sta.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, if you have already completed the task filling in the missing parts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aEPath = ddb([pr_EO{1} &#039;:as&#039;]);&lt;br /&gt;
aOPath = ddb([pr_EO{2} &#039;:as&#039;]);&lt;br /&gt;
dshow([dread(aEPath); dread(aOPath)])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps-sta.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration-sta.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask-sta.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus). Launch it via:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run refined_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects.&lt;br /&gt;
&lt;br /&gt;
[[File:final-sta-result-from-refined-gold-standard-sta.png|centre|thumb|600px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;, top left.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to RELION convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, RELION will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera-sta.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this workshop the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root and go to a personal workplace folder&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;run_half2_class001_unfil.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_sharpen.png|centre|thumb|600px| RELION Post-process I/O sharped with automatic B-factor estimation.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the pre-computed post-processed average with:&lt;br /&gt;
dshow(&#039;PostProcess/job171/postprocess.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and inspect the FSC curves by opening the file:&lt;br /&gt;
PostProcess/job171/logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the reolsution even further. However, in this workflow, only the basic RELION steps will be expoited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;open the relion4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Click on the relion4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make psuedo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make psuedo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make psuedo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here put will not be done because of time limitations. This step took 18h on 8 GPUs and the computed reusults are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprossed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION TSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=HIV1_Walkthrough_(PSI_2023)&amp;diff=5008</id>
		<title>HIV1 Walkthrough (PSI 2023)</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=HIV1_Walkthrough_(PSI_2023)&amp;diff=5008"/>
		<updated>2024-03-06T12:28:08Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Subtomogram averaging */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Goal  =&lt;br /&gt;
&lt;br /&gt;
This walkthrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this workshop.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Recovery of experiments parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the workshop are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the link:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the dose weighting.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been deigned for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this workshop after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following workshop are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a Matlab script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, ctffind4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, ctffind4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find thye ctffind4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the ctffind4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;change line 179 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the line 24 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Launch the reconstruction by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GUI will pop up as soon as the catalog &#039;c000.ctlg&#039; is called via   &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dcm c000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create the binned version of the tomogram selecting a factor of 2. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-create-pre-binned-dmmpp.png|centre|thumb|600px| Creation of tomograms binned versions using &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, these versions will be saved inside the folder of the tomograms, not inside the catalogue folder.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow-sta.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
  &#039;&#039;&#039;If the reader is already familiar with &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, they may choose to skip ahead to the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui-sta.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui-sta.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of MATLAB and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui-sta.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and MATLAB (remember that the indexing for your system starts at 0 and for MATLAB at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui-sta.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
Place yourself in the &#039;./scripts&#039; directory. Then, simply move or copy the downloaded wild card script and open it via&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
 open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that all the scripts needed for the StA section have been moved already to the scripts folder.&lt;br /&gt;
&lt;br /&gt;
Within the script, ensure you have updated the environment parameters and paths as necessary. Remember, a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or &#039;&#039;&#039;NaN&#039;&#039;&#039; will precede the lines that require your input. Consider establishing a global variable for consistent use throughout the subsequent scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
 a      = dread(aPath);&lt;br /&gt;
 dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project-sta.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
Let us start by preparing the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
re style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
prepare_average_for_chimera(pr_0)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This function will simply filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera-sta.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera-sta.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer-sta.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-reference-center-gui-sta.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From here, copy and open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering-sta.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
Each project will take about 1 hour 30 min (estimation with 8 gpus). To directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_1{idx} &#039;:as:ite=last&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average-sta.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_average.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. Launch the project by typing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run aligment_for_average.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages-sta.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; procedure, allows for candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script second_aligment_per_tomogram.m There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let us now begin with the hands-on portion of the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open second_aligment_per_tomogram&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before cropping the particles, let us visualize the merged table generated containing the candidate positions before and after subboxing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run second_aligment_per_tomogram.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [root &#039;/catalogue/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
idx = 1;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([pr_1{idx} &#039;:rt&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl-sta.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
We can complete the rest of the script. So, next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). To actually compute the cropping of the particles and the corresponding alignment projects:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_2{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average-sta.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results add the following lines in the loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tips:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue”&amp;gt;You can activate the interactive mode by adding a `keyboard` command in your script, then type in your visualization on the terminal.&lt;br /&gt;
To terminate debug mode and continue execution, use the dbcont command.&lt;br /&gt;
To terminate debug mode and exit the file without completing execution, use the dbquit command.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly to the subboxing section, is interesting to see how the filtering strategy worked. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run coarse_gold_standard_alignment.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification-sta.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference-sta.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration-sta.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, if you have already completed the task filling in the missing parts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aEPath = ddb([pr_EO{1} &#039;:as&#039;]);&lt;br /&gt;
aOPath = ddb([pr_EO{2} &#039;:as&#039;]);&lt;br /&gt;
dshow([dread(aEPath); dread(aOPath)])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps-sta.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration-sta.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask-sta.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus). Launch it via:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run refined_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects.&lt;br /&gt;
&lt;br /&gt;
[[File:final-sta-result-from-refined-gold-standard-sta.png|centre|thumb|600px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;, top left.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to RELION convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, RELION will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera-sta.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this workshop the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;run_half2_class001_unfil.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_sharpen.png|centre|thumb|600px| RELION Post-process I/O sharped with automatic B-factor estimation.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the reolsution even further. However, in this workflow, only the basic RELION steps will be expoited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open the relion4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click on the relion4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make psuedo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make psuedo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make psuedo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here put will not be done because of time limitations. This step took 18h on 8 GPUs and the computed reusults are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprossed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION TSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=HIV1_workshop&amp;diff=5007</id>
		<title>HIV1 workshop</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=HIV1_workshop&amp;diff=5007"/>
		<updated>2024-03-06T12:27:54Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Subtomogram averaging */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Goal of the walktrough =&lt;br /&gt;
&lt;br /&gt;
This walktrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this walktrough.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Structure of the walktrough =&lt;br /&gt;
&lt;br /&gt;
The full HIV1 walktrough pipeline has been split into multiple sequential steps. Each of these steps corresponds to a subsection of this wiki page. It is possible to reach an average with about ~4 A of resolution starting from 5 tilt series by following all of the steps described in this walktrough. The process to create a tilt series from the microscope movies is only mentioned and discussed in the &amp;quot;Motion correction and dose weighting&amp;quot; subsection.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
However, depending on the hardware available, a full execution of this pipeline can easily take a week of computing time. Additionally, the generated data consumes considerable amounts of memory resources. As such, this walktrough is has been constructed to be scalable. The full version of the walktrough code package is divided into two sections: scripts and data. The following figure represents the package tree. The data part includes all of the pre-computed intermediate files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:folder_structure_HIV1.png|centre|thumb|800px| Structure of package containing the data and scripts for the HIV1 walktrough. The full version of the &#039;data&#039; part of the package is 2.2 TB. The &#039;scripts&#039; part is divided into steps. Note the correspondence between the folder names and the subsection names in this wiki page. Each step folder is divided into three parts: inputs, outputs and scripts. The input contains a set of paths to the where the input data is meant to be found in the &#039;data&#039; part of the package. The output contains a set of path of where the generated files of this step should be moved to. The scripts includes the matlab codes that will be executed following the practical notes in the wiki page.]]&lt;br /&gt;
&lt;br /&gt;
There are two main approaches on the implementation of walktrough with different scales of memory and computing resource requirements: with pre-computations or full execution. The two approaches are described in the following tables.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! with pre-computations&lt;br /&gt;
|-&lt;br /&gt;
| Requires an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Does not require large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for in-person workshop.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section has been made available from a physical memory.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The script generally do not need modification.&lt;br /&gt;
|-&lt;br /&gt;
| By default most scripts process only one tilt series. This is done to save computing time.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! full execution&lt;br /&gt;
|-&lt;br /&gt;
| Does not require an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Requires large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for individual practical use.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section starts has mostly empty. The &#039;data&#039; section can be downloaded from https://drive.google.com/file/d/1k4bLLswsacYdIGcNRc76YcbAiycxyPuX/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts will need modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts need to be modified to process all of the tilt series. The scripts are already structured to simplify the needed modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section. As such, the &#039;data&#039; section needs to be filled with the outputs of the scripts after each step.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As mentioned previously, the &amp;quot;full-execution&amp;quot; approach requires some limited script modifications. The matlab scripts have been generally structured so as to present three parts. The first part consists of the paths to the input and output files. The second part is the section of parameters. The third part is a for loop on the input tilt series. As such, the typical modifications necessary for the &amp;quot;full-execution&amp;quot; approach are limited to the first part, ensuring that the inputs for all five tilt series are given.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Additionally, in the &amp;quot;full-execution&amp;quot; approach, the results of the scripts are used to populate the empty &#039;data&#039; section so that the following scripts may be able to access their input files. This means that the files need to be positioned in the correct folder tree location and with a consistent file name. To help with this process, each step has an output text file in its folder with the path and file names that need to be applied to ensure consistency.&lt;br /&gt;
&lt;br /&gt;
= Recovery of acquisition parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the walktrough are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the link:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the dose weighting.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been deigned for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this walktrough after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following walktrough are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a Matlab script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, ctffind4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, ctffind4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find thye ctffind4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the ctffind4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;change line 179 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the line 24 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Launch the reconstruction by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GUI will pop up as soon as the catalog &#039;c000.ctlg&#039; is called via   &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dcm c000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create the binned version of the tomogram selecting a factor of 2. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-create-pre-binned-dmmpp.png|centre|thumb|600px| Creation of tomograms binned versions using &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, these versions will be saved inside the folder of the tomograms, not inside the catalogue folder.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow-sta.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
  &#039;&#039;&#039;If the reader is already familiar with &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, they may choose to skip ahead to the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui-sta.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui-sta.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of MATLAB and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui-sta.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and MATLAB (remember that the indexing for your system starts at 0 and for MATLAB at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui-sta.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
Place yourself in the &#039;./scripts&#039; directory. Then, simply move or copy the downloaded wild card script and open it via&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
 open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that all the scripts needed for the StA section have been moved already to the scripts folder.&lt;br /&gt;
&lt;br /&gt;
Within the script, ensure you have updated the environment parameters and paths as necessary. Remember, a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or &#039;&#039;&#039;NaN&#039;&#039;&#039; will precede the lines that require your input. Consider establishing a global variable for consistent use throughout the subsequent scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
 a      = dread(aPath);&lt;br /&gt;
 dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project-sta.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
Let us start by preparing the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
re style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
prepare_average_for_chimera(pr_0)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This function will simply filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera-sta.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera-sta.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer-sta.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-reference-center-gui-sta.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From here, copy and open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering-sta.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
Each project will take about 1 hour 30 min (estimation with 8 gpus). To directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_1{idx} &#039;:as:ite=last&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average-sta.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_average.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. Launch the project by typing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run aligment_for_average.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages-sta.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; procedure, allows for candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script second_aligment_per_tomogram.m There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let us now begin with the hands-on portion of the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open second_aligment_per_tomogram&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before cropping the particles, let us visualize the merged table generated containing the candidate positions before and after subboxing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run second_aligment_per_tomogram.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [root &#039;/catalogue/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
idx = 1;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([pr_1{idx} &#039;:rt&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl-sta.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
We can complete the rest of the script. So, next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). To actually compute the cropping of the particles and the corresponding alignment projects:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_2{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average-sta.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results add the following lines in the loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tips:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue”&amp;gt;You can activate the interactive mode by adding a `keyboard` command in your script, then type in your visualization on the terminal.&lt;br /&gt;
To terminate debug mode and continue execution, use the dbcont command.&lt;br /&gt;
To terminate debug mode and exit the file without completing execution, use the dbquit command.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly to the subboxing section, is interesting to see how the filtering strategy worked. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run coarse_gold_standard_alignment.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification-sta.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference-sta.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration-sta.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, if you have already completed the task filling in the missing parts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aEPath = ddb([pr_EO{1} &#039;:as&#039;]);&lt;br /&gt;
aOPath = ddb([pr_EO{2} &#039;:as&#039;]);&lt;br /&gt;
dshow([dread(aEPath); dread(aOPath)])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps-sta.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration-sta.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask-sta.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus). Launch it via:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run refined_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects.&lt;br /&gt;
&lt;br /&gt;
[[File:final-sta-result-from-refined-gold-standard-sta.png|centre|thumb|600px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;, top left.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to RELION convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, RELION will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera-sta.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this walktrough the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;run_half2_class001_unfil.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_sharpen.png|centre|thumb|600px| RELION Post-process I/O sharped with automatic B-factor estimation.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the reolsution even further. However, in this workflow, only the basic RELION steps will be expoited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open the relion4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click on the relion4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make psuedo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make psuedo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make psuedo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here put will not be done because of time limitations. This step took 18h on 8 GPUs and the computed reusults are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprossed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION TSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=HIV1_workshop&amp;diff=5006</id>
		<title>HIV1 workshop</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=HIV1_workshop&amp;diff=5006"/>
		<updated>2024-03-06T12:27:34Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Dynamo models and particles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Goal of the walktrough =&lt;br /&gt;
&lt;br /&gt;
This walktrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this walktrough.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Structure of the walktrough =&lt;br /&gt;
&lt;br /&gt;
The full HIV1 walktrough pipeline has been split into multiple sequential steps. Each of these steps corresponds to a subsection of this wiki page. It is possible to reach an average with about ~4 A of resolution starting from 5 tilt series by following all of the steps described in this walktrough. The process to create a tilt series from the microscope movies is only mentioned and discussed in the &amp;quot;Motion correction and dose weighting&amp;quot; subsection.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
However, depending on the hardware available, a full execution of this pipeline can easily take a week of computing time. Additionally, the generated data consumes considerable amounts of memory resources. As such, this walktrough is has been constructed to be scalable. The full version of the walktrough code package is divided into two sections: scripts and data. The following figure represents the package tree. The data part includes all of the pre-computed intermediate files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:folder_structure_HIV1.png|centre|thumb|800px| Structure of package containing the data and scripts for the HIV1 walktrough. The full version of the &#039;data&#039; part of the package is 2.2 TB. The &#039;scripts&#039; part is divided into steps. Note the correspondence between the folder names and the subsection names in this wiki page. Each step folder is divided into three parts: inputs, outputs and scripts. The input contains a set of paths to the where the input data is meant to be found in the &#039;data&#039; part of the package. The output contains a set of path of where the generated files of this step should be moved to. The scripts includes the matlab codes that will be executed following the practical notes in the wiki page.]]&lt;br /&gt;
&lt;br /&gt;
There are two main approaches on the implementation of walktrough with different scales of memory and computing resource requirements: with pre-computations or full execution. The two approaches are described in the following tables.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! with pre-computations&lt;br /&gt;
|-&lt;br /&gt;
| Requires an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Does not require large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for in-person workshop.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section has been made available from a physical memory.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The script generally do not need modification.&lt;br /&gt;
|-&lt;br /&gt;
| By default most scripts process only one tilt series. This is done to save computing time.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! full execution&lt;br /&gt;
|-&lt;br /&gt;
| Does not require an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Requires large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for individual practical use.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section starts has mostly empty. The &#039;data&#039; section can be downloaded from https://drive.google.com/file/d/1k4bLLswsacYdIGcNRc76YcbAiycxyPuX/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts will need modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts need to be modified to process all of the tilt series. The scripts are already structured to simplify the needed modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section. As such, the &#039;data&#039; section needs to be filled with the outputs of the scripts after each step.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As mentioned previously, the &amp;quot;full-execution&amp;quot; approach requires some limited script modifications. The matlab scripts have been generally structured so as to present three parts. The first part consists of the paths to the input and output files. The second part is the section of parameters. The third part is a for loop on the input tilt series. As such, the typical modifications necessary for the &amp;quot;full-execution&amp;quot; approach are limited to the first part, ensuring that the inputs for all five tilt series are given.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Additionally, in the &amp;quot;full-execution&amp;quot; approach, the results of the scripts are used to populate the empty &#039;data&#039; section so that the following scripts may be able to access their input files. This means that the files need to be positioned in the correct folder tree location and with a consistent file name. To help with this process, each step has an output text file in its folder with the path and file names that need to be applied to ensure consistency.&lt;br /&gt;
&lt;br /&gt;
= Recovery of acquisition parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the walktrough are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the link:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the dose weighting.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been deigned for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this walktrough after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following walktrough are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a Matlab script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, ctffind4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, ctffind4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find thye ctffind4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the ctffind4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;change line 179 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the line 24 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Launch the reconstruction by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GUI will pop up as soon as the catalog &#039;c000.ctlg&#039; is called via   &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dcm c000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create the binned version of the tomogram selecting a factor of 2. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-create-pre-binned-dmmpp.png|centre|thumb|600px| Creation of tomograms binned versions using &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, these versions will be saved inside the folder of the tomograms, not inside the catalogue folder.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of Matlab and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and Matlab (remember that the indexing for your system starts at 0 and for Matlab at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
For creating the initial reference, open the script &amp;lt;code&amp;gt;aligment_for_reference.m&amp;lt;/code&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Make sure you have changed the environment parameters and paths. You may want to create a global variable for the rest of the scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As explained previously, the last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
a      = dread(aPath);&lt;br /&gt;
dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
First, prepare the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_0) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chiera-reference-center-gui.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
From here, open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script and, as usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open first_aligment_per_tomogram.m &lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Since each project will take about 1 hour 30 min (estimation with 8 gpus), the script instead of computing the average itself will gather the precomputed results. Make sure to change the paths if you do not want them to be copied in your workspace, else, directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prTs = &#039;pr_ts_all_1&#039;;&lt;br /&gt;
aPaths = ddb([prTs &#039;:as:ite=last:ref=*&#039;]);&lt;br /&gt;
&lt;br /&gt;
aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = aPaths{idx};&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_reference.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; a With this procedure, candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script &amp;lt;code&amp;gt;second_aligment_per_tomogram.m&amp;lt;/code&amp;gt;. There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Now, let us visualize the merged table generated containing the candidate positions before and after subboxing. About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [pathToSharedStorage &#039;/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([&#039;pr_ts_all_1:rt:ite=last:ref=1&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). Therefore, to fit the schedule, when launching the script, the pre-computed results will be obtained:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prTs = &#039;pr_ts_all_2&#039;;&lt;br /&gt;
aPaths = ddb([prTs &#039;:as:ite=last:ref=*&#039;]);&lt;br /&gt;
&lt;br /&gt;
aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = aPaths{idx};&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results add the following lines in the loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tips:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue”&amp;gt;You can activate the interactive mode by adding a `keyboard` command in your script, then type in your visualization on the terminal.&lt;br /&gt;
To terminate debug mode and continue execution, use the dbcont command.&lt;br /&gt;
To terminate debug mode and exit the file without completing execution, use the dbquit command.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly to the subboxing section, is interesting to see how the filtering strategy worked. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run coarse_gold_standard_alignment.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification-sta.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference-sta.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration-sta.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, if you have already completed the task filling in the missing parts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aEPath = ddb([pr_EO{1} &#039;:as&#039;]);&lt;br /&gt;
aOPath = ddb([pr_EO{2} &#039;:as&#039;]);&lt;br /&gt;
dshow([dread(aEPath); dread(aOPath)])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps-sta.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects. The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus).&lt;br /&gt;
&lt;br /&gt;
[[File:final-result-from-refined-gold-standard-sta.png|centre|thumb|600px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;, top left.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to Relion convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, Relion will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this walktrough the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;run_half2_class001_unfil.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_sharpen.png|centre|thumb|600px| RELION Post-process I/O sharped with automatic B-factor estimation.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the reolsution even further. However, in this workflow, only the basic RELION steps will be expoited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open the relion4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click on the relion4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make psuedo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make psuedo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make psuedo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here put will not be done because of time limitations. This step took 18h on 8 GPUs and the computed reusults are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprossed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION TSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=HIV1_workshop&amp;diff=5005</id>
		<title>HIV1 workshop</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=HIV1_workshop&amp;diff=5005"/>
		<updated>2024-03-06T12:26:52Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Extraction of coarse half maps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Goal of the walktrough =&lt;br /&gt;
&lt;br /&gt;
This walktrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this walktrough.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Structure of the walktrough =&lt;br /&gt;
&lt;br /&gt;
The full HIV1 walktrough pipeline has been split into multiple sequential steps. Each of these steps corresponds to a subsection of this wiki page. It is possible to reach an average with about ~4 A of resolution starting from 5 tilt series by following all of the steps described in this walktrough. The process to create a tilt series from the microscope movies is only mentioned and discussed in the &amp;quot;Motion correction and dose weighting&amp;quot; subsection.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
However, depending on the hardware available, a full execution of this pipeline can easily take a week of computing time. Additionally, the generated data consumes considerable amounts of memory resources. As such, this walktrough is has been constructed to be scalable. The full version of the walktrough code package is divided into two sections: scripts and data. The following figure represents the package tree. The data part includes all of the pre-computed intermediate files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:folder_structure_HIV1.png|centre|thumb|800px| Structure of package containing the data and scripts for the HIV1 walktrough. The full version of the &#039;data&#039; part of the package is 2.2 TB. The &#039;scripts&#039; part is divided into steps. Note the correspondence between the folder names and the subsection names in this wiki page. Each step folder is divided into three parts: inputs, outputs and scripts. The input contains a set of paths to the where the input data is meant to be found in the &#039;data&#039; part of the package. The output contains a set of path of where the generated files of this step should be moved to. The scripts includes the matlab codes that will be executed following the practical notes in the wiki page.]]&lt;br /&gt;
&lt;br /&gt;
There are two main approaches on the implementation of walktrough with different scales of memory and computing resource requirements: with pre-computations or full execution. The two approaches are described in the following tables.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! with pre-computations&lt;br /&gt;
|-&lt;br /&gt;
| Requires an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Does not require large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for in-person workshop.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section has been made available from a physical memory.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The script generally do not need modification.&lt;br /&gt;
|-&lt;br /&gt;
| By default most scripts process only one tilt series. This is done to save computing time.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! full execution&lt;br /&gt;
|-&lt;br /&gt;
| Does not require an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Requires large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for individual practical use.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section starts has mostly empty. The &#039;data&#039; section can be downloaded from https://drive.google.com/file/d/1k4bLLswsacYdIGcNRc76YcbAiycxyPuX/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts will need modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts need to be modified to process all of the tilt series. The scripts are already structured to simplify the needed modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section. As such, the &#039;data&#039; section needs to be filled with the outputs of the scripts after each step.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As mentioned previously, the &amp;quot;full-execution&amp;quot; approach requires some limited script modifications. The matlab scripts have been generally structured so as to present three parts. The first part consists of the paths to the input and output files. The second part is the section of parameters. The third part is a for loop on the input tilt series. As such, the typical modifications necessary for the &amp;quot;full-execution&amp;quot; approach are limited to the first part, ensuring that the inputs for all five tilt series are given.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Additionally, in the &amp;quot;full-execution&amp;quot; approach, the results of the scripts are used to populate the empty &#039;data&#039; section so that the following scripts may be able to access their input files. This means that the files need to be positioned in the correct folder tree location and with a consistent file name. To help with this process, each step has an output text file in its folder with the path and file names that need to be applied to ensure consistency.&lt;br /&gt;
&lt;br /&gt;
= Recovery of acquisition parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the walktrough are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the link:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the dose weighting.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been deigned for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this walktrough after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following walktrough are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a Matlab script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, ctffind4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, ctffind4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find thye ctffind4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the ctffind4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;change line 179 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the line 24 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Launch the reconstruction by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GUI will pop up as soon as the catalog &#039;c000.ctlg&#039; is called via   &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dcm c000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create the binned version of the tomogram selecting a factor of 2. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-create-pre-binned-dmmpp.png|centre|thumb|600px| Creation of tomograms binned versions using &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, these versions will be saved inside the folder of the tomograms, not inside the catalogue folder.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, open the script via&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and sometimes an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of Matlab and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and Matlab (remember that the indexing for your system starts at 0 and for Matlab at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
For creating the initial reference, open the script &amp;lt;code&amp;gt;aligment_for_reference.m&amp;lt;/code&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Make sure you have changed the environment parameters and paths. You may want to create a global variable for the rest of the scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As explained previously, the last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
a      = dread(aPath);&lt;br /&gt;
dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
First, prepare the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_0) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chiera-reference-center-gui.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
From here, open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script and, as usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open first_aligment_per_tomogram.m &lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Since each project will take about 1 hour 30 min (estimation with 8 gpus), the script instead of computing the average itself will gather the precomputed results. Make sure to change the paths if you do not want them to be copied in your workspace, else, directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prTs = &#039;pr_ts_all_1&#039;;&lt;br /&gt;
aPaths = ddb([prTs &#039;:as:ite=last:ref=*&#039;]);&lt;br /&gt;
&lt;br /&gt;
aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = aPaths{idx};&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_reference.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; a With this procedure, candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script &amp;lt;code&amp;gt;second_aligment_per_tomogram.m&amp;lt;/code&amp;gt;. There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Now, let us visualize the merged table generated containing the candidate positions before and after subboxing. About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [pathToSharedStorage &#039;/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([&#039;pr_ts_all_1:rt:ite=last:ref=1&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). Therefore, to fit the schedule, when launching the script, the pre-computed results will be obtained:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prTs = &#039;pr_ts_all_2&#039;;&lt;br /&gt;
aPaths = ddb([prTs &#039;:as:ite=last:ref=*&#039;]);&lt;br /&gt;
&lt;br /&gt;
aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = aPaths{idx};&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results add the following lines in the loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tips:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue”&amp;gt;You can activate the interactive mode by adding a `keyboard` command in your script, then type in your visualization on the terminal.&lt;br /&gt;
To terminate debug mode and continue execution, use the dbcont command.&lt;br /&gt;
To terminate debug mode and exit the file without completing execution, use the dbquit command.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly to the subboxing section, is interesting to see how the filtering strategy worked. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run coarse_gold_standard_alignment.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification-sta.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference-sta.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration-sta.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, if you have already completed the task filling in the missing parts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aEPath = ddb([pr_EO{1} &#039;:as&#039;]);&lt;br /&gt;
aOPath = ddb([pr_EO{2} &#039;:as&#039;]);&lt;br /&gt;
dshow([dread(aEPath); dread(aOPath)])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps-sta.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects. The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus).&lt;br /&gt;
&lt;br /&gt;
[[File:final-result-from-refined-gold-standard-sta.png|centre|thumb|600px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;, top left.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to Relion convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, Relion will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this walktrough the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;run_half2_class001_unfil.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_sharpen.png|centre|thumb|600px| RELION Post-process I/O sharped with automatic B-factor estimation.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the reolsution even further. However, in this workflow, only the basic RELION steps will be expoited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open the relion4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click on the relion4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make psuedo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make psuedo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make psuedo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here put will not be done because of time limitations. This step took 18h on 8 GPUs and the computed reusults are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprossed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION TSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=High_Resolution_workflow_for_HIV1_(SciLifeLab_2023)&amp;diff=5004</id>
		<title>High Resolution workflow for HIV1 (SciLifeLab 2023)</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=High_Resolution_workflow_for_HIV1_(SciLifeLab_2023)&amp;diff=5004"/>
		<updated>2024-03-06T12:26:30Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Extraction of coarse half maps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Goal  =&lt;br /&gt;
&lt;br /&gt;
This walkthrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this workshop.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Recovery of experiments parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the workshop are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the link:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the dose weighting.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been deigned for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this workshop after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following workshop are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a Matlab script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, ctffind4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, ctffind4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find thye ctffind4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the ctffind4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;change line 179 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the line 24 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Launch the reconstruction by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GUI will pop up as soon as the catalog &#039;c000.ctlg&#039; is called via   &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dcm c000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create the binned version of the tomogram selecting a factor of 2. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-create-pre-binned-dmmpp.png|centre|thumb|600px| Creation of tomograms binned versions using &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, these versions will be saved inside the folder of the tomograms, not inside the catalogue folder.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow-sta.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
  &#039;&#039;&#039;If the reader is already familiar with &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, they may choose to skip ahead to the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui-sta.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui-sta.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of MATLAB and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui-sta.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and MATLAB (remember that the indexing for your system starts at 0 and for MATLAB at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui-sta.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
Place yourself in the &#039;./scripts&#039; directory. Then, simply move or copy the downloaded wild card script and open it via&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
 open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that all the scripts needed for the StA section have been moved already to the scripts folder.&lt;br /&gt;
&lt;br /&gt;
Within the script, ensure you have updated the environment parameters and paths as necessary. Remember, a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or &#039;&#039;&#039;NaN&#039;&#039;&#039; will precede the lines that require your input. Consider establishing a global variable for consistent use throughout the subsequent scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
 a      = dread(aPath);&lt;br /&gt;
 dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project-sta.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
Let us start by preparing the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
re style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
prepare_average_for_chimera(pr_0)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This function will simply filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera-sta.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera-sta.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer-sta.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-reference-center-gui-sta.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From here, copy and open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering-sta.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
Each project will take about 1 hour 30 min (estimation with 8 gpus). To directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_1{idx} &#039;:as:ite=last&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average-sta.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_average.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. Launch the project by typing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run aligment_for_average.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages-sta.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; procedure, allows for candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script second_aligment_per_tomogram.m There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let us now begin with the hands-on portion of the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open second_aligment_per_tomogram&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before cropping the particles, let us visualize the merged table generated containing the candidate positions before and after subboxing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run second_aligment_per_tomogram.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [root &#039;/catalogue/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
idx = 1;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([pr_1{idx} &#039;:rt&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl-sta.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
We can complete the rest of the script. So, next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). To actually compute the cropping of the particles and the corresponding alignment projects:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_2{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average-sta.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results add the following lines in the loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tips:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue”&amp;gt;You can activate the interactive mode by adding a `keyboard` command in your script, then type in your visualization on the terminal.&lt;br /&gt;
To terminate debug mode and continue execution, use the dbcont command.&lt;br /&gt;
To terminate debug mode and exit the file without completing execution, use the dbquit command.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly to the subboxing section, is interesting to see how the filtering strategy worked. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run coarse_gold_standard_alignment.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification-sta.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference-sta.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration-sta.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, if you have already completed the task filling in the missing parts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aEPath = ddb([pr_EO{1} &#039;:as&#039;]);&lt;br /&gt;
aOPath = ddb([pr_EO{2} &#039;:as&#039;]);&lt;br /&gt;
dshow([dread(aEPath); dread(aOPath)])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps-sta.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration-sta.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask-sta.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus). Launch it via:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run refined_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects.&lt;br /&gt;
&lt;br /&gt;
[[File:final-sta-result-from-refined-gold-standard-sta.png|centre|thumb|600px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;, top left.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to RELION convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, RELION will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera-sta.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this workshop the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;run_half2_class001_unfil.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_sharpen.png|centre|thumb|600px| RELION Post-process I/O sharped with automatic B-factor estimation.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the reolsution even further. However, in this workflow, only the basic RELION steps will be expoited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open the relion4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click on the relion4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make psuedo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make psuedo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make psuedo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here put will not be done because of time limitations. This step took 18h on 8 GPUs and the computed reusults are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprossed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION TSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=High_resolution_walkthrough_with_HIV1&amp;diff=5003</id>
		<title>High resolution walkthrough with HIV1</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=High_resolution_walkthrough_with_HIV1&amp;diff=5003"/>
		<updated>2024-03-06T11:27:13Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Extraction of coarse half maps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Goal of the walktrough =&lt;br /&gt;
&lt;br /&gt;
This walktrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this walktrough.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Structure of the walkthrough =&lt;br /&gt;
&lt;br /&gt;
The full HIV1 walkthrough pipeline has been split into multiple sequential steps. Each of these steps corresponds to a subsection of this wiki page. It is possible to reach an average with about ~4 A of resolution starting from 5 tilt series by following all of the steps described in this walkthrough. The only exception is the process to create a tilt series from the microscope movies, which is only discussed in the &amp;quot;Motion correction and dose weighting&amp;quot; subsection.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
However, depending on the hardware available, a full execution of this pipeline can easily take a week of computing time. Additionally, the generated data consumes considerable amounts of memory resources. As such, this walkthrough is has been constructed to be scalable. The full version of the walkthrough code package is divided into two sections: scripts and data. The following figure represents the package tree. The data part includes all of the pre-computed intermediate files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Folder_structure_HIV1_v2.png|centre|thumb|800px| Structure of package containing the data and scripts for the HIV1 walktrough. The full version of the &#039;data&#039; part of the package is 2.2 TB. The &#039;scripts&#039; part is divided into steps. Note the correspondence between the folder names and the subsection names in this wiki page. Each step folder is divided into three parts: inputs, outputs and scripts. The input contains a set of paths to the where the input data is meant to be found in the &#039;data&#039; part of the package. The output contains a set of path of where the generated files of this step should be moved to. The scripts includes the MATLAB codes that will be executed following the practical notes in the wiki page.]]&lt;br /&gt;
&lt;br /&gt;
There are two main approaches on the implementation of walktrough with different scales of memory and computing resource requirements: with pre-computations or full execution. The two approaches are described in the following tables.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! with pre-computations&lt;br /&gt;
|-&lt;br /&gt;
| Requires an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Does not require large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for in-person workshop.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section has been made available from a physical memory.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The script generally do not need modification.&lt;br /&gt;
|-&lt;br /&gt;
| By default most scripts process only one tilt series. This is done to save computing time.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! full execution&lt;br /&gt;
|-&lt;br /&gt;
| Does not require an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Requires large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for individual practical use.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section starts has mostly empty. The &#039;data&#039; section can be downloaded from https://drive.google.com/file/d/1k4bLLswsacYdIGcNRc76YcbAiycxyPuX/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts will need modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts need to be modified to process all of the tilt series. The scripts are already structured to simplify the needed modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section. As such, the &#039;data&#039; section needs to be filled with the outputs of the scripts after each step.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As mentioned previously, the &amp;quot;full-execution&amp;quot; approach requires some limited script modifications. The MATLAB scripts have been generally structured so as to present three parts. The first part consists of the paths to the input and output files. The second part is the section of parameters. The third part is a for loop on the input tilt series. As such, the typical modifications necessary for the &amp;quot;full-execution&amp;quot; approach are limited to the first part, ensuring that the inputs for all five tilt series are given.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Additionally, in the &amp;quot;full-execution&amp;quot; approach, the results of the scripts are used to populate the empty &#039;data&#039; section so that the following scripts may be able to access their input files. This means that the files need to be positioned in the correct folder tree location and with a consistent file name. To help with this process, each step has an output text file in its folder with the path and file names that need to be applied to ensure consistency.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+ Time requirements for each step&lt;br /&gt;
|-&lt;br /&gt;
! Step !! Computing time !! Interactive time !! Workshop time !! Notes&lt;br /&gt;
|-&lt;br /&gt;
! Recovery of acquisition parameters &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 5 min &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! Motion correction &lt;br /&gt;
| 1 min per tilt series with GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Not done in this walkthrough&lt;br /&gt;
|-&lt;br /&gt;
! CTF estimation &lt;br /&gt;
| 5 min for all tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using CTFFIND4&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: alignment &lt;br /&gt;
| 8 min per tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: dose weighting &lt;br /&gt;
| 3 min &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default on all tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: CTF correction &lt;br /&gt;
| 1 hour 30 min per tilt series without GPU, 5 min per tilt series with 1 GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using IMOD, executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: tomogram reconstruction &lt;br /&gt;
| 12 min per tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: preparation and management of data &lt;br /&gt;
| 5 min &lt;br /&gt;
| 3 min &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: particle picking &lt;br /&gt;
| - &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| 10 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: particle extraction &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: creation of initial reference &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of first per tomogram average &lt;br /&gt;
| 15 min (CPU) + 1 hour 30 min (8 GPUs) per tilt series &lt;br /&gt;
| 15 min &lt;br /&gt;
| 15 min &lt;br /&gt;
| Use of UCSF Chimera&lt;br /&gt;
|-&lt;br /&gt;
! StA: computing an average of averages &lt;br /&gt;
| 15 min (CPU) &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of second per tomogram average &lt;br /&gt;
| 30 min (CPU) + 3 hours 30 min (8 GPUs) per tilt series &lt;br /&gt;
| 25 min &lt;br /&gt;
| 15 min &lt;br /&gt;
| Use of UCSF Chimera&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of coarse half maps &lt;br /&gt;
| 22 min (CPU) + 48 hours (8 GPUs) &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of refined half maps &lt;br /&gt;
| 1 hour (CPU) + 24 hours (8 GPUs) + 1 hour (CPU) per tilt series &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! FSC computation &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 15 min &lt;br /&gt;
| Using RELION&lt;br /&gt;
|-&lt;br /&gt;
! RELION conversion &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 5 min &lt;br /&gt;
| Using RELION&lt;br /&gt;
|-&lt;br /&gt;
! RELION refinement &lt;br /&gt;
| &amp;gt;40 hours using 8 GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using RELION, split into generation of a RELION template (~1h), extraction of RELION particles (~1h) and then the execution of the RELION refinement&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
= Recovery of acquisition parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the walktrough are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file of a K3 detector inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the links:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
https://relion.readthedocs.io/en/release-3.1/Reference/MovieCompression.html&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the gain correction.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been designed for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this walkthrough after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following walkthrough are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a MATLAB script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags. Note also that if Motioncorr2 cannot find or use the gain file provided, it will not terminate the motion correction and will instead continue computing without gain correction.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, CTFFIND4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, CTFFIND4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal. Note that the CTFFIND4 wrapper has been created for CTFfind version 4.1.5. Using a different CTFfind version may require some limited modifications of the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the CTFFIND4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the CTFFIND4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;change line 178 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD. The tested version of IMOD is 4.11.12.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the line 26 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Note that the reconstruction of a full-size tomogram is resource intensive, especially in memory. In this case, the expected size of a single tomogram is about 100 GB.&amp;lt;/pre&amp;gt; All the tomograms have been pre-computed and stored in the data folder. If you wish to backproject a tomogram it may be done by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GUI will pop up as soon as the catalog &#039;c000.ctlg&#039; is called via   &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dcm c000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create the binned version of the tomogram selecting a factor of 2. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-create-pre-binned-dmmpp.png|centre|thumb|600px| Creation of tomograms binned versions using &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, these versions will be saved inside the folder of the tomograms, not inside the catalogue folder.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow-sta.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
  &#039;&#039;&#039;If the reader is already familiar with &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, they may choose to skip ahead to the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui-sta.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui-sta.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of MATLAB and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui-sta.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and MATLAB (remember that the indexing for your system starts at 0 and for MATLAB at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui-sta.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
Place yourself in the &#039;./scripts&#039; directory. Then, simply move or copy the downloaded wild card script and open it via&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
 open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that all the scripts needed for the StA section have been moved already to the scripts folder.&lt;br /&gt;
&lt;br /&gt;
Within the script, ensure you have updated the environment parameters and paths as necessary. Remember, a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or &#039;&#039;&#039;NaN&#039;&#039;&#039; will precede the lines that require your input. Consider establishing a global variable for consistent use throughout the subsequent scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
 a      = dread(aPath);&lt;br /&gt;
 dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project-sta.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
Let us start by preparing the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
re style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
prepare_average_for_chimera(pr_0)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This function will simply filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera-sta.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera-sta.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer-sta.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-reference-center-gui-sta.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From here, copy and open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering-sta.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
Each project will take about 1 hour 30 min (estimation with 8 gpus). To directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_1{idx} &#039;:as:ite=last&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average-sta.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_average.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. Launch the project by typing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run aligment_for_average.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages-sta.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; procedure, allows for candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script second_aligment_per_tomogram.m There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let us now begin with the hands-on portion of the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open second_aligment_per_tomogram&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before cropping the particles, let us visualize the merged table generated containing the candidate positions before and after subboxing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run second_aligment_per_tomogram.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [root &#039;/catalogue/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
idx = 1;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([pr_1{idx} &#039;:rt&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl-sta.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
We can complete the rest of the script. So, next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). To actually compute the cropping of the particles and the corresponding alignment projects:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_2{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average-sta.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results add the following lines in the loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tips:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue”&amp;gt;You can activate the interactive mode by adding a `keyboard` command in your script, then type in your visualization on the terminal.&lt;br /&gt;
To terminate debug mode and continue execution, use the dbcont command.&lt;br /&gt;
To terminate debug mode and exit the file without completing execution, use the dbquit command.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly to the subboxing section, is interesting to see how the filtering strategy worked. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run coarse_gold_standard_alignment.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification-sta.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference-sta.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration-sta.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, if you have already completed the task filling in the missing parts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aEPath = ddb([pr_EO{1} &#039;:as&#039;]);&lt;br /&gt;
aOPath = ddb([pr_EO{2} &#039;:as&#039;]);&lt;br /&gt;
dshow([dread(aEPath); dread(aOPath)])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps-sta.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration-sta.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask-sta.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus). Launch it via:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run refined_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects.&lt;br /&gt;
&lt;br /&gt;
[[File:final-sta-result-from-refined-gold-standard-sta.png|centre|thumb|600px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;, top left.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to RELION convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, RELION will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera-sta.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this walktrough the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO2.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;half2.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_Sharpen2.png|centre|thumb|600px| RELION Post-process I/O sharpen with automatic B-factor estimation.]]&lt;br /&gt;
[[File:Post_process_Running2.png|centre|thumb|600px| RELION Post-process I/O running with forced mask.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A, force RELION to use your FSC mask and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RELION will compute the FSC curves of the two half map with and without the FSC mask and then will select the best curve to correct and select for the final resolution estimation. It is sometimes the case, especially for membrane protein, that the unmasked FSC will be completely artefactual and this can cause problem for the RELION final resolution estimation. In these cases, RELION will suggest to force the usage of the FSC mask by the &#039;--force_mask&#039; option.&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the resolution even further. However, in this workflow, only the basic RELION steps will be exploited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open the RELION4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click on the RELION4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO_v2.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:RELION_reconstruct_Running.png|centre|thumb|600px| RELION Tomo reconstruct particle running field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make pseudo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make pseudo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make pseudo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make pseudo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make pseudo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_Running.png|centre|thumb|600px| RELION Make pseudo-subtomos running field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here but will not be done because of time limitations. This step took 40h on 8 GPUs and the computed results are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here are some notes on the chosen parameters:&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION requires a certain number of mpi processes to be defined in the Running tab. In the example, by setting 8 GPUs in the compute tab, we require 9 mpi processes: 4 for the even particles, 4 for the odd particles and one mpi master process.&amp;lt;br&amp;gt;&lt;br /&gt;
- By default RELION uses all of the GPU memory available.  GPU device memory (in Mb) to leave free after allocation can be set with the flag --free_gpu_memory.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
[[File:RELION_refine_Reference.png|centre|thumb|600px| RELION 3D auto-refine reference field. Note the low-pass and the symmetry.]]&lt;br /&gt;
[[File:RELION_refine_CTF.png|centre|thumb|600px| RELION 3D auto-refine CTF field.]]&lt;br /&gt;
[[File:RELION_refine_optimisation.png|centre|thumb|600px| RELION 3D auto-refine optimisation field. Note the mask diameter.]]&lt;br /&gt;
[[File:RELION_refine_autosampling.png|centre|thumb|600px| RELION 3D auto-refine auto-sampling field.]]&lt;br /&gt;
[[File:RELION_refine_compute.png|centre|thumb|600px| RELION 3D auto-refine compute field. Note that the ids of the GPUs are separated by the colon symbol &amp;quot;:&amp;quot;.]]&lt;br /&gt;
[[File:RELION_refine_Running.png|centre|thumb|600px| RELION 3D auto-refine running field. Note the number of mpi processes is one more than the number of GPUs]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprocessed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION FSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=High_resolution_walkthrough_with_HIV1&amp;diff=5002</id>
		<title>High resolution walkthrough with HIV1</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=High_resolution_walkthrough_with_HIV1&amp;diff=5002"/>
		<updated>2024-03-06T11:23:35Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Extraction of coarse half maps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Goal of the walktrough =&lt;br /&gt;
&lt;br /&gt;
This walktrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this walktrough.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Structure of the walkthrough =&lt;br /&gt;
&lt;br /&gt;
The full HIV1 walkthrough pipeline has been split into multiple sequential steps. Each of these steps corresponds to a subsection of this wiki page. It is possible to reach an average with about ~4 A of resolution starting from 5 tilt series by following all of the steps described in this walkthrough. The only exception is the process to create a tilt series from the microscope movies, which is only discussed in the &amp;quot;Motion correction and dose weighting&amp;quot; subsection.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
However, depending on the hardware available, a full execution of this pipeline can easily take a week of computing time. Additionally, the generated data consumes considerable amounts of memory resources. As such, this walkthrough is has been constructed to be scalable. The full version of the walkthrough code package is divided into two sections: scripts and data. The following figure represents the package tree. The data part includes all of the pre-computed intermediate files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Folder_structure_HIV1_v2.png|centre|thumb|800px| Structure of package containing the data and scripts for the HIV1 walktrough. The full version of the &#039;data&#039; part of the package is 2.2 TB. The &#039;scripts&#039; part is divided into steps. Note the correspondence between the folder names and the subsection names in this wiki page. Each step folder is divided into three parts: inputs, outputs and scripts. The input contains a set of paths to the where the input data is meant to be found in the &#039;data&#039; part of the package. The output contains a set of path of where the generated files of this step should be moved to. The scripts includes the MATLAB codes that will be executed following the practical notes in the wiki page.]]&lt;br /&gt;
&lt;br /&gt;
There are two main approaches on the implementation of walktrough with different scales of memory and computing resource requirements: with pre-computations or full execution. The two approaches are described in the following tables.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! with pre-computations&lt;br /&gt;
|-&lt;br /&gt;
| Requires an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Does not require large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for in-person workshop.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section has been made available from a physical memory.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The script generally do not need modification.&lt;br /&gt;
|-&lt;br /&gt;
| By default most scripts process only one tilt series. This is done to save computing time.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! full execution&lt;br /&gt;
|-&lt;br /&gt;
| Does not require an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Requires large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for individual practical use.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section starts has mostly empty. The &#039;data&#039; section can be downloaded from https://drive.google.com/file/d/1k4bLLswsacYdIGcNRc76YcbAiycxyPuX/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts will need modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts need to be modified to process all of the tilt series. The scripts are already structured to simplify the needed modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section. As such, the &#039;data&#039; section needs to be filled with the outputs of the scripts after each step.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As mentioned previously, the &amp;quot;full-execution&amp;quot; approach requires some limited script modifications. The MATLAB scripts have been generally structured so as to present three parts. The first part consists of the paths to the input and output files. The second part is the section of parameters. The third part is a for loop on the input tilt series. As such, the typical modifications necessary for the &amp;quot;full-execution&amp;quot; approach are limited to the first part, ensuring that the inputs for all five tilt series are given.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Additionally, in the &amp;quot;full-execution&amp;quot; approach, the results of the scripts are used to populate the empty &#039;data&#039; section so that the following scripts may be able to access their input files. This means that the files need to be positioned in the correct folder tree location and with a consistent file name. To help with this process, each step has an output text file in its folder with the path and file names that need to be applied to ensure consistency.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+ Time requirements for each step&lt;br /&gt;
|-&lt;br /&gt;
! Step !! Computing time !! Interactive time !! Workshop time !! Notes&lt;br /&gt;
|-&lt;br /&gt;
! Recovery of acquisition parameters &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 5 min &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! Motion correction &lt;br /&gt;
| 1 min per tilt series with GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Not done in this walkthrough&lt;br /&gt;
|-&lt;br /&gt;
! CTF estimation &lt;br /&gt;
| 5 min for all tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using CTFFIND4&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: alignment &lt;br /&gt;
| 8 min per tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: dose weighting &lt;br /&gt;
| 3 min &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default on all tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: CTF correction &lt;br /&gt;
| 1 hour 30 min per tilt series without GPU, 5 min per tilt series with 1 GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using IMOD, executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: tomogram reconstruction &lt;br /&gt;
| 12 min per tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: preparation and management of data &lt;br /&gt;
| 5 min &lt;br /&gt;
| 3 min &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: particle picking &lt;br /&gt;
| - &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| 10 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: particle extraction &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: creation of initial reference &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of first per tomogram average &lt;br /&gt;
| 15 min (CPU) + 1 hour 30 min (8 GPUs) per tilt series &lt;br /&gt;
| 15 min &lt;br /&gt;
| 15 min &lt;br /&gt;
| Use of UCSF Chimera&lt;br /&gt;
|-&lt;br /&gt;
! StA: computing an average of averages &lt;br /&gt;
| 15 min (CPU) &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of second per tomogram average &lt;br /&gt;
| 30 min (CPU) + 3 hours 30 min (8 GPUs) per tilt series &lt;br /&gt;
| 25 min &lt;br /&gt;
| 15 min &lt;br /&gt;
| Use of UCSF Chimera&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of coarse half maps &lt;br /&gt;
| 22 min (CPU) + 48 hours (8 GPUs) &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of refined half maps &lt;br /&gt;
| 1 hour (CPU) + 24 hours (8 GPUs) + 1 hour (CPU) per tilt series &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! FSC computation &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 15 min &lt;br /&gt;
| Using RELION&lt;br /&gt;
|-&lt;br /&gt;
! RELION conversion &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 5 min &lt;br /&gt;
| Using RELION&lt;br /&gt;
|-&lt;br /&gt;
! RELION refinement &lt;br /&gt;
| &amp;gt;40 hours using 8 GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using RELION, split into generation of a RELION template (~1h), extraction of RELION particles (~1h) and then the execution of the RELION refinement&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
= Recovery of acquisition parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the walktrough are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file of a K3 detector inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the links:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
https://relion.readthedocs.io/en/release-3.1/Reference/MovieCompression.html&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the gain correction.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been designed for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this walkthrough after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following walkthrough are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a MATLAB script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags. Note also that if Motioncorr2 cannot find or use the gain file provided, it will not terminate the motion correction and will instead continue computing without gain correction.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, CTFFIND4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, CTFFIND4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal. Note that the CTFFIND4 wrapper has been created for CTFfind version 4.1.5. Using a different CTFfind version may require some limited modifications of the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the CTFFIND4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the CTFFIND4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;change line 178 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD. The tested version of IMOD is 4.11.12.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the line 26 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Note that the reconstruction of a full-size tomogram is resource intensive, especially in memory. In this case, the expected size of a single tomogram is about 100 GB.&amp;lt;/pre&amp;gt; All the tomograms have been pre-computed and stored in the data folder. If you wish to backproject a tomogram it may be done by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GUI will pop up as soon as the catalog &#039;c000.ctlg&#039; is called via   &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dcm c000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create the binned version of the tomogram selecting a factor of 2. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-create-pre-binned-dmmpp.png|centre|thumb|600px| Creation of tomograms binned versions using &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, these versions will be saved inside the folder of the tomograms, not inside the catalogue folder.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow-sta.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
  &#039;&#039;&#039;If the reader is already familiar with &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, they may choose to skip ahead to the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui-sta.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui-sta.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of MATLAB and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui-sta.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and MATLAB (remember that the indexing for your system starts at 0 and for MATLAB at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui-sta.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
Place yourself in the &#039;./scripts&#039; directory. Then, simply move or copy the downloaded wild card script and open it via&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
 open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that all the scripts needed for the StA section have been moved already to the scripts folder.&lt;br /&gt;
&lt;br /&gt;
Within the script, ensure you have updated the environment parameters and paths as necessary. Remember, a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or &#039;&#039;&#039;NaN&#039;&#039;&#039; will precede the lines that require your input. Consider establishing a global variable for consistent use throughout the subsequent scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
 a      = dread(aPath);&lt;br /&gt;
 dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project-sta.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
Let us start by preparing the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
re style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
prepare_average_for_chimera(pr_0)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This function will simply filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera-sta.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera-sta.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer-sta.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-reference-center-gui-sta.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From here, copy and open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering-sta.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
Each project will take about 1 hour 30 min (estimation with 8 gpus). To directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_1{idx} &#039;:as:ite=last&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average-sta.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_average.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. Launch the project by typing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run aligment_for_average.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages-sta.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; procedure, allows for candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script second_aligment_per_tomogram.m There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let us now begin with the hands-on portion of the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open second_aligment_per_tomogram&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before cropping the particles, let us visualize the merged table generated containing the candidate positions before and after subboxing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run second_aligment_per_tomogram.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [root &#039;/catalogue/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
idx = 1;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([pr_1{idx} &#039;:rt&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl-sta.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
We can complete the rest of the script. So, next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). To actually compute the cropping of the particles and the corresponding alignment projects:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_2{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average-sta.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results add the following lines in the loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tips:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue”&amp;gt;You can activate the interactive mode by adding a `keyboard` command in your script, then type in your visualization commands there.&lt;br /&gt;
To terminate debug mode and continue execution, use the dbcont command.&lt;br /&gt;
To terminate debug mode and exit the file without completing execution, use the dbquit command.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly to the subboxing section, is interesting to see how the filtering strategy worked. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run coarse_gold_standard_alignment.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification-sta.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference-sta.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration-sta.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, if you have already completed the task filling in the missing parts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aEPath = ddb([pr_EO{1} &#039;:as&#039;]);&lt;br /&gt;
aOPath = ddb([pr_EO{2} &#039;:as&#039;]);&lt;br /&gt;
dshow([dread(aEPath); dread(aOPath)])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps-sta.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration-sta.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask-sta.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus). Launch it via:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run refined_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects.&lt;br /&gt;
&lt;br /&gt;
[[File:final-sta-result-from-refined-gold-standard-sta.png|centre|thumb|600px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;, top left.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to RELION convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, RELION will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera-sta.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this walktrough the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO2.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;half2.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_Sharpen2.png|centre|thumb|600px| RELION Post-process I/O sharpen with automatic B-factor estimation.]]&lt;br /&gt;
[[File:Post_process_Running2.png|centre|thumb|600px| RELION Post-process I/O running with forced mask.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A, force RELION to use your FSC mask and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RELION will compute the FSC curves of the two half map with and without the FSC mask and then will select the best curve to correct and select for the final resolution estimation. It is sometimes the case, especially for membrane protein, that the unmasked FSC will be completely artefactual and this can cause problem for the RELION final resolution estimation. In these cases, RELION will suggest to force the usage of the FSC mask by the &#039;--force_mask&#039; option.&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the resolution even further. However, in this workflow, only the basic RELION steps will be exploited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open the RELION4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click on the RELION4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO_v2.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:RELION_reconstruct_Running.png|centre|thumb|600px| RELION Tomo reconstruct particle running field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make pseudo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make pseudo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make pseudo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make pseudo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make pseudo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_Running.png|centre|thumb|600px| RELION Make pseudo-subtomos running field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here but will not be done because of time limitations. This step took 40h on 8 GPUs and the computed results are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here are some notes on the chosen parameters:&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION requires a certain number of mpi processes to be defined in the Running tab. In the example, by setting 8 GPUs in the compute tab, we require 9 mpi processes: 4 for the even particles, 4 for the odd particles and one mpi master process.&amp;lt;br&amp;gt;&lt;br /&gt;
- By default RELION uses all of the GPU memory available.  GPU device memory (in Mb) to leave free after allocation can be set with the flag --free_gpu_memory.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
[[File:RELION_refine_Reference.png|centre|thumb|600px| RELION 3D auto-refine reference field. Note the low-pass and the symmetry.]]&lt;br /&gt;
[[File:RELION_refine_CTF.png|centre|thumb|600px| RELION 3D auto-refine CTF field.]]&lt;br /&gt;
[[File:RELION_refine_optimisation.png|centre|thumb|600px| RELION 3D auto-refine optimisation field. Note the mask diameter.]]&lt;br /&gt;
[[File:RELION_refine_autosampling.png|centre|thumb|600px| RELION 3D auto-refine auto-sampling field.]]&lt;br /&gt;
[[File:RELION_refine_compute.png|centre|thumb|600px| RELION 3D auto-refine compute field. Note that the ids of the GPUs are separated by the colon symbol &amp;quot;:&amp;quot;.]]&lt;br /&gt;
[[File:RELION_refine_Running.png|centre|thumb|600px| RELION 3D auto-refine running field. Note the number of mpi processes is one more than the number of GPUs]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprocessed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION FSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=High_Resolution_workflow_for_HIV1_(SciLifeLab_2023)&amp;diff=5001</id>
		<title>High Resolution workflow for HIV1 (SciLifeLab 2023)</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=High_Resolution_workflow_for_HIV1_(SciLifeLab_2023)&amp;diff=5001"/>
		<updated>2024-03-05T15:55:14Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Subtomogram averaging */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Goal  =&lt;br /&gt;
&lt;br /&gt;
This walkthrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this workshop.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Recovery of experiments parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the workshop are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the link:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the dose weighting.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been deigned for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this workshop after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following workshop are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a Matlab script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, ctffind4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, ctffind4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find thye ctffind4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the ctffind4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;change line 179 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the line 24 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Launch the reconstruction by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GUI will pop up as soon as the catalog &#039;c000.ctlg&#039; is called via   &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dcm c000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create the binned version of the tomogram selecting a factor of 2. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-create-pre-binned-dmmpp.png|centre|thumb|600px| Creation of tomograms binned versions using &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, these versions will be saved inside the folder of the tomograms, not inside the catalogue folder.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow-sta.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
  &#039;&#039;&#039;If the reader is already familiar with &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, they may choose to skip ahead to the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui-sta.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui-sta.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of MATLAB and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui-sta.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and MATLAB (remember that the indexing for your system starts at 0 and for MATLAB at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui-sta.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
Place yourself in the &#039;./scripts&#039; directory. Then, simply move or copy the downloaded wild card script and open it via&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
 open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that all the scripts needed for the StA section have been moved already to the scripts folder.&lt;br /&gt;
&lt;br /&gt;
Within the script, ensure you have updated the environment parameters and paths as necessary. Remember, a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or &#039;&#039;&#039;NaN&#039;&#039;&#039; will precede the lines that require your input. Consider establishing a global variable for consistent use throughout the subsequent scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
 a      = dread(aPath);&lt;br /&gt;
 dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project-sta.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
Let us start by preparing the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
re style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
prepare_average_for_chimera(pr_0)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This function will simply filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera-sta.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera-sta.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer-sta.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-reference-center-gui-sta.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From here, copy and open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering-sta.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
Each project will take about 1 hour 30 min (estimation with 8 gpus). To directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_1{idx} &#039;:as:ite=last&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average-sta.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_average.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. Launch the project by typing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run aligment_for_average.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages-sta.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; procedure, allows for candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script second_aligment_per_tomogram.m There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let us now begin with the hands-on portion of the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open second_aligment_per_tomogram&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before cropping the particles, let us visualize the merged table generated containing the candidate positions before and after subboxing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run second_aligment_per_tomogram.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [root &#039;/catalogue/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
idx = 1;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([pr_1{idx} &#039;:rt&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl-sta.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
We can complete the rest of the script. So, next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). To actually compute the cropping of the particles and the corresponding alignment projects:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_2{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average-sta.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results add the following lines in the loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to the subboxing section, is interesting to see how the filtering strategy worked. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run coarse_gold_standard_alignment.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification-sta.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference-sta.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration-sta.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, if you have already completed the task filling in the missing parts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aEPath = ddb([pr_EO{1} &#039;:as&#039;]);&lt;br /&gt;
aOPath = ddb([pr_EO{2} &#039;:as&#039;]);&lt;br /&gt;
dshow([dread(aEPath); dread(aOPath)])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps-sta.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration-sta.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask-sta.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus). Launch it via:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run refined_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects.&lt;br /&gt;
&lt;br /&gt;
[[File:final-sta-result-from-refined-gold-standard-sta.png|centre|thumb|600px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;, top left.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to RELION convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, RELION will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera-sta.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this workshop the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;run_half2_class001_unfil.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_sharpen.png|centre|thumb|600px| RELION Post-process I/O sharped with automatic B-factor estimation.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the reolsution even further. However, in this workflow, only the basic RELION steps will be expoited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open the relion4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click on the relion4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make psuedo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make psuedo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make psuedo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here put will not be done because of time limitations. This step took 18h on 8 GPUs and the computed reusults are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprossed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION TSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=High_Resolution_workflow_for_HIV1_(SciLifeLab_2023)&amp;diff=5000</id>
		<title>High Resolution workflow for HIV1 (SciLifeLab 2023)</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=High_Resolution_workflow_for_HIV1_(SciLifeLab_2023)&amp;diff=5000"/>
		<updated>2024-03-05T15:54:51Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Dynamo models and particles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Goal  =&lt;br /&gt;
&lt;br /&gt;
This walkthrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this workshop.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Recovery of experiments parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the workshop are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the link:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the dose weighting.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been deigned for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this workshop after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following workshop are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a Matlab script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, ctffind4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, ctffind4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find thye ctffind4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the ctffind4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;change line 179 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the line 24 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Launch the reconstruction by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GUI will pop up as soon as the catalog &#039;c000.ctlg&#039; is called via   &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dcm c000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create the binned version of the tomogram selecting a factor of 2. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-create-pre-binned-dmmpp.png|centre|thumb|600px| Creation of tomograms binned versions using &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, these versions will be saved inside the folder of the tomograms, not inside the catalogue folder.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of Matlab and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and Matlab (remember that the indexing for your system starts at 0 and for Matlab at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
For creating the initial reference, open the script &amp;lt;code&amp;gt;aligment_for_reference.m&amp;lt;/code&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Make sure you have changed the environment parameters and paths. You may want to create a global variable for the rest of the scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As explained previously, the last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
a      = dread(aPath);&lt;br /&gt;
dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
First, prepare the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_0) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chiera-reference-center-gui.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
From here, open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script and, as usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open first_aligment_per_tomogram.m &lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Since each project will take about 1 hour 30 min (estimation with 8 gpus), the script instead of computing the average itself will gather the precomputed results. Make sure to change the paths if you do not want them to be copied in your workspace, else, directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prTs = &#039;pr_ts_all_1&#039;;&lt;br /&gt;
aPaths = ddb([prTs &#039;:as:ite=last:ref=*&#039;]);&lt;br /&gt;
&lt;br /&gt;
aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = aPaths{idx};&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_reference.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; a With this procedure, candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script &amp;lt;code&amp;gt;second_aligment_per_tomogram.m&amp;lt;/code&amp;gt;. There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Now, let us visualize the merged table generated containing the candidate positions before and after subboxing. About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [pathToSharedStorage &#039;/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([&#039;pr_ts_all_1:rt:ite=last:ref=1&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). Therefore, to fit the schedule, when launching the script, the pre-computed results will be obtained:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prTs = &#039;pr_ts_all_2&#039;;&lt;br /&gt;
aPaths = ddb([prTs &#039;:as:ite=last:ref=*&#039;]);&lt;br /&gt;
&lt;br /&gt;
aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = aPaths{idx};&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tips:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;To terminate debug mode and continue execution, use the dbcont command.&lt;br /&gt;
To terminate debug mode and exit the file without completing execution, use the dbquit command.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, as expected, the files simulating the full execution of the script will be copied to the workspace you are working on when launching it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prEO = &#039;pr_EO&#039;;&lt;br /&gt;
aPaths = ddb([prEO &#039;:as:ite=last:ref=*&#039;]);&lt;br /&gt;
dshow([dread(aPaths{1}); dread(aPaths{2})])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects. The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus).&lt;br /&gt;
&lt;br /&gt;
[[File:final-result-from-refined-gold-standard-sta.png|centre|thumb|550px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to Relion convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, Relion will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this workshop the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;run_half2_class001_unfil.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_sharpen.png|centre|thumb|600px| RELION Post-process I/O sharped with automatic B-factor estimation.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the reolsution even further. However, in this workflow, only the basic RELION steps will be expoited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open the relion4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click on the relion4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make psuedo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make psuedo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make psuedo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here put will not be done because of time limitations. This step took 18h on 8 GPUs and the computed reusults are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprossed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION TSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=HIV1_Walkthrough_(PSI_2023)&amp;diff=4999</id>
		<title>HIV1 Walkthrough (PSI 2023)</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=HIV1_Walkthrough_(PSI_2023)&amp;diff=4999"/>
		<updated>2024-03-05T15:53:51Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Subtomogram averaging */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Goal  =&lt;br /&gt;
&lt;br /&gt;
This walkthrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this workshop.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Recovery of experiments parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the workshop are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the link:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the dose weighting.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been deigned for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this workshop after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following workshop are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a Matlab script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, ctffind4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, ctffind4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find thye ctffind4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the ctffind4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;change line 179 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the line 24 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Launch the reconstruction by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GUI will pop up as soon as the catalog &#039;c000.ctlg&#039; is called via   &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dcm c000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create the binned version of the tomogram selecting a factor of 2. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-create-pre-binned-dmmpp.png|centre|thumb|600px| Creation of tomograms binned versions using &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, these versions will be saved inside the folder of the tomograms, not inside the catalogue folder.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow-sta.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
  &#039;&#039;&#039;If the reader is already familiar with &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, they may choose to skip ahead to the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui-sta.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui-sta.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of MATLAB and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui-sta.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and MATLAB (remember that the indexing for your system starts at 0 and for MATLAB at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui-sta.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
Place yourself in the &#039;./scripts&#039; directory. Then, simply move or copy the downloaded wild card script and open it via&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
 open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that all the scripts needed for the StA section have been moved already to the scripts folder.&lt;br /&gt;
&lt;br /&gt;
Within the script, ensure you have updated the environment parameters and paths as necessary. Remember, a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or &#039;&#039;&#039;NaN&#039;&#039;&#039; will precede the lines that require your input. Consider establishing a global variable for consistent use throughout the subsequent scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
 a      = dread(aPath);&lt;br /&gt;
 dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project-sta.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
Let us start by preparing the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
re style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
prepare_average_for_chimera(pr_0)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This function will simply filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera-sta.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera-sta.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer-sta.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-reference-center-gui-sta.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From here, copy and open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering-sta.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
Each project will take about 1 hour 30 min (estimation with 8 gpus). To directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_1{idx} &#039;:as:ite=last&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average-sta.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_average.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. Launch the project by typing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run aligment_for_average.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages-sta.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; procedure, allows for candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script second_aligment_per_tomogram.m There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let us now begin with the hands-on portion of the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open second_aligment_per_tomogram&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before cropping the particles, let us visualize the merged table generated containing the candidate positions before and after subboxing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run second_aligment_per_tomogram.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [root &#039;/catalogue/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
idx = 1;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([pr_1{idx} &#039;:rt&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl-sta.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
We can complete the rest of the script. So, next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). To actually compute the cropping of the particles and the corresponding alignment projects:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_2{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average-sta.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results add the following lines in the loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to the subboxing section, is interesting to see how the filtering strategy worked. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run coarse_gold_standard_alignment.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification-sta.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference-sta.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration-sta.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, if you have already completed the task filling in the missing parts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aEPath = ddb([pr_EO{1} &#039;:as&#039;]);&lt;br /&gt;
aOPath = ddb([pr_EO{2} &#039;:as&#039;]);&lt;br /&gt;
dshow([dread(aEPath); dread(aOPath)])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps-sta.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration-sta.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask-sta.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus). Launch it via:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run refined_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects.&lt;br /&gt;
&lt;br /&gt;
[[File:final-sta-result-from-refined-gold-standard-sta.png|centre|thumb|600px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;, top left.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to RELION convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, RELION will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera-sta.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this workshop the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;run_half2_class001_unfil.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_sharpen.png|centre|thumb|600px| RELION Post-process I/O sharped with automatic B-factor estimation.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the reolsution even further. However, in this workflow, only the basic RELION steps will be expoited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open the relion4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click on the relion4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make psuedo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make psuedo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make psuedo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here put will not be done because of time limitations. This step took 18h on 8 GPUs and the computed reusults are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprossed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION TSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=HIV1_Walkthrough_(PSI_2023)&amp;diff=4998</id>
		<title>HIV1 Walkthrough (PSI 2023)</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=HIV1_Walkthrough_(PSI_2023)&amp;diff=4998"/>
		<updated>2024-03-05T15:53:32Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Dynamo models and particles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Goal  =&lt;br /&gt;
&lt;br /&gt;
This walkthrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this workshop.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Recovery of experiments parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the workshop are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the link:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the dose weighting.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been deigned for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this workshop after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following workshop are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a Matlab script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, ctffind4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, ctffind4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find thye ctffind4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the ctffind4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;change line 179 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the line 24 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Launch the reconstruction by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GUI will pop up as soon as the catalog &#039;c000.ctlg&#039; is called via   &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dcm c000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create the binned version of the tomogram selecting a factor of 2. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-create-pre-binned-dmmpp.png|centre|thumb|600px| Creation of tomograms binned versions using &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, these versions will be saved inside the folder of the tomograms, not inside the catalogue folder.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of Matlab and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and Matlab (remember that the indexing for your system starts at 0 and for Matlab at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
For creating the initial reference, open the script &amp;lt;code&amp;gt;aligment_for_reference.m&amp;lt;/code&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Make sure you have changed the environment parameters and paths. You may want to create a global variable for the rest of the scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As explained previously, the last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
a      = dread(aPath);&lt;br /&gt;
dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
First, prepare the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_0) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chiera-reference-center-gui.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
From here, open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script and, as usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open first_aligment_per_tomogram.m &lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Since each project will take about 1 hour 30 min (estimation with 8 gpus), the script instead of computing the average itself will gather the precomputed results. Make sure to change the paths if you do not want them to be copied in your workspace, else, directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prTs = &#039;pr_ts_all_1&#039;;&lt;br /&gt;
aPaths = ddb([prTs &#039;:as:ite=last:ref=*&#039;]);&lt;br /&gt;
&lt;br /&gt;
aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = aPaths{idx};&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_reference.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; a With this procedure, candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script &amp;lt;code&amp;gt;second_aligment_per_tomogram.m&amp;lt;/code&amp;gt;. There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Now, let us visualize the merged table generated containing the candidate positions before and after subboxing. About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [pathToSharedStorage &#039;/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([&#039;pr_ts_all_1:rt:ite=last:ref=1&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). Therefore, to fit the schedule, when launching the script, the pre-computed results will be obtained:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prTs = &#039;pr_ts_all_2&#039;;&lt;br /&gt;
aPaths = ddb([prTs &#039;:as:ite=last:ref=*&#039;]);&lt;br /&gt;
&lt;br /&gt;
aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = aPaths{idx};&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tips:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;To terminate debug mode and continue execution, use the dbcont command.&lt;br /&gt;
To terminate debug mode and exit the file without completing execution, use the dbquit command.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, as expected, the files simulating the full execution of the script will be copied to the workspace you are working on when launching it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prEO = &#039;pr_EO&#039;;&lt;br /&gt;
aPaths = ddb([prEO &#039;:as:ite=last:ref=*&#039;]);&lt;br /&gt;
dshow([dread(aPaths{1}); dread(aPaths{2})])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects. The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus).&lt;br /&gt;
&lt;br /&gt;
[[File:final-result-from-refined-gold-standard-sta.png|centre|thumb|550px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to Relion convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, Relion will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this workshop the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;run_half2_class001_unfil.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_sharpen.png|centre|thumb|600px| RELION Post-process I/O sharped with automatic B-factor estimation.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the reolsution even further. However, in this workflow, only the basic RELION steps will be expoited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open the relion4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click on the relion4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make psuedo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make psuedo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make psuedo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here put will not be done because of time limitations. This step took 18h on 8 GPUs and the computed reusults are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprossed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION TSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=Compact_HIV1_walkthrough_(PSI_2023)&amp;diff=4997</id>
		<title>Compact HIV1 walkthrough (PSI 2023)</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=Compact_HIV1_walkthrough_(PSI_2023)&amp;diff=4997"/>
		<updated>2024-03-05T15:15:55Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Preparation and management of data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= The compact version of the HIV1 walkthrough  =&lt;br /&gt;
&lt;br /&gt;
The compact version of the HIV1 walkthrough is meant to be a faster and less resource requiring version of the HIV1 walkthrough.&lt;br /&gt;
&lt;br /&gt;
The main scripts of the workshop will not be run, but only inspected. The script have already been run and their output has already been generated. As such, only the inspection of the results will be done. This will render the precess faster since no computing time will be required.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;As such, do NOT do the step highlighted in red. Only do the steps highlighted in blue&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Software that would have been used for the full HIV1 walkthrough can be loaded in the PSI setup with:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
module load ctffind4/4.1.14&lt;br /&gt;
&lt;br /&gt;
module load IMOD/4.9.5&lt;br /&gt;
&lt;br /&gt;
module load relion/4.0.1&lt;br /&gt;
&lt;br /&gt;
Chimera will also be used but it is best to use a local Chimera installation and download the the density maps you wish to inspect on the local machine.&lt;br /&gt;
&lt;br /&gt;
= Goal  =&lt;br /&gt;
&lt;br /&gt;
This walkthrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this workshop.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Recovery of experiments parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the workshop are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the link:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the dose weighting.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been deigned for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this workshop after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following workshop are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a Matlab script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, ctffind4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, ctffind4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find thye ctffind4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the ctffind4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;change line 179 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since this is the lightweight version of the HIV1 walkthrough, the script make_AWF.m has not been run. This means that the AWF result structure is not yet in the MATLAB workspace. You can load it by:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u = dtsa(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the line 24 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Launch the reconstruction by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
The binned version of the tomogram is already computed. The factor selected was 2. In any case, these versions will be saved inside the folder of the tomograms, not inside the catalogue.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow-sta.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
  &#039;&#039;&#039;If the reader is already familiar with &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, they may choose to skip ahead to the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui-sta.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui-sta.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of MATLAB and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui-sta.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and MATLAB (remember that the indexing for your system starts at 0 and for MATLAB at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui-sta.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
Place yourself in the &#039;./scripts&#039; directory. Then, simply move or copy the downloaded wild card script and open it via&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
 open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that all the scripts needed for the StA section have been moved already to the scripts folder.&lt;br /&gt;
&lt;br /&gt;
Within the script, ensure you have updated the environment parameters and paths as necessary. Remember, a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or &#039;&#039;&#039;NaN&#039;&#039;&#039; will precede the lines that require your input. Consider establishing a global variable for consistent use throughout the subsequent scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
 a      = dread(aPath);&lt;br /&gt;
 dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project-sta.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
Let us start by preparing the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
re style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
prepare_average_for_chimera(pr_0)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This function will simply filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera-sta.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera-sta.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer-sta.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-reference-center-gui-sta.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From here, copy and open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering-sta.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
Each project will take about 1 hour 30 min (estimation with 8 gpus). To directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_1{idx} &#039;:as:ite=last&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average-sta.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_average.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. Launch the project by typing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run aligment_for_average.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages-sta.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; procedure, allows for candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script second_aligment_per_tomogram.m There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let us now begin with the hands-on portion of the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open second_aligment_per_tomogram&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before cropping the particles, let us visualize the merged table generated containing the candidate positions before and after subboxing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run second_aligment_per_tomogram.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [root &#039;/catalogue/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
idx = 1;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([pr_1{idx} &#039;:rt&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl-sta.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
We can complete the rest of the script. So, next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). To actually compute the cropping of the particles and the corresponding alignment projects:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_2{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average-sta.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results add the following lines in the loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to the subboxing section, is interesting to see how the filtering strategy worked. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run coarse_gold_standard_alignment.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification-sta.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference-sta.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration-sta.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, if you have already completed the task filling in the missing parts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aEPath = ddb([pr_EO{1} &#039;:as&#039;]);&lt;br /&gt;
aOPath = ddb([pr_EO{2} &#039;:as&#039;]);&lt;br /&gt;
dshow([dread(aEPath); dread(aOPath)])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps-sta.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration-sta.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask-sta.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus). Launch it via:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run refined_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects.&lt;br /&gt;
&lt;br /&gt;
[[File:final-sta-result-from-refined-gold-standard-sta.png|centre|thumb|600px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;, top left.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to RELION convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, RELION will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera-sta.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this workshop the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root and go to a personal workplace folder&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;run_half2_class001_unfil.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_sharpen.png|centre|thumb|600px| RELION Post-process I/O sharped with automatic B-factor estimation.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the pre-computed post-processed average with:&lt;br /&gt;
dshow(&#039;PostProcess/job171/postprocess.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and inspect the FSC curves by opening the file:&lt;br /&gt;
PostProcess/job171/logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the reolsution even further. However, in this workflow, only the basic RELION steps will be expoited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;open the relion4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Click on the relion4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make psuedo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make psuedo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make psuedo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here put will not be done because of time limitations. This step took 18h on 8 GPUs and the computed reusults are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprossed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION TSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=Compact_HIV1_walkthrough_(PSI_2023)&amp;diff=4996</id>
		<title>Compact HIV1 walkthrough (PSI 2023)</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=Compact_HIV1_walkthrough_(PSI_2023)&amp;diff=4996"/>
		<updated>2024-03-05T14:33:01Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Subtomogram averaging */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= The compact version of the HIV1 walkthrough  =&lt;br /&gt;
&lt;br /&gt;
The compact version of the HIV1 walkthrough is meant to be a faster and less resource requiring version of the HIV1 walkthrough.&lt;br /&gt;
&lt;br /&gt;
The main scripts of the workshop will not be run, but only inspected. The script have already been run and their output has already been generated. As such, only the inspection of the results will be done. This will render the precess faster since no computing time will be required.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;As such, do NOT do the step highlighted in red. Only do the steps highlighted in blue&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Software that would have been used for the full HIV1 walkthrough can be loaded in the PSI setup with:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
module load ctffind4/4.1.14&lt;br /&gt;
&lt;br /&gt;
module load IMOD/4.9.5&lt;br /&gt;
&lt;br /&gt;
module load relion/4.0.1&lt;br /&gt;
&lt;br /&gt;
Chimera will also be used but it is best to use a local Chimera installation and download the the density maps you wish to inspect on the local machine.&lt;br /&gt;
&lt;br /&gt;
= Goal  =&lt;br /&gt;
&lt;br /&gt;
This walkthrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this workshop.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Recovery of experiments parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the workshop are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the link:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the dose weighting.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been deigned for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this workshop after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following workshop are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a Matlab script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, ctffind4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, ctffind4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find thye ctffind4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the ctffind4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;change line 179 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since this is the lightweight version of the HIV1 walkthrough, the script make_AWF.m has not been run. This means that the AWF result structure is not yet in the MATLAB workspace. You can load it by:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u = dtsa(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the line 24 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Launch the reconstruction by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GUI will pop up as soon as the catalog &#039;c000.ctlg&#039; is called via   &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dcm c000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create the binned version of the tomogram selecting a factor of 2. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-create-pre-binned-dmmpp.png|centre|thumb|600px| Creation of tomograms binned versions using &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, these versions will be saved inside the folder of the tomograms, not inside the catalogue folder.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow-sta.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
  &#039;&#039;&#039;If the reader is already familiar with &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, they may choose to skip ahead to the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui-sta.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui-sta.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of MATLAB and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui-sta.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and MATLAB (remember that the indexing for your system starts at 0 and for MATLAB at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui-sta.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
Place yourself in the &#039;./scripts&#039; directory. Then, simply move or copy the downloaded wild card script and open it via&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
 open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that all the scripts needed for the StA section have been moved already to the scripts folder.&lt;br /&gt;
&lt;br /&gt;
Within the script, ensure you have updated the environment parameters and paths as necessary. Remember, a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or &#039;&#039;&#039;NaN&#039;&#039;&#039; will precede the lines that require your input. Consider establishing a global variable for consistent use throughout the subsequent scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
 a      = dread(aPath);&lt;br /&gt;
 dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project-sta.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
Let us start by preparing the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
re style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
prepare_average_for_chimera(pr_0)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This function will simply filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera-sta.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera-sta.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer-sta.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-reference-center-gui-sta.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From here, copy and open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering-sta.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
Each project will take about 1 hour 30 min (estimation with 8 gpus). To directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_1{idx} &#039;:as:ite=last&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average-sta.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_average.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. Launch the project by typing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run aligment_for_average.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages-sta.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; procedure, allows for candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script second_aligment_per_tomogram.m There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let us now begin with the hands-on portion of the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open second_aligment_per_tomogram&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before cropping the particles, let us visualize the merged table generated containing the candidate positions before and after subboxing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run second_aligment_per_tomogram.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [root &#039;/catalogue/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
idx = 1;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([pr_1{idx} &#039;:rt&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl-sta.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
We can complete the rest of the script. So, next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). To actually compute the cropping of the particles and the corresponding alignment projects:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_2{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average-sta.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results add the following lines in the loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to the subboxing section, is interesting to see how the filtering strategy worked. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run coarse_gold_standard_alignment.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification-sta.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference-sta.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration-sta.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, if you have already completed the task filling in the missing parts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aEPath = ddb([pr_EO{1} &#039;:as&#039;]);&lt;br /&gt;
aOPath = ddb([pr_EO{2} &#039;:as&#039;]);&lt;br /&gt;
dshow([dread(aEPath); dread(aOPath)])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps-sta.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration-sta.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask-sta.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus). Launch it via:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run refined_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects.&lt;br /&gt;
&lt;br /&gt;
[[File:final-sta-result-from-refined-gold-standard-sta.png|centre|thumb|600px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;, top left.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to RELION convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, RELION will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera-sta.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this workshop the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root and go to a personal workplace folder&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;run_half2_class001_unfil.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_sharpen.png|centre|thumb|600px| RELION Post-process I/O sharped with automatic B-factor estimation.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the pre-computed post-processed average with:&lt;br /&gt;
dshow(&#039;PostProcess/job171/postprocess.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and inspect the FSC curves by opening the file:&lt;br /&gt;
PostProcess/job171/logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the reolsution even further. However, in this workflow, only the basic RELION steps will be expoited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;open the relion4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Click on the relion4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make psuedo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make psuedo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make psuedo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here put will not be done because of time limitations. This step took 18h on 8 GPUs and the computed reusults are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprossed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION TSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=Compact_HIV1_walkthrough_(PSI_2023)&amp;diff=4995</id>
		<title>Compact HIV1 walkthrough (PSI 2023)</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=Compact_HIV1_walkthrough_(PSI_2023)&amp;diff=4995"/>
		<updated>2024-03-05T14:31:49Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Dynamo models and particles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= The compact version of the HIV1 walkthrough  =&lt;br /&gt;
&lt;br /&gt;
The compact version of the HIV1 walkthrough is meant to be a faster and less resource requiring version of the HIV1 walkthrough.&lt;br /&gt;
&lt;br /&gt;
The main scripts of the workshop will not be run, but only inspected. The script have already been run and their output has already been generated. As such, only the inspection of the results will be done. This will render the precess faster since no computing time will be required.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;As such, do NOT do the step highlighted in red. Only do the steps highlighted in blue&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Software that would have been used for the full HIV1 walkthrough can be loaded in the PSI setup with:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
module load ctffind4/4.1.14&lt;br /&gt;
&lt;br /&gt;
module load IMOD/4.9.5&lt;br /&gt;
&lt;br /&gt;
module load relion/4.0.1&lt;br /&gt;
&lt;br /&gt;
Chimera will also be used but it is best to use a local Chimera installation and download the the density maps you wish to inspect on the local machine.&lt;br /&gt;
&lt;br /&gt;
= Goal  =&lt;br /&gt;
&lt;br /&gt;
This walkthrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this workshop.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Recovery of experiments parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the workshop are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the link:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the dose weighting.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been deigned for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this workshop after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following workshop are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a Matlab script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, ctffind4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, ctffind4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find thye ctffind4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the ctffind4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;change line 179 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since this is the lightweight version of the HIV1 walkthrough, the script make_AWF.m has not been run. This means that the AWF result structure is not yet in the MATLAB workspace. You can load it by:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u = dtsa(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the line 24 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Launch the reconstruction by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GUI will pop up as soon as the catalog &#039;c000.ctlg&#039; is called via   &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dcm c000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create the binned version of the tomogram selecting a factor of 2. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-create-pre-binned-dmmpp.png|centre|thumb|600px| Creation of tomograms binned versions using &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, these versions will be saved inside the folder of the tomograms, not inside the catalogue folder.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt; You can skip this and go directly to Creation of initial reference.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of Matlab and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and Matlab (remember that the indexing for your system starts at 0 and for Matlab at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
For creating the initial reference, open the script &amp;lt;code&amp;gt;aligment_for_reference.m&amp;lt;/code&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; open aligment_for_reference_wc.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Make sure you have changed the environment parameters and paths. You may want to create a global variable for the rest of the scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As explained previously, the last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference_wc.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
a      = dread(aPath);&lt;br /&gt;
dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
First, prepare the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_0) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chiera-reference-center-gui.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
From here, open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script and, as usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open first_aligment_per_tomogram_wc.m &lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Since each project will take about 1 hour 30 min (estimation with 8 gpus), the script instead of computing the average itself will gather the precomputed results. Make sure to change the paths if you do not want them to be copied in your workspace, else, directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run first_aligment_per_tomogram_wc.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prTs = &#039;pr_ts_all_1&#039;;&lt;br /&gt;
aPaths = ddb([prTs &#039;:as:ite=last:ref=*&#039;]);&lt;br /&gt;
&lt;br /&gt;
aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = aPaths{idx};&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_reference_wc.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers and 8 gpus), since it only contains 5 particles. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run aligment_for_reference_wc.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; a With this procedure, candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script &amp;lt;code&amp;gt;second_aligment_per_tomogram.m&amp;lt;/code&amp;gt;. There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Now, let us visualize the merged table generated containing the candidate positions before and after subboxing. About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [pathToSharedStorage &#039;/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([&#039;pr_ts_all_1:rt:ite=last:ref=1&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). Therefore, to fit the schedule, when launching the script, the pre-computed results will be obtained:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prTs = &#039;pr_ts_all_2&#039;;&lt;br /&gt;
aPaths = ddb([prTs &#039;:as:ite=last:ref=*&#039;]);&lt;br /&gt;
&lt;br /&gt;
aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = aPaths{idx};&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment_wc.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tips:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;To terminate debug mode and continue execution, use the dbcont command.&lt;br /&gt;
To terminate debug mode and exit the file without completing execution, use the dbquit command.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, as expected, the files simulating the full execution of the script will be copied to the workspace you are working on when launching it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prEO = &#039;pr_EO&#039;;&lt;br /&gt;
aPaths = ddb([prEO &#039;:as:ite=last:ref=*&#039;]);&lt;br /&gt;
dshow([dread(aPaths{1}); dread(aPaths{2})])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment_wc.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects. The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus).&lt;br /&gt;
&lt;br /&gt;
[[File:final-result-from-refined-gold-standard-sta.png|centre|thumb|550px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to Relion convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, Relion will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this workshop the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root and go to a personal workplace folder&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;run_half2_class001_unfil.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_sharpen.png|centre|thumb|600px| RELION Post-process I/O sharped with automatic B-factor estimation.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the pre-computed post-processed average with:&lt;br /&gt;
dshow(&#039;PostProcess/job171/postprocess.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and inspect the FSC curves by opening the file:&lt;br /&gt;
PostProcess/job171/logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the reolsution even further. However, in this workflow, only the basic RELION steps will be expoited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;open the relion4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Click on the relion4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make psuedo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make psuedo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make psuedo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make psuedo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here put will not be done because of time limitations. This step took 18h on 8 GPUs and the computed reusults are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprossed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION TSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=High_resolution_walkthrough_with_HIV1&amp;diff=4994</id>
		<title>High resolution walkthrough with HIV1</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=High_resolution_walkthrough_with_HIV1&amp;diff=4994"/>
		<updated>2024-03-05T14:07:31Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Extraction of first per tomogram average */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Goal of the walktrough =&lt;br /&gt;
&lt;br /&gt;
This walktrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this walktrough.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Structure of the walkthrough =&lt;br /&gt;
&lt;br /&gt;
The full HIV1 walkthrough pipeline has been split into multiple sequential steps. Each of these steps corresponds to a subsection of this wiki page. It is possible to reach an average with about ~4 A of resolution starting from 5 tilt series by following all of the steps described in this walkthrough. The only exception is the process to create a tilt series from the microscope movies, which is only discussed in the &amp;quot;Motion correction and dose weighting&amp;quot; subsection.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
However, depending on the hardware available, a full execution of this pipeline can easily take a week of computing time. Additionally, the generated data consumes considerable amounts of memory resources. As such, this walkthrough is has been constructed to be scalable. The full version of the walkthrough code package is divided into two sections: scripts and data. The following figure represents the package tree. The data part includes all of the pre-computed intermediate files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Folder_structure_HIV1_v2.png|centre|thumb|800px| Structure of package containing the data and scripts for the HIV1 walktrough. The full version of the &#039;data&#039; part of the package is 2.2 TB. The &#039;scripts&#039; part is divided into steps. Note the correspondence between the folder names and the subsection names in this wiki page. Each step folder is divided into three parts: inputs, outputs and scripts. The input contains a set of paths to the where the input data is meant to be found in the &#039;data&#039; part of the package. The output contains a set of path of where the generated files of this step should be moved to. The scripts includes the MATLAB codes that will be executed following the practical notes in the wiki page.]]&lt;br /&gt;
&lt;br /&gt;
There are two main approaches on the implementation of walktrough with different scales of memory and computing resource requirements: with pre-computations or full execution. The two approaches are described in the following tables.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! with pre-computations&lt;br /&gt;
|-&lt;br /&gt;
| Requires an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Does not require large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for in-person workshop.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section has been made available from a physical memory.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The script generally do not need modification.&lt;br /&gt;
|-&lt;br /&gt;
| By default most scripts process only one tilt series. This is done to save computing time.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! full execution&lt;br /&gt;
|-&lt;br /&gt;
| Does not require an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Requires large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for individual practical use.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section starts has mostly empty. The &#039;data&#039; section can be downloaded from https://drive.google.com/file/d/1k4bLLswsacYdIGcNRc76YcbAiycxyPuX/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts will need modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts need to be modified to process all of the tilt series. The scripts are already structured to simplify the needed modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section. As such, the &#039;data&#039; section needs to be filled with the outputs of the scripts after each step.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As mentioned previously, the &amp;quot;full-execution&amp;quot; approach requires some limited script modifications. The MATLAB scripts have been generally structured so as to present three parts. The first part consists of the paths to the input and output files. The second part is the section of parameters. The third part is a for loop on the input tilt series. As such, the typical modifications necessary for the &amp;quot;full-execution&amp;quot; approach are limited to the first part, ensuring that the inputs for all five tilt series are given.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Additionally, in the &amp;quot;full-execution&amp;quot; approach, the results of the scripts are used to populate the empty &#039;data&#039; section so that the following scripts may be able to access their input files. This means that the files need to be positioned in the correct folder tree location and with a consistent file name. To help with this process, each step has an output text file in its folder with the path and file names that need to be applied to ensure consistency.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+ Time requirements for each step&lt;br /&gt;
|-&lt;br /&gt;
! Step !! Computing time !! Interactive time !! Workshop time !! Notes&lt;br /&gt;
|-&lt;br /&gt;
! Recovery of acquisition parameters &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 5 min &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! Motion correction &lt;br /&gt;
| 1 min per tilt series with GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Not done in this walkthrough&lt;br /&gt;
|-&lt;br /&gt;
! CTF estimation &lt;br /&gt;
| 5 min for all tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using CTFFIND4&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: alignment &lt;br /&gt;
| 8 min per tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: dose weighting &lt;br /&gt;
| 3 min &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default on all tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: CTF correction &lt;br /&gt;
| 1 hour 30 min per tilt series without GPU, 5 min per tilt series with 1 GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using IMOD, executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: tomogram reconstruction &lt;br /&gt;
| 12 min per tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: preparation and management of data &lt;br /&gt;
| 5 min &lt;br /&gt;
| 3 min &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: particle picking &lt;br /&gt;
| - &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| 10 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: particle extraction &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: creation of initial reference &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of first per tomogram average &lt;br /&gt;
| 15 min (CPU) + 1 hour 30 min (8 GPUs) per tilt series &lt;br /&gt;
| 15 min &lt;br /&gt;
| 15 min &lt;br /&gt;
| Use of UCSF Chimera&lt;br /&gt;
|-&lt;br /&gt;
! StA: computing an average of averages &lt;br /&gt;
| 15 min (CPU) &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of second per tomogram average &lt;br /&gt;
| 30 min (CPU) + 3 hours 30 min (8 GPUs) per tilt series &lt;br /&gt;
| 25 min &lt;br /&gt;
| 15 min &lt;br /&gt;
| Use of UCSF Chimera&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of coarse half maps &lt;br /&gt;
| 22 min (CPU) + 48 hours (8 GPUs) &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of refined half maps &lt;br /&gt;
| 1 hour (CPU) + 24 hours (8 GPUs) + 1 hour (CPU) per tilt series &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! FSC computation &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 15 min &lt;br /&gt;
| Using RELION&lt;br /&gt;
|-&lt;br /&gt;
! RELION conversion &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 5 min &lt;br /&gt;
| Using RELION&lt;br /&gt;
|-&lt;br /&gt;
! RELION refinement &lt;br /&gt;
| &amp;gt;40 hours using 8 GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using RELION, split into generation of a RELION template (~1h), extraction of RELION particles (~1h) and then the execution of the RELION refinement&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
= Recovery of acquisition parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the walktrough are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file of a K3 detector inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the links:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
https://relion.readthedocs.io/en/release-3.1/Reference/MovieCompression.html&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the gain correction.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been designed for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this walkthrough after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following walkthrough are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a MATLAB script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags. Note also that if Motioncorr2 cannot find or use the gain file provided, it will not terminate the motion correction and will instead continue computing without gain correction.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, CTFFIND4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, CTFFIND4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal. Note that the CTFFIND4 wrapper has been created for CTFfind version 4.1.5. Using a different CTFfind version may require some limited modifications of the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the CTFFIND4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the CTFFIND4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;change line 178 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD. The tested version of IMOD is 4.11.12.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the line 26 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Note that the reconstruction of a full-size tomogram is resource intensive, especially in memory. In this case, the expected size of a single tomogram is about 100 GB.&amp;lt;/pre&amp;gt; All the tomograms have been pre-computed and stored in the data folder. If you wish to backproject a tomogram it may be done by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GUI will pop up as soon as the catalog &#039;c000.ctlg&#039; is called via   &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dcm c000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create the binned version of the tomogram selecting a factor of 2. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-create-pre-binned-dmmpp.png|centre|thumb|600px| Creation of tomograms binned versions using &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, these versions will be saved inside the folder of the tomograms, not inside the catalogue folder.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow-sta.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
  &#039;&#039;&#039;If the reader is already familiar with &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, they may choose to skip ahead to the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui-sta.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui-sta.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of MATLAB and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui-sta.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and MATLAB (remember that the indexing for your system starts at 0 and for MATLAB at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui-sta.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
Place yourself in the &#039;./scripts&#039; directory. Then, simply move or copy the downloaded wild card script and open it via&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
 open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that all the scripts needed for the StA section have been moved already to the scripts folder.&lt;br /&gt;
&lt;br /&gt;
Within the script, ensure you have updated the environment parameters and paths as necessary. Remember, a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or &#039;&#039;&#039;NaN&#039;&#039;&#039; will precede the lines that require your input. Consider establishing a global variable for consistent use throughout the subsequent scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
 a      = dread(aPath);&lt;br /&gt;
 dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project-sta.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
Let us start by preparing the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
re style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
prepare_average_for_chimera(pr_0)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This function will simply filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera-sta.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera-sta.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer-sta.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-reference-center-gui-sta.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From here, copy and open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering-sta.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
Each project will take about 1 hour 30 min (estimation with 8 gpus). To directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_1{idx} &#039;:as:ite=last&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average-sta.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_average.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. Launch the project by typing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run aligment_for_average.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages-sta.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; procedure, allows for candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script second_aligment_per_tomogram.m There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let us now begin with the hands-on portion of the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open second_aligment_per_tomogram&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before cropping the particles, let us visualize the merged table generated containing the candidate positions before and after subboxing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run second_aligment_per_tomogram.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [root &#039;/catalogue/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
idx = 1;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([pr_1{idx} &#039;:rt&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl-sta.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
We can complete the rest of the script. So, next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). To actually compute the cropping of the particles and the corresponding alignment projects:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_2{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average-sta.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results add the following lines in the loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to the subboxing section, is interesting to see how the filtering strategy worked. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run coarse_gold_standard_alignment.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification-sta.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference-sta.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration-sta.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, if you have already completed the task filling in the missing parts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aEPath = ddb([pr_EO{1} &#039;:as&#039;]);&lt;br /&gt;
aOPath = ddb([pr_EO{2} &#039;:as&#039;]);&lt;br /&gt;
dshow([dread(aEPath); dread(aOPath)])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps-sta.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration-sta.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask-sta.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus). Launch it via:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run refined_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects.&lt;br /&gt;
&lt;br /&gt;
[[File:final-sta-result-from-refined-gold-standard-sta.png|centre|thumb|600px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;, top left.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to RELION convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, RELION will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera-sta.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this walktrough the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO2.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;half2.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_Sharpen2.png|centre|thumb|600px| RELION Post-process I/O sharpen with automatic B-factor estimation.]]&lt;br /&gt;
[[File:Post_process_Running2.png|centre|thumb|600px| RELION Post-process I/O running with forced mask.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A, force RELION to use your FSC mask and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RELION will compute the FSC curves of the two half map with and without the FSC mask and then will select the best curve to correct and select for the final resolution estimation. It is sometimes the case, especially for membrane protein, that the unmasked FSC will be completely artefactual and this can cause problem for the RELION final resolution estimation. In these cases, RELION will suggest to force the usage of the FSC mask by the &#039;--force_mask&#039; option.&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the resolution even further. However, in this workflow, only the basic RELION steps will be exploited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open the RELION4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click on the RELION4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO_v2.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:RELION_reconstruct_Running.png|centre|thumb|600px| RELION Tomo reconstruct particle running field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make pseudo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make pseudo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make pseudo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make pseudo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make pseudo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_Running.png|centre|thumb|600px| RELION Make pseudo-subtomos running field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here but will not be done because of time limitations. This step took 40h on 8 GPUs and the computed results are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here are some notes on the chosen parameters:&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION requires a certain number of mpi processes to be defined in the Running tab. In the example, by setting 8 GPUs in the compute tab, we require 9 mpi processes: 4 for the even particles, 4 for the odd particles and one mpi master process.&amp;lt;br&amp;gt;&lt;br /&gt;
- By default RELION uses all of the GPU memory available.  GPU device memory (in Mb) to leave free after allocation can be set with the flag --free_gpu_memory.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
[[File:RELION_refine_Reference.png|centre|thumb|600px| RELION 3D auto-refine reference field. Note the low-pass and the symmetry.]]&lt;br /&gt;
[[File:RELION_refine_CTF.png|centre|thumb|600px| RELION 3D auto-refine CTF field.]]&lt;br /&gt;
[[File:RELION_refine_optimisation.png|centre|thumb|600px| RELION 3D auto-refine optimisation field. Note the mask diameter.]]&lt;br /&gt;
[[File:RELION_refine_autosampling.png|centre|thumb|600px| RELION 3D auto-refine auto-sampling field.]]&lt;br /&gt;
[[File:RELION_refine_compute.png|centre|thumb|600px| RELION 3D auto-refine compute field. Note that the ids of the GPUs are separated by the colon symbol &amp;quot;:&amp;quot;.]]&lt;br /&gt;
[[File:RELION_refine_Running.png|centre|thumb|600px| RELION 3D auto-refine running field. Note the number of mpi processes is one more than the number of GPUs]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprocessed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION FSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=File:Final-sta-result-from-refined-gold-standard-sta.png&amp;diff=4993</id>
		<title>File:Final-sta-result-from-refined-gold-standard-sta.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=File:Final-sta-result-from-refined-gold-standard-sta.png&amp;diff=4993"/>
		<updated>2024-03-05T13:59:09Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=File:Isosurface-final-structure-density-map-chimera-sta.png&amp;diff=4992</id>
		<title>File:Isosurface-final-structure-density-map-chimera-sta.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=File:Isosurface-final-structure-density-map-chimera-sta.png&amp;diff=4992"/>
		<updated>2024-03-05T13:58:54Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=High_resolution_walkthrough_with_HIV1&amp;diff=4991</id>
		<title>High resolution walkthrough with HIV1</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=High_resolution_walkthrough_with_HIV1&amp;diff=4991"/>
		<updated>2024-03-05T13:56:41Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Extraction of refined half maps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Goal of the walktrough =&lt;br /&gt;
&lt;br /&gt;
This walktrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this walktrough.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Structure of the walkthrough =&lt;br /&gt;
&lt;br /&gt;
The full HIV1 walkthrough pipeline has been split into multiple sequential steps. Each of these steps corresponds to a subsection of this wiki page. It is possible to reach an average with about ~4 A of resolution starting from 5 tilt series by following all of the steps described in this walkthrough. The only exception is the process to create a tilt series from the microscope movies, which is only discussed in the &amp;quot;Motion correction and dose weighting&amp;quot; subsection.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
However, depending on the hardware available, a full execution of this pipeline can easily take a week of computing time. Additionally, the generated data consumes considerable amounts of memory resources. As such, this walkthrough is has been constructed to be scalable. The full version of the walkthrough code package is divided into two sections: scripts and data. The following figure represents the package tree. The data part includes all of the pre-computed intermediate files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Folder_structure_HIV1_v2.png|centre|thumb|800px| Structure of package containing the data and scripts for the HIV1 walktrough. The full version of the &#039;data&#039; part of the package is 2.2 TB. The &#039;scripts&#039; part is divided into steps. Note the correspondence between the folder names and the subsection names in this wiki page. Each step folder is divided into three parts: inputs, outputs and scripts. The input contains a set of paths to the where the input data is meant to be found in the &#039;data&#039; part of the package. The output contains a set of path of where the generated files of this step should be moved to. The scripts includes the MATLAB codes that will be executed following the practical notes in the wiki page.]]&lt;br /&gt;
&lt;br /&gt;
There are two main approaches on the implementation of walktrough with different scales of memory and computing resource requirements: with pre-computations or full execution. The two approaches are described in the following tables.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! with pre-computations&lt;br /&gt;
|-&lt;br /&gt;
| Requires an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Does not require large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for in-person workshop.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section has been made available from a physical memory.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The script generally do not need modification.&lt;br /&gt;
|-&lt;br /&gt;
| By default most scripts process only one tilt series. This is done to save computing time.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! full execution&lt;br /&gt;
|-&lt;br /&gt;
| Does not require an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Requires large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for individual practical use.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section starts has mostly empty. The &#039;data&#039; section can be downloaded from https://drive.google.com/file/d/1k4bLLswsacYdIGcNRc76YcbAiycxyPuX/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts will need modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts need to be modified to process all of the tilt series. The scripts are already structured to simplify the needed modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section. As such, the &#039;data&#039; section needs to be filled with the outputs of the scripts after each step.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As mentioned previously, the &amp;quot;full-execution&amp;quot; approach requires some limited script modifications. The MATLAB scripts have been generally structured so as to present three parts. The first part consists of the paths to the input and output files. The second part is the section of parameters. The third part is a for loop on the input tilt series. As such, the typical modifications necessary for the &amp;quot;full-execution&amp;quot; approach are limited to the first part, ensuring that the inputs for all five tilt series are given.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Additionally, in the &amp;quot;full-execution&amp;quot; approach, the results of the scripts are used to populate the empty &#039;data&#039; section so that the following scripts may be able to access their input files. This means that the files need to be positioned in the correct folder tree location and with a consistent file name. To help with this process, each step has an output text file in its folder with the path and file names that need to be applied to ensure consistency.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+ Time requirements for each step&lt;br /&gt;
|-&lt;br /&gt;
! Step !! Computing time !! Interactive time !! Workshop time !! Notes&lt;br /&gt;
|-&lt;br /&gt;
! Recovery of acquisition parameters &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 5 min &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! Motion correction &lt;br /&gt;
| 1 min per tilt series with GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Not done in this walkthrough&lt;br /&gt;
|-&lt;br /&gt;
! CTF estimation &lt;br /&gt;
| 5 min for all tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using CTFFIND4&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: alignment &lt;br /&gt;
| 8 min per tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: dose weighting &lt;br /&gt;
| 3 min &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default on all tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: CTF correction &lt;br /&gt;
| 1 hour 30 min per tilt series without GPU, 5 min per tilt series with 1 GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using IMOD, executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: tomogram reconstruction &lt;br /&gt;
| 12 min per tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: preparation and management of data &lt;br /&gt;
| 5 min &lt;br /&gt;
| 3 min &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: particle picking &lt;br /&gt;
| - &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| 10 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: particle extraction &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: creation of initial reference &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of first per tomogram average &lt;br /&gt;
| 15 min (CPU) + 1 hour 30 min (8 GPUs) per tilt series &lt;br /&gt;
| 15 min &lt;br /&gt;
| 15 min &lt;br /&gt;
| Use of UCSF Chimera&lt;br /&gt;
|-&lt;br /&gt;
! StA: computing an average of averages &lt;br /&gt;
| 15 min (CPU) &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of second per tomogram average &lt;br /&gt;
| 30 min (CPU) + 3 hours 30 min (8 GPUs) per tilt series &lt;br /&gt;
| 25 min &lt;br /&gt;
| 15 min &lt;br /&gt;
| Use of UCSF Chimera&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of coarse half maps &lt;br /&gt;
| 22 min (CPU) + 48 hours (8 GPUs) &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of refined half maps &lt;br /&gt;
| 1 hour (CPU) + 24 hours (8 GPUs) + 1 hour (CPU) per tilt series &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! FSC computation &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 15 min &lt;br /&gt;
| Using RELION&lt;br /&gt;
|-&lt;br /&gt;
! RELION conversion &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 5 min &lt;br /&gt;
| Using RELION&lt;br /&gt;
|-&lt;br /&gt;
! RELION refinement &lt;br /&gt;
| &amp;gt;40 hours using 8 GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using RELION, split into generation of a RELION template (~1h), extraction of RELION particles (~1h) and then the execution of the RELION refinement&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
= Recovery of acquisition parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the walktrough are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file of a K3 detector inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the links:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
https://relion.readthedocs.io/en/release-3.1/Reference/MovieCompression.html&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the gain correction.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been designed for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this walkthrough after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following walkthrough are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a MATLAB script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags. Note also that if Motioncorr2 cannot find or use the gain file provided, it will not terminate the motion correction and will instead continue computing without gain correction.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, CTFFIND4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, CTFFIND4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal. Note that the CTFFIND4 wrapper has been created for CTFfind version 4.1.5. Using a different CTFfind version may require some limited modifications of the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the CTFFIND4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the CTFFIND4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;change line 178 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD. The tested version of IMOD is 4.11.12.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the line 26 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Note that the reconstruction of a full-size tomogram is resource intensive, especially in memory. In this case, the expected size of a single tomogram is about 100 GB.&amp;lt;/pre&amp;gt; All the tomograms have been pre-computed and stored in the data folder. If you wish to backproject a tomogram it may be done by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GUI will pop up as soon as the catalog &#039;c000.ctlg&#039; is called via   &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dcm c000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create the binned version of the tomogram selecting a factor of 2. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-create-pre-binned-dmmpp.png|centre|thumb|600px| Creation of tomograms binned versions using &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, these versions will be saved inside the folder of the tomograms, not inside the catalogue folder.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow-sta.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
  &#039;&#039;&#039;If the reader is already familiar with &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, they may choose to skip ahead to the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui-sta.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui-sta.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of MATLAB and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui-sta.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and MATLAB (remember that the indexing for your system starts at 0 and for MATLAB at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui-sta.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
Place yourself in the &#039;./scripts&#039; directory. Then, simply move or copy the downloaded wild card script and open it via&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
 open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that all the scripts needed for the StA section have been moved already to the scripts folder.&lt;br /&gt;
&lt;br /&gt;
Within the script, ensure you have updated the environment parameters and paths as necessary. Remember, a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or &#039;&#039;&#039;NaN&#039;&#039;&#039; will precede the lines that require your input. Consider establishing a global variable for consistent use throughout the subsequent scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
 a      = dread(aPath);&lt;br /&gt;
 dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project-sta.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
Let us start by preparing the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
re style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
prepare_average_for_chimera(pr_0)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This function will simply filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera-sta.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera-sta.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer-sta.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-reference-center-gui-sta.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From here, copy and open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering-sta.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
Each project will take about 1 hour 30 min (estimation with 8 gpus). To directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_1{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average-sta.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_average.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. Launch the project by typing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run aligment_for_average.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages-sta.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; procedure, allows for candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script second_aligment_per_tomogram.m There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let us now begin with the hands-on portion of the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open second_aligment_per_tomogram&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before cropping the particles, let us visualize the merged table generated containing the candidate positions before and after subboxing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run second_aligment_per_tomogram.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [root &#039;/catalogue/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
idx = 1;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([pr_1{idx} &#039;:rt&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl-sta.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
We can complete the rest of the script. So, next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). To actually compute the cropping of the particles and the corresponding alignment projects:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_2{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average-sta.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results add the following lines in the loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to the subboxing section, is interesting to see how the filtering strategy worked. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run coarse_gold_standard_alignment.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification-sta.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference-sta.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration-sta.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, if you have already completed the task filling in the missing parts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aEPath = ddb([pr_EO{1} &#039;:as&#039;]);&lt;br /&gt;
aOPath = ddb([pr_EO{2} &#039;:as&#039;]);&lt;br /&gt;
dshow([dread(aEPath); dread(aOPath)])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps-sta.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration-sta.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask-sta.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus). Launch it via:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run refined_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects.&lt;br /&gt;
&lt;br /&gt;
[[File:final-sta-result-from-refined-gold-standard-sta.png|centre|thumb|600px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;, top left.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to RELION convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, RELION will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera-sta.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this walktrough the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO2.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;half2.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_Sharpen2.png|centre|thumb|600px| RELION Post-process I/O sharpen with automatic B-factor estimation.]]&lt;br /&gt;
[[File:Post_process_Running2.png|centre|thumb|600px| RELION Post-process I/O running with forced mask.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A, force RELION to use your FSC mask and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RELION will compute the FSC curves of the two half map with and without the FSC mask and then will select the best curve to correct and select for the final resolution estimation. It is sometimes the case, especially for membrane protein, that the unmasked FSC will be completely artefactual and this can cause problem for the RELION final resolution estimation. In these cases, RELION will suggest to force the usage of the FSC mask by the &#039;--force_mask&#039; option.&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the resolution even further. However, in this workflow, only the basic RELION steps will be exploited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open the RELION4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click on the RELION4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO_v2.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:RELION_reconstruct_Running.png|centre|thumb|600px| RELION Tomo reconstruct particle running field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make pseudo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make pseudo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make pseudo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make pseudo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make pseudo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_Running.png|centre|thumb|600px| RELION Make pseudo-subtomos running field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here but will not be done because of time limitations. This step took 40h on 8 GPUs and the computed results are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here are some notes on the chosen parameters:&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION requires a certain number of mpi processes to be defined in the Running tab. In the example, by setting 8 GPUs in the compute tab, we require 9 mpi processes: 4 for the even particles, 4 for the odd particles and one mpi master process.&amp;lt;br&amp;gt;&lt;br /&gt;
- By default RELION uses all of the GPU memory available.  GPU device memory (in Mb) to leave free after allocation can be set with the flag --free_gpu_memory.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
[[File:RELION_refine_Reference.png|centre|thumb|600px| RELION 3D auto-refine reference field. Note the low-pass and the symmetry.]]&lt;br /&gt;
[[File:RELION_refine_CTF.png|centre|thumb|600px| RELION 3D auto-refine CTF field.]]&lt;br /&gt;
[[File:RELION_refine_optimisation.png|centre|thumb|600px| RELION 3D auto-refine optimisation field. Note the mask diameter.]]&lt;br /&gt;
[[File:RELION_refine_autosampling.png|centre|thumb|600px| RELION 3D auto-refine auto-sampling field.]]&lt;br /&gt;
[[File:RELION_refine_compute.png|centre|thumb|600px| RELION 3D auto-refine compute field. Note that the ids of the GPUs are separated by the colon symbol &amp;quot;:&amp;quot;.]]&lt;br /&gt;
[[File:RELION_refine_Running.png|centre|thumb|600px| RELION 3D auto-refine running field. Note the number of mpi processes is one more than the number of GPUs]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprocessed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION FSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=File:Adapted-mask-sta.png&amp;diff=4990</id>
		<title>File:Adapted-mask-sta.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=File:Adapted-mask-sta.png&amp;diff=4990"/>
		<updated>2024-03-05T13:55:51Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=File:Refined-half-maps-alignment-configuration-sta.png&amp;diff=4989</id>
		<title>File:Refined-half-maps-alignment-configuration-sta.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=File:Refined-half-maps-alignment-configuration-sta.png&amp;diff=4989"/>
		<updated>2024-03-05T13:55:33Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=High_resolution_walkthrough_with_HIV1&amp;diff=4988</id>
		<title>High resolution walkthrough with HIV1</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=High_resolution_walkthrough_with_HIV1&amp;diff=4988"/>
		<updated>2024-03-05T13:54:53Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Extraction of refined half maps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Goal of the walktrough =&lt;br /&gt;
&lt;br /&gt;
This walktrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this walktrough.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Structure of the walkthrough =&lt;br /&gt;
&lt;br /&gt;
The full HIV1 walkthrough pipeline has been split into multiple sequential steps. Each of these steps corresponds to a subsection of this wiki page. It is possible to reach an average with about ~4 A of resolution starting from 5 tilt series by following all of the steps described in this walkthrough. The only exception is the process to create a tilt series from the microscope movies, which is only discussed in the &amp;quot;Motion correction and dose weighting&amp;quot; subsection.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
However, depending on the hardware available, a full execution of this pipeline can easily take a week of computing time. Additionally, the generated data consumes considerable amounts of memory resources. As such, this walkthrough is has been constructed to be scalable. The full version of the walkthrough code package is divided into two sections: scripts and data. The following figure represents the package tree. The data part includes all of the pre-computed intermediate files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Folder_structure_HIV1_v2.png|centre|thumb|800px| Structure of package containing the data and scripts for the HIV1 walktrough. The full version of the &#039;data&#039; part of the package is 2.2 TB. The &#039;scripts&#039; part is divided into steps. Note the correspondence between the folder names and the subsection names in this wiki page. Each step folder is divided into three parts: inputs, outputs and scripts. The input contains a set of paths to the where the input data is meant to be found in the &#039;data&#039; part of the package. The output contains a set of path of where the generated files of this step should be moved to. The scripts includes the MATLAB codes that will be executed following the practical notes in the wiki page.]]&lt;br /&gt;
&lt;br /&gt;
There are two main approaches on the implementation of walktrough with different scales of memory and computing resource requirements: with pre-computations or full execution. The two approaches are described in the following tables.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! with pre-computations&lt;br /&gt;
|-&lt;br /&gt;
| Requires an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Does not require large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for in-person workshop.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section has been made available from a physical memory.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The script generally do not need modification.&lt;br /&gt;
|-&lt;br /&gt;
| By default most scripts process only one tilt series. This is done to save computing time.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! full execution&lt;br /&gt;
|-&lt;br /&gt;
| Does not require an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Requires large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for individual practical use.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section starts has mostly empty. The &#039;data&#039; section can be downloaded from https://drive.google.com/file/d/1k4bLLswsacYdIGcNRc76YcbAiycxyPuX/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts will need modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts need to be modified to process all of the tilt series. The scripts are already structured to simplify the needed modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section. As such, the &#039;data&#039; section needs to be filled with the outputs of the scripts after each step.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As mentioned previously, the &amp;quot;full-execution&amp;quot; approach requires some limited script modifications. The MATLAB scripts have been generally structured so as to present three parts. The first part consists of the paths to the input and output files. The second part is the section of parameters. The third part is a for loop on the input tilt series. As such, the typical modifications necessary for the &amp;quot;full-execution&amp;quot; approach are limited to the first part, ensuring that the inputs for all five tilt series are given.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Additionally, in the &amp;quot;full-execution&amp;quot; approach, the results of the scripts are used to populate the empty &#039;data&#039; section so that the following scripts may be able to access their input files. This means that the files need to be positioned in the correct folder tree location and with a consistent file name. To help with this process, each step has an output text file in its folder with the path and file names that need to be applied to ensure consistency.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+ Time requirements for each step&lt;br /&gt;
|-&lt;br /&gt;
! Step !! Computing time !! Interactive time !! Workshop time !! Notes&lt;br /&gt;
|-&lt;br /&gt;
! Recovery of acquisition parameters &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 5 min &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! Motion correction &lt;br /&gt;
| 1 min per tilt series with GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Not done in this walkthrough&lt;br /&gt;
|-&lt;br /&gt;
! CTF estimation &lt;br /&gt;
| 5 min for all tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using CTFFIND4&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: alignment &lt;br /&gt;
| 8 min per tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: dose weighting &lt;br /&gt;
| 3 min &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default on all tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: CTF correction &lt;br /&gt;
| 1 hour 30 min per tilt series without GPU, 5 min per tilt series with 1 GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using IMOD, executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: tomogram reconstruction &lt;br /&gt;
| 12 min per tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: preparation and management of data &lt;br /&gt;
| 5 min &lt;br /&gt;
| 3 min &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: particle picking &lt;br /&gt;
| - &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| 10 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: particle extraction &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: creation of initial reference &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of first per tomogram average &lt;br /&gt;
| 15 min (CPU) + 1 hour 30 min (8 GPUs) per tilt series &lt;br /&gt;
| 15 min &lt;br /&gt;
| 15 min &lt;br /&gt;
| Use of UCSF Chimera&lt;br /&gt;
|-&lt;br /&gt;
! StA: computing an average of averages &lt;br /&gt;
| 15 min (CPU) &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of second per tomogram average &lt;br /&gt;
| 30 min (CPU) + 3 hours 30 min (8 GPUs) per tilt series &lt;br /&gt;
| 25 min &lt;br /&gt;
| 15 min &lt;br /&gt;
| Use of UCSF Chimera&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of coarse half maps &lt;br /&gt;
| 22 min (CPU) + 48 hours (8 GPUs) &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of refined half maps &lt;br /&gt;
| 1 hour (CPU) + 24 hours (8 GPUs) + 1 hour (CPU) per tilt series &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! FSC computation &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 15 min &lt;br /&gt;
| Using RELION&lt;br /&gt;
|-&lt;br /&gt;
! RELION conversion &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 5 min &lt;br /&gt;
| Using RELION&lt;br /&gt;
|-&lt;br /&gt;
! RELION refinement &lt;br /&gt;
| &amp;gt;40 hours using 8 GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using RELION, split into generation of a RELION template (~1h), extraction of RELION particles (~1h) and then the execution of the RELION refinement&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
= Recovery of acquisition parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the walktrough are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file of a K3 detector inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the links:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
https://relion.readthedocs.io/en/release-3.1/Reference/MovieCompression.html&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the gain correction.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been designed for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this walkthrough after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following walkthrough are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a MATLAB script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags. Note also that if Motioncorr2 cannot find or use the gain file provided, it will not terminate the motion correction and will instead continue computing without gain correction.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, CTFFIND4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, CTFFIND4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal. Note that the CTFFIND4 wrapper has been created for CTFfind version 4.1.5. Using a different CTFfind version may require some limited modifications of the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the CTFFIND4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the CTFFIND4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;change line 178 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD. The tested version of IMOD is 4.11.12.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the line 26 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Note that the reconstruction of a full-size tomogram is resource intensive, especially in memory. In this case, the expected size of a single tomogram is about 100 GB.&amp;lt;/pre&amp;gt; All the tomograms have been pre-computed and stored in the data folder. If you wish to backproject a tomogram it may be done by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GUI will pop up as soon as the catalog &#039;c000.ctlg&#039; is called via   &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dcm c000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create the binned version of the tomogram selecting a factor of 2. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-create-pre-binned-dmmpp.png|centre|thumb|600px| Creation of tomograms binned versions using &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, these versions will be saved inside the folder of the tomograms, not inside the catalogue folder.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow-sta.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
  &#039;&#039;&#039;If the reader is already familiar with &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, they may choose to skip ahead to the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui-sta.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui-sta.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of MATLAB and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui-sta.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and MATLAB (remember that the indexing for your system starts at 0 and for MATLAB at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui-sta.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
Place yourself in the &#039;./scripts&#039; directory. Then, simply move or copy the downloaded wild card script and open it via&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
 open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that all the scripts needed for the StA section have been moved already to the scripts folder.&lt;br /&gt;
&lt;br /&gt;
Within the script, ensure you have updated the environment parameters and paths as necessary. Remember, a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or &#039;&#039;&#039;NaN&#039;&#039;&#039; will precede the lines that require your input. Consider establishing a global variable for consistent use throughout the subsequent scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
 a      = dread(aPath);&lt;br /&gt;
 dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project-sta.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
Let us start by preparing the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
re style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
prepare_average_for_chimera(pr_0)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This function will simply filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera-sta.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera-sta.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer-sta.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-reference-center-gui-sta.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From here, copy and open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering-sta.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
Each project will take about 1 hour 30 min (estimation with 8 gpus). To directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_1{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average-sta.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_average.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. Launch the project by typing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run aligment_for_average.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages-sta.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; procedure, allows for candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script second_aligment_per_tomogram.m There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let us now begin with the hands-on portion of the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open second_aligment_per_tomogram&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before cropping the particles, let us visualize the merged table generated containing the candidate positions before and after subboxing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run second_aligment_per_tomogram.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [root &#039;/catalogue/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
idx = 1;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([pr_1{idx} &#039;:rt&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl-sta.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
We can complete the rest of the script. So, next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). To actually compute the cropping of the particles and the corresponding alignment projects:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_2{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average-sta.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results add the following lines in the loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to the subboxing section, is interesting to see how the filtering strategy worked. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run coarse_gold_standard_alignment.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification-sta.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference-sta.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration-sta.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, if you have already completed the task filling in the missing parts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aEPath = ddb([pr_EO{1} &#039;:as&#039;]);&lt;br /&gt;
aOPath = ddb([pr_EO{2} &#039;:as&#039;]);&lt;br /&gt;
dshow([dread(aEPath); dread(aOPath)])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps-sta.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration-sta.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask-sta.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus). Launch it via:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run refined_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects.&lt;br /&gt;
&lt;br /&gt;
[[File:final-result-from-refined-gold-standard-sta.png|centre|thumb|600px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;, top left.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to RELION convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, RELION will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera-sta.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this walktrough the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO2.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;half2.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_Sharpen2.png|centre|thumb|600px| RELION Post-process I/O sharpen with automatic B-factor estimation.]]&lt;br /&gt;
[[File:Post_process_Running2.png|centre|thumb|600px| RELION Post-process I/O running with forced mask.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A, force RELION to use your FSC mask and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RELION will compute the FSC curves of the two half map with and without the FSC mask and then will select the best curve to correct and select for the final resolution estimation. It is sometimes the case, especially for membrane protein, that the unmasked FSC will be completely artefactual and this can cause problem for the RELION final resolution estimation. In these cases, RELION will suggest to force the usage of the FSC mask by the &#039;--force_mask&#039; option.&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the resolution even further. However, in this workflow, only the basic RELION steps will be exploited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open the RELION4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click on the RELION4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO_v2.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:RELION_reconstruct_Running.png|centre|thumb|600px| RELION Tomo reconstruct particle running field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make pseudo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make pseudo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make pseudo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make pseudo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make pseudo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_Running.png|centre|thumb|600px| RELION Make pseudo-subtomos running field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here but will not be done because of time limitations. This step took 40h on 8 GPUs and the computed results are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here are some notes on the chosen parameters:&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION requires a certain number of mpi processes to be defined in the Running tab. In the example, by setting 8 GPUs in the compute tab, we require 9 mpi processes: 4 for the even particles, 4 for the odd particles and one mpi master process.&amp;lt;br&amp;gt;&lt;br /&gt;
- By default RELION uses all of the GPU memory available.  GPU device memory (in Mb) to leave free after allocation can be set with the flag --free_gpu_memory.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
[[File:RELION_refine_Reference.png|centre|thumb|600px| RELION 3D auto-refine reference field. Note the low-pass and the symmetry.]]&lt;br /&gt;
[[File:RELION_refine_CTF.png|centre|thumb|600px| RELION 3D auto-refine CTF field.]]&lt;br /&gt;
[[File:RELION_refine_optimisation.png|centre|thumb|600px| RELION 3D auto-refine optimisation field. Note the mask diameter.]]&lt;br /&gt;
[[File:RELION_refine_autosampling.png|centre|thumb|600px| RELION 3D auto-refine auto-sampling field.]]&lt;br /&gt;
[[File:RELION_refine_compute.png|centre|thumb|600px| RELION 3D auto-refine compute field. Note that the ids of the GPUs are separated by the colon symbol &amp;quot;:&amp;quot;.]]&lt;br /&gt;
[[File:RELION_refine_Running.png|centre|thumb|600px| RELION 3D auto-refine running field. Note the number of mpi processes is one more than the number of GPUs]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprocessed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION FSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=File:Last-average-for-coarse-half-maps-sta.png&amp;diff=4987</id>
		<title>File:Last-average-for-coarse-half-maps-sta.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=File:Last-average-for-coarse-half-maps-sta.png&amp;diff=4987"/>
		<updated>2024-03-05T11:59:34Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=File:Coarse-half-maps-alignment-configuration-sta.png&amp;diff=4986</id>
		<title>File:Coarse-half-maps-alignment-configuration-sta.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=File:Coarse-half-maps-alignment-configuration-sta.png&amp;diff=4986"/>
		<updated>2024-03-05T11:58:25Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=High_resolution_walkthrough_with_HIV1&amp;diff=4985</id>
		<title>High resolution walkthrough with HIV1</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=High_resolution_walkthrough_with_HIV1&amp;diff=4985"/>
		<updated>2024-03-05T11:57:59Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Extraction of coarse half maps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Goal of the walktrough =&lt;br /&gt;
&lt;br /&gt;
This walktrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this walktrough.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Structure of the walkthrough =&lt;br /&gt;
&lt;br /&gt;
The full HIV1 walkthrough pipeline has been split into multiple sequential steps. Each of these steps corresponds to a subsection of this wiki page. It is possible to reach an average with about ~4 A of resolution starting from 5 tilt series by following all of the steps described in this walkthrough. The only exception is the process to create a tilt series from the microscope movies, which is only discussed in the &amp;quot;Motion correction and dose weighting&amp;quot; subsection.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
However, depending on the hardware available, a full execution of this pipeline can easily take a week of computing time. Additionally, the generated data consumes considerable amounts of memory resources. As such, this walkthrough is has been constructed to be scalable. The full version of the walkthrough code package is divided into two sections: scripts and data. The following figure represents the package tree. The data part includes all of the pre-computed intermediate files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Folder_structure_HIV1_v2.png|centre|thumb|800px| Structure of package containing the data and scripts for the HIV1 walktrough. The full version of the &#039;data&#039; part of the package is 2.2 TB. The &#039;scripts&#039; part is divided into steps. Note the correspondence between the folder names and the subsection names in this wiki page. Each step folder is divided into three parts: inputs, outputs and scripts. The input contains a set of paths to the where the input data is meant to be found in the &#039;data&#039; part of the package. The output contains a set of path of where the generated files of this step should be moved to. The scripts includes the MATLAB codes that will be executed following the practical notes in the wiki page.]]&lt;br /&gt;
&lt;br /&gt;
There are two main approaches on the implementation of walktrough with different scales of memory and computing resource requirements: with pre-computations or full execution. The two approaches are described in the following tables.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! with pre-computations&lt;br /&gt;
|-&lt;br /&gt;
| Requires an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Does not require large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for in-person workshop.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section has been made available from a physical memory.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The script generally do not need modification.&lt;br /&gt;
|-&lt;br /&gt;
| By default most scripts process only one tilt series. This is done to save computing time.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! full execution&lt;br /&gt;
|-&lt;br /&gt;
| Does not require an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Requires large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for individual practical use.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section starts has mostly empty. The &#039;data&#039; section can be downloaded from https://drive.google.com/file/d/1k4bLLswsacYdIGcNRc76YcbAiycxyPuX/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts will need modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts need to be modified to process all of the tilt series. The scripts are already structured to simplify the needed modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section. As such, the &#039;data&#039; section needs to be filled with the outputs of the scripts after each step.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As mentioned previously, the &amp;quot;full-execution&amp;quot; approach requires some limited script modifications. The MATLAB scripts have been generally structured so as to present three parts. The first part consists of the paths to the input and output files. The second part is the section of parameters. The third part is a for loop on the input tilt series. As such, the typical modifications necessary for the &amp;quot;full-execution&amp;quot; approach are limited to the first part, ensuring that the inputs for all five tilt series are given.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Additionally, in the &amp;quot;full-execution&amp;quot; approach, the results of the scripts are used to populate the empty &#039;data&#039; section so that the following scripts may be able to access their input files. This means that the files need to be positioned in the correct folder tree location and with a consistent file name. To help with this process, each step has an output text file in its folder with the path and file names that need to be applied to ensure consistency.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+ Time requirements for each step&lt;br /&gt;
|-&lt;br /&gt;
! Step !! Computing time !! Interactive time !! Workshop time !! Notes&lt;br /&gt;
|-&lt;br /&gt;
! Recovery of acquisition parameters &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 5 min &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! Motion correction &lt;br /&gt;
| 1 min per tilt series with GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Not done in this walkthrough&lt;br /&gt;
|-&lt;br /&gt;
! CTF estimation &lt;br /&gt;
| 5 min for all tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using CTFFIND4&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: alignment &lt;br /&gt;
| 8 min per tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: dose weighting &lt;br /&gt;
| 3 min &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default on all tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: CTF correction &lt;br /&gt;
| 1 hour 30 min per tilt series without GPU, 5 min per tilt series with 1 GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using IMOD, executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: tomogram reconstruction &lt;br /&gt;
| 12 min per tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: preparation and management of data &lt;br /&gt;
| 5 min &lt;br /&gt;
| 3 min &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: particle picking &lt;br /&gt;
| - &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| 10 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: particle extraction &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: creation of initial reference &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of first per tomogram average &lt;br /&gt;
| 15 min (CPU) + 1 hour 30 min (8 GPUs) per tilt series &lt;br /&gt;
| 15 min &lt;br /&gt;
| 15 min &lt;br /&gt;
| Use of UCSF Chimera&lt;br /&gt;
|-&lt;br /&gt;
! StA: computing an average of averages &lt;br /&gt;
| 15 min (CPU) &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of second per tomogram average &lt;br /&gt;
| 30 min (CPU) + 3 hours 30 min (8 GPUs) per tilt series &lt;br /&gt;
| 25 min &lt;br /&gt;
| 15 min &lt;br /&gt;
| Use of UCSF Chimera&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of coarse half maps &lt;br /&gt;
| 22 min (CPU) + 48 hours (8 GPUs) &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of refined half maps &lt;br /&gt;
| 1 hour (CPU) + 24 hours (8 GPUs) + 1 hour (CPU) per tilt series &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! FSC computation &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 15 min &lt;br /&gt;
| Using RELION&lt;br /&gt;
|-&lt;br /&gt;
! RELION conversion &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 5 min &lt;br /&gt;
| Using RELION&lt;br /&gt;
|-&lt;br /&gt;
! RELION refinement &lt;br /&gt;
| &amp;gt;40 hours using 8 GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using RELION, split into generation of a RELION template (~1h), extraction of RELION particles (~1h) and then the execution of the RELION refinement&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
= Recovery of acquisition parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the walktrough are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file of a K3 detector inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the links:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
https://relion.readthedocs.io/en/release-3.1/Reference/MovieCompression.html&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the gain correction.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been designed for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this walkthrough after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following walkthrough are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a MATLAB script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags. Note also that if Motioncorr2 cannot find or use the gain file provided, it will not terminate the motion correction and will instead continue computing without gain correction.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, CTFFIND4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, CTFFIND4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal. Note that the CTFFIND4 wrapper has been created for CTFfind version 4.1.5. Using a different CTFfind version may require some limited modifications of the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the CTFFIND4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the CTFFIND4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;change line 178 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD. The tested version of IMOD is 4.11.12.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the line 26 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Note that the reconstruction of a full-size tomogram is resource intensive, especially in memory. In this case, the expected size of a single tomogram is about 100 GB.&amp;lt;/pre&amp;gt; All the tomograms have been pre-computed and stored in the data folder. If you wish to backproject a tomogram it may be done by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GUI will pop up as soon as the catalog &#039;c000.ctlg&#039; is called via   &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dcm c000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create the binned version of the tomogram selecting a factor of 2. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-create-pre-binned-dmmpp.png|centre|thumb|600px| Creation of tomograms binned versions using &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, these versions will be saved inside the folder of the tomograms, not inside the catalogue folder.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow-sta.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
  &#039;&#039;&#039;If the reader is already familiar with &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, they may choose to skip ahead to the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui-sta.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui-sta.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of MATLAB and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui-sta.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and MATLAB (remember that the indexing for your system starts at 0 and for MATLAB at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui-sta.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
Place yourself in the &#039;./scripts&#039; directory. Then, simply move or copy the downloaded wild card script and open it via&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
 open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that all the scripts needed for the StA section have been moved already to the scripts folder.&lt;br /&gt;
&lt;br /&gt;
Within the script, ensure you have updated the environment parameters and paths as necessary. Remember, a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or &#039;&#039;&#039;NaN&#039;&#039;&#039; will precede the lines that require your input. Consider establishing a global variable for consistent use throughout the subsequent scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
 a      = dread(aPath);&lt;br /&gt;
 dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project-sta.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
Let us start by preparing the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
re style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
prepare_average_for_chimera(pr_0)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This function will simply filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera-sta.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera-sta.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer-sta.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-reference-center-gui-sta.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From here, copy and open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering-sta.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
Each project will take about 1 hour 30 min (estimation with 8 gpus). To directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_1{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average-sta.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_average.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. Launch the project by typing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run aligment_for_average.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages-sta.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; procedure, allows for candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script second_aligment_per_tomogram.m There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let us now begin with the hands-on portion of the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open second_aligment_per_tomogram&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before cropping the particles, let us visualize the merged table generated containing the candidate positions before and after subboxing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run second_aligment_per_tomogram.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [root &#039;/catalogue/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
idx = 1;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([pr_1{idx} &#039;:rt&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl-sta.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
We can complete the rest of the script. So, next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). To actually compute the cropping of the particles and the corresponding alignment projects:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_2{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average-sta.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results add the following lines in the loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to the subboxing section, is interesting to see how the filtering strategy worked. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run coarse_gold_standard_alignment.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification-sta.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference-sta.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration-sta.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, if you have already completed the task filling in the missing parts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aEPath = ddb([pr_EO{1} &#039;:as&#039;]);&lt;br /&gt;
aOPath = ddb([pr_EO{2} &#039;:as&#039;]);&lt;br /&gt;
dshow([dread(aEPath); dread(aOPath)])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps-sta.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects. The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus).&lt;br /&gt;
&lt;br /&gt;
[[File:final-result-from-refined-gold-standard-sta.png|centre|thumb|600px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;, top left.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to RELION convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, RELION will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this walktrough the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO2.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;half2.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_Sharpen2.png|centre|thumb|600px| RELION Post-process I/O sharpen with automatic B-factor estimation.]]&lt;br /&gt;
[[File:Post_process_Running2.png|centre|thumb|600px| RELION Post-process I/O running with forced mask.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A, force RELION to use your FSC mask and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RELION will compute the FSC curves of the two half map with and without the FSC mask and then will select the best curve to correct and select for the final resolution estimation. It is sometimes the case, especially for membrane protein, that the unmasked FSC will be completely artefactual and this can cause problem for the RELION final resolution estimation. In these cases, RELION will suggest to force the usage of the FSC mask by the &#039;--force_mask&#039; option.&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the resolution even further. However, in this workflow, only the basic RELION steps will be exploited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open the RELION4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click on the RELION4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO_v2.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:RELION_reconstruct_Running.png|centre|thumb|600px| RELION Tomo reconstruct particle running field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make pseudo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make pseudo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make pseudo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make pseudo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make pseudo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_Running.png|centre|thumb|600px| RELION Make pseudo-subtomos running field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here but will not be done because of time limitations. This step took 40h on 8 GPUs and the computed results are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here are some notes on the chosen parameters:&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION requires a certain number of mpi processes to be defined in the Running tab. In the example, by setting 8 GPUs in the compute tab, we require 9 mpi processes: 4 for the even particles, 4 for the odd particles and one mpi master process.&amp;lt;br&amp;gt;&lt;br /&gt;
- By default RELION uses all of the GPU memory available.  GPU device memory (in Mb) to leave free after allocation can be set with the flag --free_gpu_memory.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
[[File:RELION_refine_Reference.png|centre|thumb|600px| RELION 3D auto-refine reference field. Note the low-pass and the symmetry.]]&lt;br /&gt;
[[File:RELION_refine_CTF.png|centre|thumb|600px| RELION 3D auto-refine CTF field.]]&lt;br /&gt;
[[File:RELION_refine_optimisation.png|centre|thumb|600px| RELION 3D auto-refine optimisation field. Note the mask diameter.]]&lt;br /&gt;
[[File:RELION_refine_autosampling.png|centre|thumb|600px| RELION 3D auto-refine auto-sampling field.]]&lt;br /&gt;
[[File:RELION_refine_compute.png|centre|thumb|600px| RELION 3D auto-refine compute field. Note that the ids of the GPUs are separated by the colon symbol &amp;quot;:&amp;quot;.]]&lt;br /&gt;
[[File:RELION_refine_Running.png|centre|thumb|600px| RELION 3D auto-refine running field. Note the number of mpi processes is one more than the number of GPUs]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprocessed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION FSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=File:Synthetic-height-reference-sta.png&amp;diff=4984</id>
		<title>File:Synthetic-height-reference-sta.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=File:Synthetic-height-reference-sta.png&amp;diff=4984"/>
		<updated>2024-03-05T11:53:07Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=File:Gmm-population-clasification-sta.png&amp;diff=4983</id>
		<title>File:Gmm-population-clasification-sta.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=File:Gmm-population-clasification-sta.png&amp;diff=4983"/>
		<updated>2024-03-05T11:52:16Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=High_resolution_walkthrough_with_HIV1&amp;diff=4982</id>
		<title>High resolution walkthrough with HIV1</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=High_resolution_walkthrough_with_HIV1&amp;diff=4982"/>
		<updated>2024-03-05T11:51:17Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: /* Extraction of coarse half maps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Goal of the walktrough =&lt;br /&gt;
&lt;br /&gt;
This walktrough was designed to describe and discuss the steps necessary to go from the raw microscope data of a cryo-electron tomography experiment to a high-resolution average with the relative particles position and orientations.&lt;br /&gt;
&lt;br /&gt;
In practice the EMPIAR dataset entry 10164 (https://www.ebi.ac.uk/empiar/EMPIAR-10164/) is used to analyse the structure of the GAG coat of immature HIV1 virus-like particles.&lt;br /&gt;
&lt;br /&gt;
A set of common cryoem software tools will be used such as: MotionCor2, CTFFIND 4, IMOD, Dynamo, Chimera, RELION and Bsoft.&lt;br /&gt;
&lt;br /&gt;
One of the goals is to show how these different softwares can be used in a synergistic approach to recover high resolution data. Additionally, the step-by-step description of the workflow is meant to allow users to be able to achieve the final result even by using other similar softwares that were not introduced in this walktrough.&lt;br /&gt;
&lt;br /&gt;
[[File:General_pipeline.png|centre|thumb|800px| Cryoem general pipeline shown from grid preparation to high-resolution final average. The steps presented in the figure are, from left to right: grid preparation, data acquisition in the microscope, creation of the tilt series, contrast transfer function extraction, tilt series alignment, CTF correction, tomogram generation and modelling, subtomogram averaging and finally recovery of the high resolution average.]]&lt;br /&gt;
&lt;br /&gt;
= Structure of the walkthrough =&lt;br /&gt;
&lt;br /&gt;
The full HIV1 walkthrough pipeline has been split into multiple sequential steps. Each of these steps corresponds to a subsection of this wiki page. It is possible to reach an average with about ~4 A of resolution starting from 5 tilt series by following all of the steps described in this walkthrough. The only exception is the process to create a tilt series from the microscope movies, which is only discussed in the &amp;quot;Motion correction and dose weighting&amp;quot; subsection.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
However, depending on the hardware available, a full execution of this pipeline can easily take a week of computing time. Additionally, the generated data consumes considerable amounts of memory resources. As such, this walkthrough is has been constructed to be scalable. The full version of the walkthrough code package is divided into two sections: scripts and data. The following figure represents the package tree. The data part includes all of the pre-computed intermediate files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Folder_structure_HIV1_v2.png|centre|thumb|800px| Structure of package containing the data and scripts for the HIV1 walktrough. The full version of the &#039;data&#039; part of the package is 2.2 TB. The &#039;scripts&#039; part is divided into steps. Note the correspondence between the folder names and the subsection names in this wiki page. Each step folder is divided into three parts: inputs, outputs and scripts. The input contains a set of paths to the where the input data is meant to be found in the &#039;data&#039; part of the package. The output contains a set of path of where the generated files of this step should be moved to. The scripts includes the MATLAB codes that will be executed following the practical notes in the wiki page.]]&lt;br /&gt;
&lt;br /&gt;
There are two main approaches on the implementation of walktrough with different scales of memory and computing resource requirements: with pre-computations or full execution. The two approaches are described in the following tables.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! with pre-computations&lt;br /&gt;
|-&lt;br /&gt;
| Requires an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Does not require large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for in-person workshop.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section has been made available from a physical memory.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The script generally do not need modification.&lt;br /&gt;
|-&lt;br /&gt;
| By default most scripts process only one tilt series. This is done to save computing time.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 85%;&amp;quot;&lt;br /&gt;
! full execution&lt;br /&gt;
|-&lt;br /&gt;
| Does not require an already filled &#039;data&#039; section.&lt;br /&gt;
|-&lt;br /&gt;
| Requires large computing resources.&lt;br /&gt;
|-&lt;br /&gt;
| Intended for individual practical use.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;data&#039; section starts has mostly empty. The &#039;data&#039; section can be downloaded from https://drive.google.com/file/d/1k4bLLswsacYdIGcNRc76YcbAiycxyPuX/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The &#039;script&#039; section can be downloaded from https://drive.google.com/file/d/16POOrfRc6Vw_XSidNWhcGvQzvbjivuN-/view?usp=drive_link.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts will need modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts need to be modified to process all of the tilt series. The scripts are already structured to simplify the needed modifications.&lt;br /&gt;
|-&lt;br /&gt;
| The scripts access their inputs data from the &#039;data&#039; section. As such, the &#039;data&#039; section needs to be filled with the outputs of the scripts after each step.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As mentioned previously, the &amp;quot;full-execution&amp;quot; approach requires some limited script modifications. The MATLAB scripts have been generally structured so as to present three parts. The first part consists of the paths to the input and output files. The second part is the section of parameters. The third part is a for loop on the input tilt series. As such, the typical modifications necessary for the &amp;quot;full-execution&amp;quot; approach are limited to the first part, ensuring that the inputs for all five tilt series are given.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Additionally, in the &amp;quot;full-execution&amp;quot; approach, the results of the scripts are used to populate the empty &#039;data&#039; section so that the following scripts may be able to access their input files. This means that the files need to be positioned in the correct folder tree location and with a consistent file name. To help with this process, each step has an output text file in its folder with the path and file names that need to be applied to ensure consistency.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+ Time requirements for each step&lt;br /&gt;
|-&lt;br /&gt;
! Step !! Computing time !! Interactive time !! Workshop time !! Notes&lt;br /&gt;
|-&lt;br /&gt;
! Recovery of acquisition parameters &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 5 min &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! Motion correction &lt;br /&gt;
| 1 min per tilt series with GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Not done in this walkthrough&lt;br /&gt;
|-&lt;br /&gt;
! CTF estimation &lt;br /&gt;
| 5 min for all tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using CTFFIND4&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: alignment &lt;br /&gt;
| 8 min per tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: dose weighting &lt;br /&gt;
| 3 min &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default on all tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: CTF correction &lt;br /&gt;
| 1 hour 30 min per tilt series without GPU, 5 min per tilt series with 1 GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using IMOD, executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! Automatic tilt series alignment: tomogram reconstruction &lt;br /&gt;
| 12 min per tilt series &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Executed by default only on the first tilt series&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: preparation and management of data &lt;br /&gt;
| 5 min &lt;br /&gt;
| 3 min &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: particle picking &lt;br /&gt;
| - &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| 10 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! DMMPP: particle extraction &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: creation of initial reference &lt;br /&gt;
| 1 hour 30 min &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of first per tomogram average &lt;br /&gt;
| 15 min (CPU) + 1 hour 30 min (8 GPUs) per tilt series &lt;br /&gt;
| 15 min &lt;br /&gt;
| 15 min &lt;br /&gt;
| Use of UCSF Chimera&lt;br /&gt;
|-&lt;br /&gt;
! StA: computing an average of averages &lt;br /&gt;
| 15 min (CPU) &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of second per tomogram average &lt;br /&gt;
| 30 min (CPU) + 3 hours 30 min (8 GPUs) per tilt series &lt;br /&gt;
| 25 min &lt;br /&gt;
| 15 min &lt;br /&gt;
| Use of UCSF Chimera&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of coarse half maps &lt;br /&gt;
| 22 min (CPU) + 48 hours (8 GPUs) &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! StA: extraction of refined half maps &lt;br /&gt;
| 1 hour (CPU) + 24 hours (8 GPUs) + 1 hour (CPU) per tilt series &lt;br /&gt;
| - &lt;br /&gt;
| 15 min &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
! FSC computation &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 15 min &lt;br /&gt;
| Using RELION&lt;br /&gt;
|-&lt;br /&gt;
! RELION conversion &lt;br /&gt;
| seconds &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| 5 min &lt;br /&gt;
| Using RELION&lt;br /&gt;
|-&lt;br /&gt;
! RELION refinement &lt;br /&gt;
| &amp;gt;40 hours using 8 GPU &lt;br /&gt;
|colspan=2 style=&amp;quot;text-align: center;&amp;quot;| minutes &lt;br /&gt;
| Using RELION, split into generation of a RELION template (~1h), extraction of RELION particles (~1h) and then the execution of the RELION refinement&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
= Recovery of acquisition parameters =&lt;br /&gt;
&lt;br /&gt;
A number of important characteristics of a cryo-electron microscopy experiment are necessary to properly process the data.&amp;lt;br&amp;gt;&lt;br /&gt;
As such, this first step of the walkthrough is a guided process to recover the relevant information for this datasets.&amp;lt;br&amp;gt;&lt;br /&gt;
In general, other that the sample movies themselves, the required information can be split in two parts: the characteristics of the microscope and the characteristics of the experiment.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The needed microscope characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- voltage.&amp;lt;br&amp;gt;&lt;br /&gt;
- spherical aberration.&amp;lt;br&amp;gt;&lt;br /&gt;
- amplitude contrast.&amp;lt;br&amp;gt;&lt;br /&gt;
- gain reference.&amp;lt;br&amp;gt;&lt;br /&gt;
The needed experiment characteristics are:&amp;lt;br&amp;gt;&lt;br /&gt;
- pixel size.&amp;lt;br&amp;gt;&lt;br /&gt;
- image size of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- dose.&amp;lt;br&amp;gt;&lt;br /&gt;
- tilt scheme.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The walkthrough is based on the EMPIAR dataset entry 10164. The corresponding paper is:      Florian K. M. Schur et al., An atomic model of HIV-1 capsid-SP1 reveals structures regulating assembly and maturation.Science353,506-508(2016). DOI:10.1126/science.aaf9620. and the EMD deposition is EMD-4015, https://www.ebi.ac.uk/emdb/EMD-4015?tab=experiment.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The microscope parameters are describe in the paper. The microscope that was used is a FEI TITAN KRIOS with an acceleration voltage of 300 kV. The nominal spherical aberration is of 2.7 mm. The amplitude contrast in cryo-electron tomography is ~10%. In the following the value of 7% is picked.&amp;lt;br&amp;gt;&lt;br /&gt;
The gain reference is not available for this experiment. However, the gain reference is only useful during motion correction of the movie. In this walkthrough we will start with already motion corrected and stacked tilt series. As such, the gain reference is not required for this walkthrough. In any case, more information on motion correction and on the gain reference is provided in the next section.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The experiment characteristics still need to be found. Firstly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;access the EMPIAR dataset entry 10164 by accessing the link https://www.ebi.ac.uk/empiar/EMPIAR-10164/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to the &amp;quot;Image set&amp;quot; section of the EMPIAR page.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:image_set_section.png|centre|thumb|600px| Screenshot of the EMPIAR &amp;quot;Image set&amp;quot; section.]]&lt;br /&gt;
&lt;br /&gt;
The subset of tilt series that will be used in the walktrough are TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The dataset in the EMPIAR consists in movies. As such, the &#039;&#039;&#039;Frames per image&#039;&#039;&#039; of 8 means that each movie is a set of 8 frames. In addition, we can note that &#039;&#039;&#039;Image size&#039;&#039;&#039; is (7420,7676). This refers to the size of a movie. In summary, if one of the movies in this EMPIAR dataset would be stored as a matrix, it would have the shape 7420x7676x8.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pixel size can be found by inspecting &#039;&#039;&#039;Pixel spacing&#039;&#039;&#039;, which get a pixel size of 1.35 A, and in the &#039;&#039;&#039;Details&#039;&#039;&#039; section the information of the dose can be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the dose and pixel size of the tilt series TS_01, TS_03, TS_43, TS_45 and TS_54.&amp;lt;/pre&amp;gt;&lt;br /&gt;
The size of the image size of the tilt series can now be found.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return the dimensions of the tilt series TS_01. The order is size in x, size in y and size in z. In a tilt series the z dimension is the tilt. Now run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([root,&#039;data/TS_not_dose_weighted/43.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will note that the tilt series TS_01 is one tilt shorter than the tilt series TS_43. By inspecting the tilt angles files:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/43.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/angles_files/01.rawtlt&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
you can see what tilt angle is has been removed in the tilt series TS_01. Additionally you can:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Annotate the image size of the tilt series.&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can note that the x and y sizes of the tilt series are half of the size of the movies that was indicated in the EMPIAR&lt;br /&gt;
&#039;&#039;&#039;Image size&#039;&#039;&#039; section. This is because during motion correction the micrographs are cropped to avoid aliasing. More information on this can be found in the paper: Electron counting and beam-induced motion correction enable near-atomic-resolution single-particle cryo-EM, Li, Xueming, Mooney, Paul, et al. Nature Methods, 2013, https://doi.org/10.1038/nmeth.2472&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final experiment characteristic needed is the tilt scheme. This information is generally already known, but it can also be recovered from the microscope SerialEM logs. These logs are provided for this dataset in the EMPIAR, but only partially: the logs refer to a binned output and do not present information on the dose. This is why the dose information was presented in the &#039;&#039;&#039;Details&#039;&#039;&#039; section instead.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
One of the these serialEM logs has been made available in the data folder. You can open it:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:serial_log.png|centre|thumb|600px| Screenshot of the SerialEM binned log.]]&lt;br /&gt;
&lt;br /&gt;
The log file starts with an header of six lines with some general characteristics. The binned SerialEM pixel size is consistent with eh pixel size noted in the EMPIAR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Note the Tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
The tilt axis angle in SerialEM is meant to be the angle between the axis of rotation of the sample during tilting and the axis of the detector.&lt;br /&gt;
&lt;br /&gt;
The log file is then split in section by the line [ZValue=????]. This line separates the different microscope acquisitions (i.e. each movie generation). The number of ZValue indicates the order of the acquisitions. Taking the screen shot as an example: the first block is about the first movie taken because the Zvalue is 0. The tilt angle was 0, that is the first acquisition was take with a flat sample. The second block is about the second movie because the Zvalue is 1. The second tilt angle was +3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This means that by inspection the log the tilt scheme can be recovered. The custom function parse_metadata will do this task. Run:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;[tiltAngles, indices] = parse_metadata([root,&#039;data/SERIALEM_doc/TS_01.mrc.mdoc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you can inspect the acquisition scheme by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
scatter(indices,tiltAngles,&#039;.&#039;);&lt;br /&gt;
xlabel(&#039;order of exposure&#039;);&lt;br /&gt;
ylabel(&#039;tilt angle&#039;);&lt;br /&gt;
title(&#039;Exposition scheme&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Exposition_scheme_HIV1.png|centre|thumb|600px| Dose-symmetric tilt scheme used for the HIV1 dataset.]]&lt;br /&gt;
&lt;br /&gt;
We can note that the tilt scheme is a dose-symmetric with steps of 3 degrees like: 0,+3,-3,-6,+6,+9,-9,...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A copy of the tilt scheme in an appropriate format for the following steps is already computed and can be inspected by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;n_of_preexposures = csvread([root,&#039;data/Microscope_parameters/order_list.csv&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motion correction and dose weighting =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The output of a microscope after a tilt series acquisition will be a gain image and a movie for each tilt. In practice, often a single gain file is used for all the tilt series experiments done in a microscope session. The following figure present an example of a gain reference file from a different dataset.&lt;br /&gt;
&lt;br /&gt;
[[File:an_example_of_a_gain_reference.png|centre|thumb|600px| An example of a gain reference file of a K3 detector inspected with the 3dmod command of IMOD.]]&lt;br /&gt;
&lt;br /&gt;
Some more information on reference gains can be found at the links:&amp;lt;br&amp;gt;&lt;br /&gt;
https://zmb.dozuki.com/Guide/TEM+-+TFS+Titan+Krios+G3i+-+2a:+Collect+Gain+References+for+the+K3/183&lt;br /&gt;
&lt;br /&gt;
https://relion.readthedocs.io/en/release-3.1/Reference/MovieCompression.html&lt;br /&gt;
&lt;br /&gt;
The first steps that can be done are the correction of the sample motions caused by the electron beam exposure and the gain correction.&lt;br /&gt;
&lt;br /&gt;
In this case, MotionCor2 will be used (https://emcore.ucsf.edu/ucsf-software).&lt;br /&gt;
MotionCor2 will use the movies and the gain to generate a motion-corrected micrograph per each movie. MotionCor2 should not be used to do the dose weighting at the same time as the motion correction. This is because the implementation of the dose weighting procedure in Motioncorr2 has been designed for single particle experiments, not cryo-electron tomography.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Dose weighting is meant to generate a more strict filtering of high-frequency components of the power spectra in frames that have been exposed to large doses of electrons per square angstroms. This means that the order of exposition of the tilts is crucial. This process will be done in this walkthrough after the alignment step.&lt;br /&gt;
&lt;br /&gt;
Some steps in the following walkthrough are more adapted to either the dose weighted micrographs or the not dose weighted micrographs, so it is often good to keep both available.&lt;br /&gt;
&lt;br /&gt;
Finally, the micrographs should be stacked in order of tilt (generally from negative angles to positive angles).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- a set of microscope movies.&amp;lt;br&amp;gt;&lt;br /&gt;
- a gain.&amp;lt;br&amp;gt;&lt;br /&gt;
- microscope parameters: pixel size, voltage, spherical aberration and amplitude contrast. (SPECIFY)&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angle of each movie.&amp;lt;br&amp;gt;&lt;br /&gt;
- the order of tilt exposition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of a MotionCor2 call that will generate both a dose weighted and a not dose weighted micrograph:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&#039;motioncorr2 -InMrc movie.mrc -OutMrc tilt.mrc -Patch [5 5] -Iter 30 -bft 200 -Tol 0.5 -Kv 300 -PixSize 2.73 -FmDose FMDOSE -InitDose INITDOSE -FtBin 1&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where INITDOSE will depend on the number of previous tilts in the exposition scheme. As mentioned before, the dose weighting results of Motioncorr2 are meant to be used in single particle experiments. As such, in this case, the dose weighting will instead be done during the tilt series alignment step using a MATLAB script.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note that the previous motioncorr2 call did not use a gain. If you want to use the gain you can add it with the &amp;lt;code&amp;gt;-GAIN PATHTOGAIN&amp;lt;/code&amp;gt; flag. Sometimes the gain needs to be flipped or rotated depending on what where the setting of SerialEM during the acquisition and this can be done with the &amp;lt;code&amp;gt;-RotGain&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-FlipGain&amp;lt;/code&amp;gt; flags. Note also that if Motioncorr2 cannot find or use the gain file provided, it will not terminate the motion correction and will instead continue computing without gain correction.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More practically, dynamo has a set of common preprocessing scripts that can be downloaded at: https://github.com/C-CINA/TomographyTools/tree/master/matlab_files&lt;br /&gt;
&lt;br /&gt;
With a particular note on the script preprocessing_script.m, motioncor2Wrapper.m and applyExposureFilter.m.&lt;br /&gt;
&lt;br /&gt;
The script applyExposureFilter.m can be used to apply dose weighting on a micrograph that was already motion-corrected.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- the dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CTF estimation and correction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
The CTF of each micrograph can be estimated and corrected in different ways. In this case, CTFFIND4 (https://grigoriefflab.umassmed.edu/ctffind4) was used to estimate the CTF parameters and IMOD was used to correct it using the ctfphaseflip function of IMOD (https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html).&lt;br /&gt;
&lt;br /&gt;
CTF can be tricky in cryoem because of the low dose per micrograph and the fact that the sample is tilted, causing the CTF to be different in different regions of the micrograph. In addition, the thickness of the sample means that even the CTF estimated in a region of the micrograph is in actuality caused by the entire thickness of the sample.&lt;br /&gt;
&lt;br /&gt;
These problems can apply both to the CTF estimation and the CTF correction. Some strategies that can be used to limit these problems are going to be presented in the following.&lt;br /&gt;
&lt;br /&gt;
CTF estimation:&lt;br /&gt;
It can be noted that the CTF can be done either on the dose weighted or on the not dose weighted tilt series. It should be more proper to use the not dose weighted micrographs, but in practice using the dose weighted micrographs can be more straightforward. In our case, CTFFIND4 was used on the not dose weighted tilt series.&lt;br /&gt;
&lt;br /&gt;
CTF correction:&lt;br /&gt;
ctfphaseflip locally corrects the CTF (that was estimated over the entire micrograph) by correcting the local defocus in each area using the geometric Z-offset generated by the tilt. However, this means that ctfphaseflip requires an aligned tilt series. Indeed, the automatic fiducial-based tilt series aligner of dynamo can be used to correct the CTF after generating the aligned tilt series (see following steps).&lt;br /&gt;
&lt;br /&gt;
[[File:CTF_problems_in_cryoem.png|centre|thumb|800px| Scheme showing some difficulties in handling the CTF in Cryo-electron tomography. Both the tilt of the sample and the sample thickness cause each particle to be affected by a locally different CTF. In the scheme each local CTF is noted as an &#039;overall&#039; CTF(z) in z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; in addition dz corrections. Note that z&amp;lt;sub&amp;gt;R&amp;lt;/sub&amp;gt; is a priori unknown.]]&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- the not dose weighted tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF parameters of the tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the tilt angles.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
At this time CTF estimation part will be executed. The CTF correction will be done during the alignment and reconstruction step.&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;CTF_estimation&#039; folder.&lt;br /&gt;
&lt;br /&gt;
The script &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; will use &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; to estimate the CTF parameters using CTFFIND4.&lt;br /&gt;
&lt;br /&gt;
Note that this is done by making a system call for the CTFFIND4 software. As such, it is necessary to know where the software has been installed.&lt;br /&gt;
Line 178 of &amp;lt;code&amp;gt;ctffind4Wrapper.m&amp;lt;/code&amp;gt; should be changed to be able to reach the CTFFIND4 executable. An easy way to check if the executable can be reached is to try  &amp;lt;code&amp;gt;which ctffind4&amp;lt;/code&amp;gt; in the terminal. Note that the CTFFIND4 wrapper has been created for CTFfind version 4.1.5. Using a different CTFfind version may require some limited modifications of the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the variable root to the path the the data folder.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the CTFFIND4 installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;which ctffind4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have the path to the CTFFIND4 installation you can update the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;change line 178 of ctffind4Wrapper from:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;ctffind4 &amp;lt;&amp;lt;EOF\n&#039;);    % path to ctffind4 installation (adapt if necessary)&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    fprintf(fileID,&#039;PATHTOMYCTFFIND4EXECUTABLE &amp;lt;&amp;lt;EOF\n&#039;);&lt;br /&gt;
&lt;br /&gt;
where PATHTOMYCTFFIND4EXECUTABLE was just identified.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the CTF microscope parameters need to be given to the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Update the script use_CTFFIND4_to_estimate_CTF.m in the parameters section.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script can be run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run use_CTFFIND4_to_estimate_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CTFFIND4 will generate three files for each tilt series: a &#039;XXX_diag.mrc&#039; file, a &#039;XXX_diag.txt&#039; file and a &#039;XXX_diag_avrot.txt&#039; file. Some notes on the role these files:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- &#039;XXX_diag.mrc&#039;: this file will present visually the estimated CTF on the power spectra of each tilt. The dynamo command &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; can be convenient to quickly inspect the results&amp;lt;br&amp;gt;&lt;br /&gt;
- &#039;XXX_diag.txt&#039;: this file will annotate the CTF parameters estimated for each tilt.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the CTFFIND4 result are converted in a &#039;.defocus&#039; file compatible with IMOD. This is done because IMOD will be used later to correct the CTF. This conversion is done in &amp;lt;code&amp;gt;use_CTFFIND4_to_estimate_CTF.m&amp;lt;/code&amp;gt; by calling the function &amp;lt;code&amp;gt;ctffind2imod.m&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inspect a CTFFIND4 result with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(&#039;01_diag.mrc&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will get something like this figure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ctffind4_on_unaligned_TS.png|centre|thumb|600px| Inspection using &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; of a &#039;XXX_diag.mrc&#039; file generated by CTFFIND4 on an unaligned tilt series. Note the positioning of the calculated CTF zeros on the power spectra.]]&lt;br /&gt;
&lt;br /&gt;
The Z dimension scroller correspond to moving between different tilts, and correspondingly to different relative sample thickness as well as accumulated doses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The parameters found by CTFFIND4 can be inspected by opening the XXX_diag.txt file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;01_diag.txt&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
for the CTF estimation:&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters of the tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for the CTF correction:&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned, dose-weighted, CTF-corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Alignment and reconstruction =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
Each tilt series needs to be aligned to then be able to reconstruct them in tomograms. In this approach a fiducial-based automatic alignment is used. The general concept of fiducial-based alignment is shown in the following figure. In particular, the alignment procedure will describe the alignment as a general rotation angle for the entire tilt series and then additional shifts in x and y directions for each tilt. Generally, the rotation angle can be seen as the angular difference between the axes of the detector and the axis of rotation of the sample. The x and y shifts try to model the imprecision in the sample movement during each tilt acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Concept_of_fiducial_alignment.png|centre|thumb|800px| Basic concept of fiducial-based tilt series alignment. Tilt series become naturally misaligned during the process of tilt series acquisition in the microscope (left). However, the detection of key fiducials in the micrographs can be used to determine their position in the 3D sample (center). These fiducial positions can the be used to correct the tilt series alignment (right). An automatic and robust approach to achieve this goal has been implemented in dynamo.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the tilt series has been aligned, the ctfphaseflip correction can be applied as described in the previous section.&lt;br /&gt;
&lt;br /&gt;
Finally, the aligned, dose-weighted, CTF-corrected tilt series can be used to reconstruct the tomograms. Weighted backprojection is the preferred method to generate the tomograms that will be used to generate subtomograms for the STA. SIRT can be used to generate tomograms with better contrast to more easily annotate the data with dynamo models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The automatic fiducial-based workflow (AWF) in dynamo can be used to do: the alignment, the estimation of CTF parameter, the CTF correction and finally the tomogram reconstruction. The AWF can be used either through the GUI or programmatically.&lt;br /&gt;
&lt;br /&gt;
From the dynamo wiki:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_GUI_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Walkthrough_on_command_line_based_tilt_series_alignment&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Programmatic_control_of_alignment_and_reconstruction_workflows&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AWF will generate an AWF folder in which the results will be saved.&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Tilt_series_alignment_workflow_folder&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The quality of an alignment is difficult to measure, but some general considerations can be made:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Considerations_for_tilt_series_alignment_in_IMOD&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this practical setup, a script will be used to automatically and programmatically align all tilt series, but the CTF handling and the reconstruction will be done separately. This choice was made to present in mode detail how to achieve a CTF correction and to mention how other softwares (like IMOD) can be used to reconstruct TS that were aligned using dynamo.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- (not dose-weighted) tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- gold beads parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- CTF parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The relevant information will be found in the &#039;Alignment_and_reconstruction&#039; folder. &lt;br /&gt;
&lt;br /&gt;
The work will be split in four parts: the alignment, the dose weighting, the CTF correction and finally the reconstruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;cd to the folder workshops_steps_scripts/Alignment_and_reconstruction/scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: alignment ===&lt;br /&gt;
The alignment will be generated using the script &amp;lt;code&amp;gt;make_AWF.m&amp;lt;/code&amp;gt;. This script will programmatically initialize and run the dynamo automatic fiducial-based tilt series alignment but skipping the CTF handling and the reconstruction.&lt;br /&gt;
&lt;br /&gt;
The algorithm only requires as parameters the gold bead radius, the gold bead mask, the template sidelength and the binning to apply. These parameters are determined by inspecting a tilt series. Open the first tilt series by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow([root,&#039;data/TS_not_dose_weighted/01.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will open the &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series. &lt;br /&gt;
&lt;br /&gt;
[[File:dshow_HIV1_raw.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; GUI representation of the tilt series]]&lt;br /&gt;
&lt;br /&gt;
Using the GUI tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the GUI binning tool to render the gold beads easier to see&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The binning applied is purely visual. The dimensions of the tilt series does not change and this means that the measurement with the distance tool are in full-scale pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use the measuring tool to estimate the radius of the gold beads&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This procedure allows to estimate the radius of the gold bead and the binning to apply. This is because the AWF will initially detect the gold beads using template matching on the visually binned tilt series just as it was done manually now.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next figure present visaully the relationship between parameters gold bead radius, the gold bead mask radius and the template sidelength.&lt;br /&gt;
&lt;br /&gt;
[[File:AWF_GB_definitions.png|centre|thumb|600px| Schematic representation of the AWF gold bead parameters.]]&lt;br /&gt;
&lt;br /&gt;
Generally we suggest to set the mask radius parameter as about 50% bigger than the beads radius and then set the template sidelength as the smallest that can contain the mask diameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Use this rule of thumb to estimate the gold bead radius and sidelength parameters&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to set up an AWF are: the unaligned TS, the tilt angles, the pixel size and the gold bead parameters. In addition, the dimensions of the of the reconstructed tomogram are used in the AWF. However, in this case, these values will act as fill-ins because the actual reconstruction will be done separately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script make_AWF.m (except zFullSize_a, as said before)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will do the alignment only for the first tilt series because of time limitations. Precomputed alignment are proveided in the data/AWF_projects folder.&lt;br /&gt;
Once the alignment as been completed, one (or all five if the for loop at line 33 has been changed to &amp;lt;code&amp;gt;for 1:n_tomos&amp;lt;/code&amp;gt;) .AWF project will have been generated. In particular, the aligned tilt series can be found in &#039;.AWF/align/alignedFullStack.mrc&#039;. The actual alignment parameters can be found in the files &#039;stackAligner.dyn&#039; and &#039;stackAligner.star&#039;. The information in the two files is essentially the same, but in a human-readable format in the .star file and a dynamo-readable format in the .dyn file. Inspect the alignment parameter by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;HIV_AWF_fortestsdata/TS_not_dose_weighted/01.AWF/align/stackAligner.star&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the alignment parameters shift in x, shift in y and psis angular correction. Psis is the angle between the tilt axis of the sample and the axis of the camera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;compare the psis value found in the alignment with the SerialEM tilt axis angle&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference of angle should be less than one degree. By default AWF scans the psis angle at intervals of 0.1 degrees. It is sometimes possible that there might be an offset of 180 degrees in the estimation of the tilt axis angle in different softwares depending on how the axis are defined.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The overall alignment can be inspected in multiple ways. First, to see the information about the markers found, run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.markers;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see in the log that there are no empty frames. The number of empty frames is the number of frames removed by the AWF and those frames will not appear in the aligned tilt series.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then you can inspect the fitting log. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.info.fit;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the same psi as in the one in &amp;lt;code&amp;gt;stackAligner.star&amp;lt;/code&amp;gt;. The value of the rms is also provided.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A visual inspection of the aligned tilt series can alos be done. Run:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.stack.alignedFull();&amp;lt;/pre&amp;gt;&lt;br /&gt;
The gold beads should appear like they are moving horizontally between tilt.&lt;br /&gt;
&lt;br /&gt;
[[File:ali_ts1.png|centre|thumb|600px| Aligned tilt series]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Increase the thickness value of the GUI to more than the number of tilt to have a superposition of all aligned micrographs&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:av_ali_ts1.png|centre|thumb|600px| Aligned tilt series using the superposition trick]]&lt;br /&gt;
&lt;br /&gt;
You can see the original tilt lines with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;u.view.tiltLines.unaligned;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:tilt_lines.png|centre|thumb|600px| Tilt lines before alignment]]&lt;br /&gt;
It can be noted that in this tilt series the tilt lines are mostly vertical before alignment and horizontal after alignment.&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: dose weighting ===&lt;br /&gt;
&lt;br /&gt;
The dose weighting will be done using the script &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt;. This script will dose weight a TS by calling the function &amp;lt;code&amp;gt;applyExposureFilter.m&amp;lt;/code&amp;gt;. This function implement a dose filtering based on the paper &amp;quot;Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6&amp;quot;, Grant &amp;amp; Grigorieff, elife 2015.&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned tilt series, the dose per tilt and the tilt scheme. The tilt scheme information has been provided as a .csv file and merely notes the order of exposition of all tilts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;apply_DW.m&amp;lt;/code&amp;gt; script will generate .mrc files of dose weighted tilt series. Run the script:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run apply_DW.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can compare the tilt series before and after dose weighting by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;01_DW.mrc&#039;,[root,&#039;data/AWF_projects/HIV_ali_AWF/TS_01/01.AWF/align/alignedFullStack.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will open two synchronized representation of the tilt series before and after dose weighting. The difference will be more obvious in tilt that have been subjected to larger accumulated doses.&lt;br /&gt;
&lt;br /&gt;
[[File:notDW_vs_DW.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose weighting]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: CTF correction ===&lt;br /&gt;
&lt;br /&gt;
The CTF correction will be done using the script &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt;. This script do a system call to the &amp;lt;code&amp;gt;ctfphaseflip&amp;lt;/code&amp;gt; function of IMOD. The tested version of IMOD is 4.11.12.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the line 26 of the script correct_CTF.m from:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
    system([&#039;PATHTOYOURIMOD/ctfphaseflip -InputStack &#039;,path_to_dwTS{tiltserie},...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a way to check that this worked is to type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system([&#039;PATHTOYOURIMOD/ctfphaseflip&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the path is correct you should get a description of the function inputs.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
ctfphaseflip is much faster with a GPU. If you have one available you can simply add the -gpu 0 flag.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The required data to do the dose filtering are the aligned and dose-weighted tilt series, the tilt angles, the CTF parameters (in .defocus format) and the microscope parameters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script correct_CTF.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In general, it is possible that alignment procedure may have discarded some frames (for example, black frames). In this case, it is important to ensure that the tilt series .mrc file, the CTF .defocus and the angle file match.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;correct_CTF.m&amp;lt;/code&amp;gt; script will generate .mrc files of CTF-corrected tilt series. For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/CTF_corrections.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the tilt series before and after CTF correction by typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow({&#039;stackCTF_DW_ali_01.mrc&#039;,[root,&#039;data/TS_dose_weighted_after_alignment/alignedFullStack_TS01_DW.mrc&#039;]});&amp;lt;/pre&amp;gt;&lt;br /&gt;
An easy way to check if CTF correction was applied to inspect the black areas cause by the alignment. A CTF-corrected tilt series will present a wave pattern in these areas.&lt;br /&gt;
&lt;br /&gt;
[[File:DW_DW_and_CTF.png|centre|thumb|600px| &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; Before and after dose CTF correction]]&lt;br /&gt;
&lt;br /&gt;
=== Practical notes: reconstruction ===&lt;br /&gt;
&lt;br /&gt;
The reconstruction will be done using the script &amp;lt;code&amp;gt;reconstruct_tomograms.m&amp;lt;/code&amp;gt;. This script will use the dynamo function that reconstructs a tomogram using the weighted back-projection approach. It is the same function that would have been used had we wanted to do the reconstruction directly in the AWF project.&lt;br /&gt;
&lt;br /&gt;
The required data to do the reconstructions are the dose-weighted, CTF corrected aligned TS, the tilt angles and the requested Z thickness of the tomogram.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of the script reconstruct_tomograms.m with a thickness of 2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reconstruction is equivalent to an IMOD reconstruction using the &amp;lt;code&amp;gt;tilt .... --ROTATE 90&amp;lt;/code&amp;gt; command of a tilt series aligned with the IMOD-compatible alignment parameters. These alignment parameters were generated in the AWF folder as the files &#039;stackAlignerImod.dyn&#039; and &#039;stackAlignerImod.star&#039;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;Note that the reconstruction of a full-size tomogram is resource intensive, especially in memory. In this case, the expected size of a single tomogram is about 100 GB.&amp;lt;/pre&amp;gt; All the tomograms have been pre-computed and stored in the data folder. If you wish to backproject a tomogram it may be done by running:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run reconstruct_tomograms.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
For time constrains, this is done only on the first tilt series. As usual, precomputed results can be found in the folder data/tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
You can check the dimensions of the tomogram with: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_read_mrc_size([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/pre&amp;gt;&lt;br /&gt;
and you can inspect the tomogram with: &amp;lt;code&amp;gt;dshow([&#039;recCTF_DW_ali_01.mrc&#039;])&amp;lt;/code&amp;gt;.&lt;br /&gt;
However, this is a large full-scale tomogram, so it will take a long time to load. As such, it might be best to inspect only binned tomograms. This will be done in the next section.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
= Dynamo models and particles =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
After the tomographic reconstruction, the user needs to identify the target of the biological investigation. In general, one would like to have a vectorial representation that captures the geometry of the particle distribution. This process is known as particle picking (sometimes referred to as volume annotation).&lt;br /&gt;
&lt;br /&gt;
Here, the focus is on the main structural component of HIV-1: the polyprotein Gag. Since, for instance, its ordered cleavage causes a dramatic structural rearrangement of the virus to the mature, infectious virion. In the immature virus particle, Gag is radially arranged (left, figure below). The particle segmentation model capturing such a surface is reasonably spherical/ellipsoidal. Therefore, the choice should be a dipole. This Dynamo model class is very convenient since it allows the user on-screen interaction to be reduced in directly clicking the centers that roughly correspond to the presence of individual particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Schematic-representations-of-typical-immature-viral-morphologies-dmmpp.png|centre|thumb|600px| Schematic representations of typical immature viral morphologies. Main components of the polyprotein Gag, consisting of the MA (matrix), CA (capsid), NC (nucleocapsid), and p6 domains as well as the spacer peptides SP1 and SP2. Source:  https://www.pnas.org/doi/abs/10.1073/pnas.1811237115]]&lt;br /&gt;
&lt;br /&gt;
Once the dipole sets for the particle&#039;s global region are ready, we proceed with &amp;quot;seed oversampling&amp;quot;. This technique involves creating cut points along the models to extract smaller sub-volumes. Understanding the underlying distribution, especially the degree of homogeneity and symmetry, is key to selecting a sensible oversampling configuration; it is key to success on the road to high resolution. Although, at this stage of the project the positions of these cropping points are not supposed to be realistically centered on a copy of the polyprotein of interest.&lt;br /&gt;
&lt;br /&gt;
At the end of the extraction process, you should have a crop table, a set of particles, and a template (i.e. the average of the subvolumes).&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
Prior to a more practical depiction, it is essential to pause and become aware of the data organisation and naming convention. In this regard, the user is advised to have a highly consistent data structure. The project is about to grow in size. Therefore, errors probably mean lots of hours of work lost.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:motivation-file-naming-convention-dmmpp.png|centre|thumb|300px| Motivation for establishing a file naming convention. A file naming convention is a framework for naming your files in a wav that describes what they contain and how the relate to other files.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Practical_Suggestions_for_Tomographic_Reconstruction&lt;br /&gt;
&lt;br /&gt;
=== Preparation and management of data ===&lt;br /&gt;
The organization of folder can be created by running:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
hiv1Dirs = {&#039;catalogue&#039;, &#039;particles&#039;, &#039;projects&#039;} ;&lt;br /&gt;
cellfun(@(x) mkdir(x), hiv1Dirs);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the data structure should look as&lt;br /&gt;
     .&lt;br /&gt;
     │&lt;br /&gt;
     └── workplace&lt;br /&gt;
        ├── catalogue&lt;br /&gt;
        ├── particles &lt;br /&gt;
        └── projects   &lt;br /&gt;
&lt;br /&gt;
Next, move the current directory to catalogue &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
cd catalogue &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then,  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.vll&#039; file inside the catalogue folder containing absolute paths to the tomograms (one path per line). &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;.doc&#039; file that also contains the path (absolute or relative, it is recommended to use absolute paths) to the tomograms and their volume ID needs should also be stored in the catalogue folder. That is, exactly the same content as your &#039;.vll&#039; with an ID in the beginning of each tomogram path. Remember, in MATLAB, indexing start from 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a &#039;.doc&#039; file inside the catalogue folder containing and ID followed by the absolute paths to the tomograms (one ID and path per line).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The  line  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
dcm -create c000 -fromvll tomograms.vll&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will help to create a catalogue, as a centralised manager of tomograms. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The GUI will pop up as soon as the catalog &#039;c000.ctlg&#039; is called via   &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dcm c000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create the binned version of the tomogram selecting a factor of 2. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-create-pre-binned-dmmpp.png|centre|thumb|600px| Creation of tomograms binned versions using &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, these versions will be saved inside the folder of the tomograms, not inside the catalogue folder.&lt;br /&gt;
&lt;br /&gt;
=== Particle picking === &lt;br /&gt;
&lt;br /&gt;
As commented before, this part involves on-screen interaction. For this, the main tool to work is the &#039;&#039;dcm&#039;&#039;. Just make sure to be inside the right directory (&#039;./catalogue’). &lt;br /&gt;
&lt;br /&gt;
Then,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open one tomogram through the catalogue in &#039;&#039;dtmslice&#039;&#039; (load the previously binned versions, else, there is risk of potential delay and slow performance).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:dcm-gui-open-pre-binned-tomoslice-dmmpp.png|centre|thumb|600px| Openning pre-binned tomograms via &amp;lt;code&amp;gt;dcm GUI&amp;lt;/code&amp;gt; onto tomoslice.]]&lt;br /&gt;
&lt;br /&gt;
The first thing one will probably want to do is to change the contrast, bandpass it and, if not binned, play with a certain thickness. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Adjust the tomogram appearance.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Interactively create a dipole model set.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
[[File:tomoslice-create-dipole-set-dmmpp.png|centre|thumb|600px| Creation of dipoleSet model in &amp;lt;code&amp;gt;tomoslice&amp;lt;/code&amp;gt;.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
To generate the surface parametrisation of the VLPs, every visible target is marked with only 2 clicks: one on its center and one on its surface (press keyboard letter &#039;&#039;&#039;c&#039;&#039;&#039; and &#039;&#039;&#039;n&#039;&#039;&#039;, respectively). Pressing &#039;&#039;&#039;enter&#039;&#039;&#039; saves the current dipole in the set and activates the next dipole.  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The annotation does not need to be very accurate at this point, since the following alignment projects are designed to cope with inaccuracies introduced at labelling (up to 40 pixels are tolerable). The VLP quality is not relevant, thus try to maximise the number of annotations (approx. 8 to 9 VLPs per tomogram). The reason is that bad/junk particles will be excluded in a dedicated step later on. Although, depending on your specific pipeline and requirements, data curation might be important and, for other projects, you might want to have only good quality targets. Especially if you have a lot of tomograms. &lt;br /&gt;
&lt;br /&gt;
[[File:3d-silce-along-with-active-pool-model-dmmpp.png|centre|thumb|400px| Annotated volume 3D slice along with active pool model.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Just make sure to save the dipoles to disk after the labelling of each tomogram is done.&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:reminder-save-models-to-disk-dmmpp.png|centre|thumb|400px| Saving the dipole set from memory to disk  inside the active mode menu.]]&lt;br /&gt;
&lt;br /&gt;
The catalogue will manage for you folder creation and naming (e.g., &#039;./c000/tomograms/volume_1/models/mdipoleSet.omd&#039;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Repeat the annotation process for the remaining tomograms.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Particle extraction  ===&lt;br /&gt;
&lt;br /&gt;
As commented in the opening remarks, the challenge in this section is to set the oversampling configuration. You will need to define a distribution of boxes based on the expected distribution of physical particles. To this end, open one of the binned tomograms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dtmshow -otf pathToTomogram &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to get the support needed w.r.t. the decision making process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Use the ruler tool to measure distance.&lt;br /&gt;
Decide the optimal relation of:&lt;br /&gt;
- physical distance between the particles / sampling distance in pixel of dipole model surfaces&lt;br /&gt;
- physical size of the particle / side length that you ask for the particle cropping.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:support-measurement-tool-for-oversampling-configuration-dmmpp.png|centre|thumb|400px| Zoom onto a tomogram VLP via &amp;lt;code&amp;gt;dtmshow&amp;lt;/code&amp;gt; along with a line measurement of distance to assist in the parameter selection for VLP oversampling. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have decided the oversampling configuration, the time for scripting has come. Get out the catalogue directory to the workspace and:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mkdir scripts&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, simply move or copy the downloaded wild card script and open it via &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
movefile([pathToDownloads &#039;/Dynamo_models_and_particles/scripts_wc/model_workflow.m&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open model_workflow.m &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember, you will find a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or an &#039;&#039;&#039;NaN&#039;&#039;&#039; wherever scripts need to be completed. &lt;br /&gt;
&lt;br /&gt;
Is time for to fill in the quantities missing to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Configure geometry related inputs ( i.e., sampling distance and the box size for particle extraction ). &lt;br /&gt;
Add the separation of crop points onto the vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the following task will need to be completed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Create crop points on VLP surface (oversampling).  &lt;br /&gt;
Add the radius to vesicle. &lt;br /&gt;
Create crop table from vesicle model. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, each dipole on the annotated tomogram is processed by running the &amp;lt;code&amp;gt;model_workflow.m&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
run model_workflow.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a regular lattice of coordinates (about 800 to 1,000 per tomogram) on the surface. These coordinates will be the center of the extracted subvolumes. For each tomogram and the associated set of dipoles a regular lattice of cropped subvolumens, the output will be a crop table, and a template of the initial average of those oriented particles (subvolumes).  Technically, the so-called particle extraction process involves the creation of a merged table with &amp;lt;code&amp;gt;dynamo_table_merge&amp;lt;/code&amp;gt;. Then, the cropping of sub-volumes with &amp;lt;code&amp;gt;dtcrop&amp;lt;/code&amp;gt;. It will not only crop the table but it will also manage the sub-volume tagging. Finally, templates generate averaging all the particles with &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;. While the user can implement its own version, the recommendation is to use the in-house version given that it accounts for missing wedge compensation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more details about particle extraction, Dynamo average, and Fourier compensation, the reader is referred to:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Particle_extraction&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Daverage&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Fourier_compensation_during_averaging&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;How to find out if everything went well?&#039;&#039; It is time to do a &#039;&#039;&#039;sanity check.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Display final table positions of the seed oversampling along with their orientations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalTable = dread([pathToTargetParticleFolder &#039;/crop.tbl&#039;]);&lt;br /&gt;
figure; title([num2str(size(finalTable,1)) &#039; particles.&#039;]);&lt;br /&gt;
h = dpktbl.plots.sketch(finalTable,&#039;haxis&#039;,gca()); &lt;br /&gt;
h.zlength.value=100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:table-from-seed-oversampling-dmmpp.png|centre|thumb|500px|Particles pose from crop table.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A simple average of the extracted particles, without alignment, should already reveal the VLP curvature of the surface. To check:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
finalAverage = dread([pathToTargetParticleFolder &#039;/template.em&#039;]);&lt;br /&gt;
dshow(finalAverage)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:average-bin-2-from-seed-oversampling-dmmpp.png|centre|thumb|500px| Average of cropped particles (projected in x-view). The curvature of the VLP surface is visible. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- dipole models.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
- particles.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Subtomogram averaging =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
Once multiple copies of individual protein complexes are extracted from the tomograms, the next step is to mutually align and average these sub-volumes. The ultimate goal: to yield a signal-enhanced 3D structure up to sub-nanometer or even near-atomic resolution. This technique is known as subtomogram averaging (StA).&lt;br /&gt;
&lt;br /&gt;
The general StA approach seeks to recover the common signal in the collected particles by an iterative process that alternates alignment and averaging steps. In simple words,  aligning subtomograms is the process of computing for each available particle the set of shifts and angles that will bring them to a common reference. When all the particles have been aligned, they can be averaged together. This process will run in an iterative way in order to gradually improve the attained resolution. In practice, the full dataset is split into two independent datasets that are aligned and averaged separately. The half-sets are commonly referred to as even and odd and are divided based on the particle indexing number.   The 2 half-maps are needed to validate the final map via  gold standard Fourier shell correlation (FSC) computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:alignment-project-main-block-iterative-workflow-sta.png|centre|thumb|600px| Mechanics of StA. Each iteration of StA consists of three main phases: preparation, alignment, and averaging. For the first phase, the preparation phase, the particles, reference(s), and mask(s) are loaded to memory. For the alignment phase, the reference and the mask are rotated through a predefined list of search angles. At each of the tested angles, the missing wedge in Fourier space and the rotated mask in real space are applied to the newly rotated reference. The cross-correlation between the reference and every particle is calculated, after which the shifts corresponding to the highest cross-correlation are extracted. For the averaging step, the particles selected for averaging are aligned and averaged using the angles and shifts that gave the best cross-correlation values for those particles. The average is weighted in Fourier space according to the number of times each voxel was measured. At the end of each iteration, the updated references and alignment parameters serve as input for the next iteration. ]]&lt;br /&gt;
&lt;br /&gt;
However, reaching a point where the quality is sufficient to opt for gold-standard refinement is neither simple nor straightforward. With Dynamo as the core tool for high-demand computation, and Chimera for interactive particle selection within the density maps, the protocol to be followed is as outlined here:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Creation of initial reference.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for references. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of first per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particles centering and re-averaging. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Computing an average of averages.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project for average of averages. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of second per tomogram average.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Subboxing. &amp;lt;br&amp;gt; &lt;br /&gt;
- Alignment project per tomogram.  &amp;lt;br&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Extraction of coarse half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management. &amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering, registration, and re-cropping. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extraction of refined half maps.&#039;&#039;&#039; &amp;lt;br&amp;gt; &lt;br /&gt;
- Data preparation and management.&amp;lt;br&amp;gt; &lt;br /&gt;
- Particle filtering and new initial reference computation. &amp;lt;br&amp;gt; &lt;br /&gt;
- Gold standard alignment. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- initial cropping table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
  &#039;&#039;&#039;If the reader is already familiar with &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, they may choose to skip ahead to the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The alignment project is one of the most important objects in Dynamo. It is used to design the operations carried on the particles, to select and configure the environment where the actual computations will occur, to start the computations and to access and visualise the results. For more information about the elements involved:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org//w/index.php?title=Alignment_project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command line–based workflow is convenient since allows for the projects to be streamlined and automatised for increased throughput. To create the project, it is enough to give its name (a string) to &amp;lt;code&amp;gt;dcp.new&amp;lt;/code&amp;gt; (for instance, &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject)&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Regarding file management, it is ideal to work with folders for particle storage. In some cases, it will be sufficient to initialise the new project with this folder, the table, and the mask(s). This is not possible when more than one tomogram is used. Each set of particles will be inside a different folder. In this case, access is centralised by creating a &#039;.star&#039; file.  In MATLAB, the user must store everything in generic containers (cell array). Create a dynamo object  &amp;lt;code&amp;gt;dpkdata.containers.ParticleListFile.mergeDataFolders&amp;lt;/code&amp;gt;, and use the &amp;lt;code&amp;gt;writeFile&amp;lt;/code&amp;gt; to actually write the file to disk. Dynamo objects are versatile, and, for example, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;, offers the flexibility to use the same functions with different file formats. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once all the files are ready, these can be linked to the existing project through &amp;lt;code&amp;gt;dvput&amp;lt;/code&amp;gt; followed by the name of the project, the flag, and the element (for example, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, theFolderOfMydata)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;data&#039;, starFileName)&amp;lt;/code&amp;gt;). Just make sure to create default masks in case you have not created ones &#039;&#039;ad hoc&#039;&#039; for your target, &amp;lt;code&amp;gt;dvput(theNameOfMyProject, &#039;masks&#039;, default)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The user can choose to work fully interactively. If so, the &#039;&#039;&#039;GUI dcp&#039;&#039;&#039; is the main tool. The Wizard will open unless the flag &#039;&#039;&#039;show&#039;&#039;&#039; is passed to 0 at creation time (e.g., &amp;lt;code&amp;gt;dcp.new(theNameOfMyProject, &#039;show&#039;, 0)&amp;lt;/code&amp;gt;). It will indicate with a different color what should the user input onto the project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:empty-sta-project-dcp-gui-sta.png|centre|thumb|400px| Empty StA project &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analogous to the CLI version, if applicable, do not forget to click the option for default masks use. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:default-mask-project-dcp-gui-sta.png|centre|thumb|500px| Selection of default mask creation through  &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note, that in contrast to other softwares, the data (particles) and metadata (table(s)) are explicitly different files. Therefore, at this stage of the project, it is highly recommended for the user to get acquainted with table convention that can be found here:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Table_column_convention&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, numerical parameters will be configured. They define the mathematical part of the project. Among others, in terms of sets of angles to scan, shifts to allow, used bandpass, angular refinement policy or binning options.&lt;br /&gt;
It might feel overwhelming at first. Expertise about each parameter of such configuration is required to select the optimal configuration in one-shot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A good start for analysis is the direction of the proteins based on the particle model ( defined by the vertical axis first two Euler angles). For instance, if you know the proteins are more or less orthogonal to the membrane, there is no point in scanning 360 degrees. On the other hand, the sampling of the cone must be coupled to the status of the project. That is to say, in an initial state, when there is uncertainty about the orientation, it makes no sense to sample every degree. However, a good estimate could be every 10 degrees. This reasoning also applies if you have reached your subvolumes by template matching, since at most, you have a directional error of 30 degrees. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As rule of thumb, the third Euler angle (defining the inplane rotation) can be assumed to be biased. Either for the missing wedge, or for some arbitrary sampling of the particles. Therefore, azimuth angle randomization shall be performed. The function needed is  &amp;lt;code&amp;gt;dynamo_table_randomize_azimuth&amp;lt;/code&amp;gt;. Do not forget to create a template with the new table, &amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt;, and save to disk, &amp;lt;code&amp;gt;dwrite &amp;lt;/code&amp;gt;. Again, depending on your target, a global scanning might be necessary. In contrast, if you have some premise that 90 degrees is sufficient, as is the case for HVI-1, go ahead and set it up. &lt;br /&gt;
&lt;br /&gt;
For those users who are still not confident with the orientation parameters (depicted in blue in the figure of numerical parameters), the recommendation is to complete the advance starters guide. In this walkthrough, the orientation is unravelled into separate projects. The links to the tutorial and data are as follows:&lt;br /&gt;
&lt;br /&gt;
https://www.dynamo-em.org/w/index.php?title=Advanced_starters_guide&lt;br /&gt;
&lt;br /&gt;
https://wiki.dynamo.biozentrum.unibas.ch/w/doc/data/fhv/crop.rec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To configure the position parameters, think about how likely are the particles to be shifted in x,y, and z. In most cases, after a couple of trials cropping, more precision can be expected in x,y. Whereas the z, is known to be harder to fit. Thus, it seems reasonable to permit more translational freedom in that direction.  The modus of this area of search, unless having a good reason, should be set to 1. Meaning that the limits are understood as the center of the particle. Note that mode 0 is dangerous, and accumulated shifts can lead to very large displacements. These two values are squared in gray in the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regarding filtering, try to be realistic. The default value for high pass is okay. It will prevent noise from ruining the alignment. However, the low pass filter needs to be a meaningful value. In any case, even if you are not sure, do not push Nyquist. Instead, support this decision by visualising the binned template, for instance, you might use &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt; and calculate the pixel size with  &amp;lt;code&amp;gt; dynamo_resolution &amp;lt;/code&amp;gt;. Although, if you have half maps available, it is worth it to compute the FSC curve. &lt;br /&gt;
&lt;br /&gt;
Symmetrization is a powerful technique. However, it should initially be avoided since it can induce bias. As the project evolves, if the target happens to be clearly symmetric, exploit this fact. Just be aware that symmetries that are not a subset of the sampling scheme are not recommended. Namely, any other family but circular families (&#039;&#039;&#039;cn&#039;&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
The quality, signal-to-noise ratio, and homogeneity of the target will determine the number of iterations needed. It is a trade-off between computational time and the improvement being obtained. To do this, you can open another instance of MATLAB and buy the results. &lt;br /&gt;
&lt;br /&gt;
The logical trend is that with higher resolution, the parameters can be more restrictive, accompanied by a larger particle size, and the low pass filter cutoff frequency reduced. Generally, the higher the level of detail, the more iterations will be needed for convergence. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:numerical-parameters-gui-sta.png|centre|thumb|600px| Numerical parameters configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
The computational environment will be determined by the resources you have available. Try to maximise the number of cores and GPUs as this is directly proportional to the computational time. If it is a long project, you probably do not want to use &#039;&#039;gpu 0&#039;&#039;. So that the pc used to visualise the results is not affected by the computations. In case you are sharing resources, make sure that there is no mismatch between the system ids and MATLAB (remember that the indexing for your system starts at 0 and for MATLAB at 1). &lt;br /&gt;
&lt;br /&gt;
[[File:environment-parameters-gui-sta.png|centre|thumb|400px| Environment  parameters GUI configuration overview via &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt; GUI. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The project is now ready to be checked, unfolded, and launched. Do not worry if some path is broken or not found, &amp;lt;code&amp;gt;dcp&amp;lt;/code&amp;gt;  will warn and prevent the project&#039;s launching unless it can be done safely. For this, you might want to run: &lt;br /&gt;
&lt;br /&gt;
	   &lt;br /&gt;
        &amp;lt;code&amp;gt;outputCheck = dynamo_vpr_check(theNameOfMyProject);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;code&amp;gt;if isempty(outputCheck)&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;dvrun(theNameOfMyProject,&#039;unfold&#039;,true);&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt;&lt;br /&gt;
          &amp;lt;code&amp;gt;disp(&#039;Project not safe.&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Creation of initial reference ===&lt;br /&gt;
&lt;br /&gt;
Place yourself in the &#039;./scripts&#039; directory. Then, simply move or copy the downloaded wild card script and open it via&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
 open aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that all the scripts needed for the StA section have been moved already to the scripts folder.&lt;br /&gt;
&lt;br /&gt;
Within the script, ensure you have updated the environment parameters and paths as necessary. Remember, a &#039;&#039;&#039;[!!]&#039;&#039;&#039; and/or &#039;&#039;&#039;NaN&#039;&#039;&#039; will precede the lines that require your input. Consider establishing a global variable for consistent use throughout the subsequent scripts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last table azimut needs to be randomised to avoid missing wedge bias: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Create first template with randomized azimuth. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Everything is ready to create a new project.  Below, the numerical parameters.&lt;br /&gt;
&lt;br /&gt;
[[File:initial-reference-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for initial reference alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Fill in the input values, computational, and environment parameters for pr_0. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Launch it,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; run aligment_for_reference.m &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last iteration average should look something qualitatively close to the one shown in the figure. To extract and plot the last average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; aPath  =  ddb([ pr_0 &#039;:a:ite=last&#039;]);&lt;br /&gt;
 a      = dread(aPath);&lt;br /&gt;
 dshow(a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this stage, with only one tomogram, the wild average (shifting mode 2 in the second round allows for this connotation) already reveals a strong &#039;&#039;c6&#039;&#039; symmetry. &lt;br /&gt;
&lt;br /&gt;
[[File:last-average-from-initial-reference-project-sta.png|centre|thumb|600px| Last average from initial reference alignment project (visualisation with &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;).]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of first per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
Let us start by preparing the last average by running the &amp;lt;code&amp;gt;prepare_average_for_chimera.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
re style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
prepare_average_for_chimera(pr_0)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This function will simply filter via &amp;lt;code&amp;gt;dynamo_bandpass&amp;lt;/code&amp;gt;, and invert the map.&lt;br /&gt;
&lt;br /&gt;
To open the file into Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If for some reason is not able to find the application, just give Dynamo the path,&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; dynamo_chimera(theNameOfMyMap,&#039;path&#039;,thePathToChimera) &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volumen viewer window will pop out. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt; Adjust the density threshold and, if helps, change the color. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:step-one-preprocesing-chimera-sta.png|centre|thumb|350px| Adjusting the density threshold of Chimera volume viewer. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second pre-processing step is to remove noise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Go to Tools &amp;gt; Volume Data &amp;gt; Hide Dust.&lt;br /&gt;
Adjust the percentage until one unique blob is in the scene. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:noise-configuration-chimera-sta.png|centre|thumb|375px| Adjusting the noise removal percentage of Chimera hide dust.  ]]&lt;br /&gt;
&lt;br /&gt;
The density map is ready to be annotated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the annotation window inside Tools &amp;gt; Volume Data &amp;gt; Volume Tracer. &lt;br /&gt;
Create a new marker set via File &amp;gt; New marker set. &lt;br /&gt;
Select a proper configuration for marker placement.  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-volume-tracer-sta.png|centre|thumb|275px| Configuration for marker annotation of Chimera volume tracer. ]]&lt;br /&gt;
&lt;br /&gt;
Next, rotate the average upside down: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Select a proper perspective with the help of Tool &amp;gt; Viewing Control &amp;gt; Side View (check the figure below and pay attention to the slicing tool position). &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Marking the tip of the CA-N terminal domain,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Define the center of unit cell with a marker.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Save them to disk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; Save current marker set &amp;gt;  &#039;reference_center.cmm&#039; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:chimera-reference-center-gui-sta.png|centre|thumb|600px|Center of unit cell defined in Chimera UCSF. The center of a unit cell (yellow dot) depicts the tip of the CA-N terminal domain. Marking via volume tracer tool and viewing controls adjusted via side view tool. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From here, copy and open the &amp;lt;code&amp;gt;first_aligment_per_tomogram.m&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
style=&amp;quot;color: blue&amp;quot;&amp;gt;&amp;lt;/pre&amp;gt; movefile([pathToDownloads &#039;/Subtomogram_averaging/scripts_wc/*&#039;], &#039;./scripts&#039;)&lt;br /&gt;
open first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As usual, change the paths and set up the available hardware resources,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Change paths.&lt;br /&gt;
Specify hardware resources. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Using the &#039;reference_center.cmm&#039;, the task you will need to complete is the centering and re-average of the particles.  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute the vector pointing from box center to the new coordinate.&lt;br /&gt;
Create transformation object, and transform the table per se. &lt;br /&gt;
Re-average the particles (Do not forget Fourier compensation).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, before launching an alignment project, you should perform a sanity check. To do this, visualise the volume before and after the centre and click on the corresponding coordinate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow -otf aBeforeCentering &lt;br /&gt;
dshow -otf aAfterCentering &lt;br /&gt;
&lt;br /&gt;
Pin the coordinate and compare. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:sanity_check_centering-sta.png|centre|thumb|600px| Results of pr_0 before, and after entering and re-avering. Left and right, respectively.  Coordinate of the reference center unit is displayed for comparison purposes.  Coordinate picking tool on the bottom. ]]&lt;br /&gt;
&lt;br /&gt;
From here, running the initial per tomogram alignment  is straightforward. The configuration of the project is identical to the alignment for reference but from here on, imposing a &#039;&#039;c6&#039;&#039; symmetry. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Configure the c6 symmetry on both rounds of the project.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:first-per-tomogram-and-averages-of-averages-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for first per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
Each project will take about 1 hour 30 min (estimation with 8 gpus). To directly run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run first_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The results of the last iteration symmetrised average should look something qualitatively close to the ones shown in the figure. Visualise the results and compare against the one you have obtained. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_1{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing to notice is that each average is centred. Thanks to this operation, the periphery reveals more proteic units. The biologically most relevant feature is the hexameric intra-structure of Gag, which can be observed in each of the units for all tomograms. The differences found in each tomogram can be attributed to the inherent quality of the tomogram, the structural variety of the biological target (size, imperfections, degree of immaturity of the VLP), and the randomness of the inherent process that takes place during the alignment project.&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-first-per-tomogram-average-sta.png|centre|thumb|600px| Last average from initial reference alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Computing an average of averages ===&lt;br /&gt;
To complete this small project, open the corresponding &amp;lt;code&amp;gt;aligment_for_average.m&amp;lt;/code&amp;gt; and change the paths inside,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open aligment_for_average.m &lt;br /&gt;
Change paths.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the project is maintained from  first per tomogram alignment. The difference lies in the data used. Here, as the names implies, all the tomograms averages will be merged onto one single average:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create corresponding merged table, and set:&lt;br /&gt;
- No missing wedge compensation needed.&lt;br /&gt;
- Particle tag number = tomogram number&lt;br /&gt;
- Centers.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The motivation behind this computation is to minimise manual labour in the next step. It will run quickly (near 15 minutes 8 workers), since it only contains 5 particles. Launch the project by typing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run aligment_for_average.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
To check the final average,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aPath = ddb([pr_a &#039;:as:ite=last&#039;]);&lt;br /&gt;
dtmshow(aPath)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The symmetrised average should look something qualitatively close to the one shown in the figure. &lt;br /&gt;
[[File:Final-average-from-average-of-averages-sta.png|centre|thumb|600px|  Last average from &#039;&#039;average of averages&#039;&#039; project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of second per tomogram average ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;average of averages&#039;&#039;&#039; is prepared as previously:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prepare_average_for_chimera(pr_a)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the prepared map inside Chimera,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyMap)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, every 18-meric assembly of the capsid protein p24 are marked, so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Volume tracer: File &amp;gt; New marker set&lt;br /&gt;
Mark the centers of every unit cell of the hexameric lattice &lt;br /&gt;
Save the  current marker set under &#039;particle_centers.cmm&#039;.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[File:chimera-particles-center-gui.png|centre|thumb|600px|All unit cells defined in Chimera UCSF.  The &#039;&#039;average of averages&#039;&#039; procedure, allows for candidate coordinates of all unit cells can be determined for the full dataset by manually labelling only 1 single density map.  ]]&lt;br /&gt;
&lt;br /&gt;
The rest of this is implemented inside the script second_aligment_per_tomogram.m There are a lot of things going on for data preparation before running the alignment. Thus, it is worth diving into what is going on in detail.&lt;br /&gt;
&lt;br /&gt;
We can use our previous results to set up an approach that centers the alignment on the individual. Each one of the particles in our new data set will be a subbox (a lattice unit cell) that we have just defined in the averages. The so-called &#039;&#039;&#039;subboxing technique&#039;&#039; will be used to redefine the area of interest inside a previously defined average. &lt;br /&gt;
&lt;br /&gt;
In this example, the candidate coordinates will be determined using a two-step subboxing procedure. Note that, in principle, one subboxing step would suffice. However, this would have to be done for each tomogram individually. Therefore, the motivation behind the average of average computations is to minimise manual labour. Since the average is composed of multiple subvolumes with individual orientations, these coordinates can be then translated (or mapped) onto each of those subvolumes and finally also onto the tomograms themselves. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let us now begin with the hands-on portion of the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open second_aligment_per_tomogram&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step consists in mapping coordinates back onto the averages. Similarly to what was done for re-entering, &lt;br /&gt;
the vector from box center to new coordinate for each coordinate is computed. To complete this process,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a mini table for each average that contains the corresponding coordinates.&lt;br /&gt;
Merge the mini tables.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The second step involves mapping coordinates back onto the tomograms. Now, the vector from each average box center to the new subbox center is computed. Finally, as above, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Obtain the last subboxing table per tomogram.&lt;br /&gt;
Combine the tables into one.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The coordinates describing the same volume should be removed. Therefore, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Exclude the repeated unit cell. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before cropping the particles, let us visualize the merged table generated containing the candidate positions before and after subboxing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run second_aligment_per_tomogram.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
About 5000-9000 coordinates per tomogram should have been defined. One table should suffice as a means of comparison:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;docFilePath = [root &#039;/catalogue/tomograms.doc&#039;];&lt;br /&gt;
fileID  = fopen(docFilePath); D = textscan(fileID,&#039;%d %s&#039;); fclose(fileID); tomoID  = D{1,1}&#039;;&lt;br /&gt;
idx = 1;&lt;br /&gt;
&lt;br /&gt;
tSubboxPath = [&#039;subbox_&#039; D{1,2}{idx,1}(end-7:end-4) &#039;.tbl&#039;];&lt;br /&gt;
tOriPath = ddb([pr_1{idx} &#039;:rt&#039;]);&lt;br /&gt;
&lt;br /&gt;
refs = {&#039;Before&#039;, &#039;After&#039;};&lt;br /&gt;
tbls = {tOriPath{1},tSubboxPath};&lt;br /&gt;
&lt;br /&gt;
figure;&lt;br /&gt;
for i = 1:length(refs)&lt;br /&gt;
subplot(1,2,i);title([refs{1} &#039; subboxing: &#039; num2str(size(dread(tbls{i}),1)) &#039; particles.&#039;]); h = dpktbl.plots.sketch(tbls{i},&#039;haxis&#039;,gca()); h.zlength.value=100;&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:subboxing-tbl-vs-last-ite-per-tomogram-project-tbl-sta.png|centre|thumb|600px| Resulting coordinates from particle picking via &amp;lt;code&amp;gt;dtplot&amp;lt;/code&amp;gt;. Last table from first per tomogram alignment project, left; Table after subboxing, right. The original shapes of each VLP surface are preserved.]]&lt;br /&gt;
&lt;br /&gt;
We can complete the rest of the script. So, next, we will use those coordinates to extract a new set of subvolumes with a smaller sidelength. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Re-crop subboxed particles onto corresponding folder with a box size of 192. &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prior to running the second per tomogram project, the subboxed particles are re-averaged, and save them to disk.  Since we will need input templates for the incoming project. Its configuration is found below. If we compare this second configuration with the previous, the angular search space and shift limit is reduced. This is possible because particle positions are now more accurate. Recall that the hexagonal lattice structure inherent to the immature HIV-1 CA-SP1 is the target of the present localised alignment. Nevertheless, high resolution is not of interest yet. This is the reason why subvolumes are still binned on-the-flight.&lt;br /&gt;
&lt;br /&gt;
[[File:second-per-tomogram-project-configuration-sta.png|centre|thumb|600px| Numerical parameters configuration for second per tomogram alignment project.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section, per tomogram, is estimated to take 30 minutes for the subboxing block (8 workers), and 3.5 hours for the alignment project (8 gpus). To actually compute the cropping of the particles and the corresponding alignment projects:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run second_aligment_per_tomogram.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The results after running the project demonstrate how localised alignments are capable of driving the alignment robustly. To replicate the figure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;aTsAll = [];&lt;br /&gt;
for idx = 1:nTomo&lt;br /&gt;
    aPath = ddb([pr_2{idx} &#039;:a&#039;]);&lt;br /&gt;
    aTsAll = [aTsAll; dread(aPath)];&lt;br /&gt;
end&lt;br /&gt;
dshow(aTsAll)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The higher contrast is associated with a stronger signal. This is important since a potential downside of this technique is the reduction of the amount of signal available to drive the alignment due to smaller box sizes. Therefore, is an indicative of a better estimation of their pose; a better concordance between particles (e.g. in the cavities between MA - CA , there is no density. In previous stages of the project, in these areas, there was uniformly distributed noise). Furthermore, in the  orthoslice through the CA-SP1 region (last row), each unit of lattice locally morphology was previously fuzzy.  Whereas now, the density is ordered and some helical patterns can be grasped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-second-per-tomogram-average-sta.png|centre|thumb|600px|  Last average from second per tomogram alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of coarse half maps ===&lt;br /&gt;
This block is 100% automated. As we have been doing so far, some functionalities have to be implemented in order to be able to launch it. &lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
From the last project, the tables will be gathered. Column 10 stores the CC between each aligned subvolume and the final average. The exclusion process is done by fitting a Gaussian mixture model (GMM) to the such  distribution. The MATLAB function fitgmdist will help to classify them into a combination of two populations. The one with the lower CC score is assumed to be the “bad” class (i.e., particularly bad quality or subvolumes containing pure noise). Therefore, it  needs to be excluded from the processing. The threshold is then defined by taking the minimum between the 2 Gaussian peaks and by adding an empirically defined constant of 0.01. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the table get filtered, to visualise the results add the following lines in the loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;figure;&lt;br /&gt;
hold on;&lt;br /&gt;
histogram(t(:,10), &#039;Normalization&#039;, &#039;pdf&#039;, &#039;EdgeColor&#039;, &#039;none&#039;)&lt;br /&gt;
plot(x, pdf(gmdist, x&#039;))&lt;br /&gt;
xline(thresh)&lt;br /&gt;
xlim([0 0.5])&lt;br /&gt;
legend(&#039;CC distribution&#039;,&#039;GMM fit&#039;,&#039;Threshold&#039;)&lt;br /&gt;
stackName{idx} = D{1,2}{idx,1}(end-7:end-4);&lt;br /&gt;
title([&#039;Stack: &#039; stackName{idx}])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to the subboxing section, is interesting to see how the filtering strategy worked. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Add a break point in the line where ckpt variable is declared.&lt;br /&gt;
Run coarse_gold_standard_alignment.m script section&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each stack of particles, the threshold determination and the fitted distributions in the graphs below.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:gmm-population-clasification-sta.png|centre|thumb|950px| GMM fit to the CC score distribution of the particles from each tomogram and the automatically defined threshold for particle exclusion.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following filtering, a new average per tomogram is computed. In the next step, the height of every particle is homogenised to a common center unit cell. To ensure that, independently of the tomogram, the z-height should be consistent across sub-volumes. To this end a synthetic reference is derived from a model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Compute a mask from a membrane object. &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The object&#039;s properties, thickness, radius, and side-length are already changed. In practice, you will need to visualise what you are doing. So &amp;lt;code&amp;gt;dview&amp;lt;/code&amp;gt; is what you are looking for:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dview theNameOfMyMask &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Synthetic-height-reference-sta.png|centre|thumb|550px|Synthetic reference for alignment to common height. Mask computed from membrane object X-View, left; Z-view, right. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both, template and reference, are band-passed and all the particles are aligned against it. Remember, axis orientation and x/y-shifts are already consistent due to the imposed C6 symmetry. Thus, the only permitted shift is along z-direction:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the dalign allowing only 20 pixels of z-shift (flag: &amp;quot;lim&amp;quot;).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, the resulting transformation parameters are applied to the table via &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. Again, fixing coordinates that describe the same particle and saving the table to disk.&lt;br /&gt;
&lt;br /&gt;
Finally, all subvolumes containing one centered unit cell are re-extracted one last time. The side length is of 192 pixels is preserved. This time, per tomogram, about 2,000 to 5,000 particles are expected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The point has been reached: the quality of the particles and their initial orientation are good enough to serve as the basis for a gold standard alignment. Prior to launching the project, as explained before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Merge everything to a single container&lt;br /&gt;
Get even and odd index&lt;br /&gt;
Prepare each half template.&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The configuration of the 2 independent alignment projects using the starting references that have been created before is displayed below. A total of 3 rounds with 3 iterations each are set up. The parameter search space is reduced after each round. The low-pass filter is increased to 32 pixels (8.1 Å), and the last 2 rounds are run on full-sized particles.&lt;br /&gt;
&lt;br /&gt;
[[File:coarse-half-maps-alignment-configuration.png|centre|thumb|600px|  Numerical parameters configuration for coarse half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
The estimated times are, for registration, and re-cropping, 20  min (8 workers). The coarse even/odd project is around 48 hour per half-set (8 gpus). Therefore, if you have already completed the task filling in the missing parts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run coarse_gold_standard_alignment.m&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the resulting maps:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;prEO = &#039;pr_EO&#039;;&lt;br /&gt;
aPaths = ddb([prEO &#039;:as:ite=last:ref=*&#039;]);&lt;br /&gt;
dshow([dread(aPaths{1}); dread(aPaths{2})])&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:last-average-for-coarse-half-maps-sta.png|centre|thumb|900px| Last average from coarse gold standard alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
=== Extraction of refined half maps ===&lt;br /&gt;
The script  &amp;lt;code&amp;gt;refined_gold_standard_alignment.m&amp;lt;/code&amp;gt; is responsible for refining previous results by pruning again the dataset and running a final alignment project with adapted parameters.&lt;br /&gt;
&lt;br /&gt;
Open the corresponding script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open refined_gold_standard_alignment.m &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This time, to remove particles of low quality, the dataset is reduced through a normalised, per tomogram, CC filtering. The reason for thresholding  separately is to avoid reducing the coverage of the zeros of the CTF. The risk emerges from different defocus values of the tomograms influencing the overall CC score. With the help of &amp;lt;code&amp;gt;dpksta.filters.byCC&amp;lt;/code&amp;gt;, subvolumes with a score lower than 1 standard deviation below the mean are removed. This function performs normalisation by the angle of latitude. This is important, since particles at the poles of the VLPs generally have a lower CC score than particles on the equator due to missing wedge effects. More precisely, this function works by fitting the first 2 terms of a general Fourier series to the data. As usual, after the tables are pruned, a new average is computed that will serve as reference for the last alignment project.&lt;br /&gt;
&lt;br /&gt;
For this 2 projects configuration the set up is the same parameters as the last round of the previous project but with a stricter low-pass filter up to 38 fourier pixels (~ 6.8 Å). Although, the intuition is that there is still room for improvement in terms of resolution. Therefore, the last bullet is to focus the refinement more onto the area of interest. &lt;br /&gt;
&lt;br /&gt;
[[File:refined-half-maps-alignment-configuration.png|centre|thumb|600px|   Numerical parameters configuration for refined half maps alignment project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this, the idea is to create a tighter mask. While one option is to draw the mask by hand, the choice is to exploit the already existing motives in dynamo (as last time, there is trial and error until the properties satisfy you biological target). For target the capsid:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Create a custom tight mask as the intersection of a membrane (parameters given), and a cylinder ( radius : 87; size : 192; position : [97 97 97]).&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be aware that the default mask option is still used. The new mask is overwritten via &amp;lt;code&amp;gt;dvput(theNameOfMyProject,&#039;file_mask&#039;,theNameOfMyMask)&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:adapted-mask.png|centre|thumb|600px|   Custom mask for refinement gold standard project. ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Et voilà! The latest results have been obtained. And with them, we have finished the subtomogram averaging projects. The computation time of this for the refinement project is estimated to be 24 hours per half-set (8 gpus).&lt;br /&gt;
&lt;br /&gt;
[[File:final-result-from-refined-gold-standard-sta.png|centre|thumb|600px| HIV-1 immature Gag structure, shown as cryoET final subtomogram averaging map though two orthogonal views via &amp;lt;code&amp;gt;dshow&amp;lt;/code&amp;gt;, top left.]]&lt;br /&gt;
&lt;br /&gt;
Finally, the resulting odd/even maps are reformatted and prepared. To this end, the even half-map is aligned to the odd half-map with the usual function &amp;lt;code&amp;gt;dalign&amp;lt;/code&amp;gt;. The resulting transformation parameters are used to transform the table corresponding to the even half-map though &amp;lt;code&amp;gt;dynamo_table_rigid&amp;lt;/code&amp;gt;. The table is then used to re-average the even particles using&amp;lt;code&amp;gt;daverage&amp;lt;/code&amp;gt; imposing a &#039;&#039;&#039;c6&#039;&#039;&#039; symmetry, &amp;lt;code&amp;gt;dynamo_csym&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The reason for this re-averaging is to avoid edge artifacts caused by the half-map alignment. Then, they are saved (&amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt;) according to RELION convention so that they can be used for the gold standard Fourier shell correlation (FSC) computation. This is important, since unless the map&#039;s name starts with ‘half1_*.mrc’ and  ‘half2_*.mrc’. Else, RELION will not be able to parse them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A final density map is additionally computed by re-averaging all particles of the full dataset. This isosurface visualisation is displayed below. Note the necessity of re-averaging  to ensure a correct Fourier compensation of the final map. Therefore, the corresponding flag, &#039;&#039;&#039;fc&#039;&#039;&#039; is set to true (&amp;lt;code&amp;gt;daverage(nameOfTheStarFile,&#039;t&#039;,dynamo_table_merge({theNameOfHalfMapEven, theNameOfHalfMapOdd}),&#039;fc’,1)&amp;lt;/code&amp;gt;). Then, simply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dynamo_chimera(theNameOfMyFinalMap)&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[File:isosurface-final-structure-density-map-chimera.png|centre|thumb|600px| Isosurface visualisation via Chimera of the final structure showing the immature CA-SP1 lattice viewed from outside the virus, left; from inside, right. ]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- Final high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
- Two high-resolution half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
- Particle table of high-resolution dynamo average.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Fourier shell correlation =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
At the end of a gold-standard alignment, we can estimate the resolution of the final average by comparing the Fourier shell correlation (FSC) of the two half-maps.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An FSC mask should be generated to limit the FSC computation to the areas where the protein densities are present. A better FSC mask can be used to deduce better resolutions, but a poor FSC mask can either deduce a worse resolution or even an artefactual resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So this analysis can be divided in two steps: the FSC mask creation and the actual FSC computation. Both of these steps can be done either in dynamo or in RELION. In this walktrough the alignment mask will be generated in dynamo and the FSC computation will be done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This choice was made because the mask creation in RELION (using the Mask creation job) can limit the user freedom. In fact, it will always be a Gaussian filtering and binarization of an input density map.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, the FSC computation in dynamo using the &amp;lt;code&amp;gt;dynamo_fsc&amp;lt;/code&amp;gt; function will only compute the FSC curve (https://www.dynamo-em.org/w/index.php?title=Fourier_Shell_Correlation). RELION Post-processing job will calculate the phase randomized FSC in addition to the usual FSC.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of an FSC computation using RELION on a different dataset. Note the effect of the mask on the FSC curve.&lt;br /&gt;
&lt;br /&gt;
[[File:Example_of_healty_FSC.png|centre|thumb|800px| FSC curves computation using RELION on another dataset for reference.]]&lt;br /&gt;
&lt;br /&gt;
In general, an healthy FSC computation will have the following characteristics:&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION assigns the final FSC close to the FSC of the masked half-maps (blue line, see legend).&amp;lt;br&amp;gt;&lt;br /&gt;
- The phase randomized FSC (red line) will go to zero quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
- At high frequency all FSC curves will go to zero.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must take care to note the behavior of all of the FSC curves. Some typical causes of unhealty FSC curves can be: unmasked symmetrization artefacts, sharp edges caused by the FSC mask or duplicate particles in the average.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The FSC computation will be done using RELION. Additionally, the script &amp;lt;code&amp;gt;FSC_mask_generator.m&amp;lt;/code&amp;gt; will be used to generate the FSC mask.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The even and odd averages found through dynamo have been precomputed. You can load them:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;h1 = dread([root,&#039;data/Dynamo_final_results/half1_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
h2 = dread([root,&#039;data/Dynamo_final_results/half2_final_reaveraged_unfil_ctf_corrected_thick_tomos.mrc&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can inspect the differences between the two half-maps by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(abs(h1-h2));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:H1_d_h2.png|centre|thumb|600px| Difference between halfmaps]]&lt;br /&gt;
&lt;br /&gt;
Now we can start to build the mask.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Inspect a half map and determine the dimensions and center of cylinder that would contain the middle &amp;quot;wineglass&amp;quot; structure.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generate a cylindrical mask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask = dcylinder([35,35],192,[96,96,126]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And compare it with the half-maps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;dshow(h1+mask)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_s.png|centre|thumb|600px| Mask on template]]&lt;br /&gt;
&lt;br /&gt;
As mentioned in the initial comments, the mask will be mollified to avoid sharp edges. Remove them and inspect the result:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;mask_m = dynamo_mollify(mask,3);&lt;br /&gt;
dshow(h1+mask_m)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
[[File:HIV_mask_m.png|centre|thumb|600px| Smooth mask on template]]&lt;br /&gt;
&lt;br /&gt;
The FSC mask will be created using the usual &amp;lt;code&amp;gt;dwrite&amp;lt;/code&amp;gt; command followed by the &amp;lt;code&amp;gt;dpkio.tomo.mrc.setPixelSize&amp;lt;/code&amp;gt; command to set the appropriate pixel size in Angstrom in the header of the mask .mrc file. Copy the half-maps too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;px_size = 1.35;&lt;br /&gt;
&lt;br /&gt;
dwrite(mask_m,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;FSC_mask.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dwrite(h1,&#039;half1.mrc&#039;);&lt;br /&gt;
dwrite(h2,&#039;half2.mrc&#039;);&lt;br /&gt;
&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half1.mrc&#039;);&lt;br /&gt;
dpkio.tomo.mrc.setPixelSize(px_size,&#039;half2.mrc&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now RELION will be used to estimate the resolution. The RELION job to do this analysis is the Post-processing job.&lt;br /&gt;
&lt;br /&gt;
Some relevant RELION documentation can be found in:&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/STA_tutorial/Postprocess.html&amp;lt;br&amp;gt;&lt;br /&gt;
https://relion.readthedocs.io/en/release-4.0/SPA_tutorial/Mask.html&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, we will use the the generated FSC mask and ask RELION to estimate the sharpening B-factor automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the two half-maps need to be in the same folder and follow the naming convention: &#039;half1_XXXX.mrc&#039; and &#039;half2_XXXX.mrc&#039;. It may be necessary to rename the two half-maps to be able to set them in RELION.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;load RELION4 with relion --tomo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click to the Post-processing window&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see the following GUI:&lt;br /&gt;
[[File:Post_process_IO2.png|centre|thumb|600px| RELION Post-process I/O field. Note the name of the half-map file. The second half map will be in the same folder and be named &#039;half2.mrc&#039;.]]&lt;br /&gt;
[[File:Post_process_Sharpen2.png|centre|thumb|600px| RELION Post-process I/O sharpen with automatic B-factor estimation.]]&lt;br /&gt;
[[File:Post_process_Running2.png|centre|thumb|600px| RELION Post-process I/O running with forced mask.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the GUI with half1.mrc as the map and FSC_mask.mrc as the FSC mask.&lt;br /&gt;
&lt;br /&gt;
Set the pixel size at 1.35 A, force RELION to use your FSC mask and the press Run!&lt;br /&gt;
&lt;br /&gt;
Inspect the result by using the RELION GUI Display option of the logfile.pdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RELION will compute the FSC curves of the two half map with and without the FSC mask and then will select the best curve to correct and select for the final resolution estimation. It is sometimes the case, especially for membrane protein, that the unmasked FSC will be completely artefactual and this can cause problem for the RELION final resolution estimation. In these cases, RELION will suggest to force the usage of the FSC mask by the &#039;--force_mask&#039; option.&lt;br /&gt;
&lt;br /&gt;
The sharpened final average is saved as the postprocess.mrc file in the Postprocess job folder that RELION just created.&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- The corresponding FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= RELION conversion =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
RELION has some very interesting capabilities that can be used to complement dynamo. In particular, RELION 3d auto-refine job type is useful because it allows to run the equivalent of dynamo STA on locally back-projected particles. One advantage of this approach compared to cropping particles from the tomograms is that RELION can exploit explicitly the information that each particle is, in fact, a reconstruction based on information of multiple patches. However, a more immediately practical advantage is that RELION does not need to store in memory all of the full-scale tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Some disavantages of RELION are that it needs relatively good initial particle positions to start a 3d auto-refine job correctly and that RELION allows for less control on the angular alignment search spaces that dynamo. In addition to this, RELION is not meant to receive reconstructed tomograms as inputs, but instead it requires the unaligned tilt series to allow for the local back-projection procedure. This means that RELION also needs to receive the alignment parameter of the tilt series as well as CTF and dose information, which can be confusing to implement in practice.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
However, these disadvantages can be removed by using the dynamo-RELION conversion tools. Two main tools are used in conjunction:&amp;lt;br&amp;gt;&lt;br /&gt;
- a tomogram.star generator: this script will use the results of the dynamo fiducial-based tilt series alignment to create a file for RELION that allows it to link together the tilt series alignment parameters, the CTF parameters, the dose information, the microscope information and the paths to the unaligned tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star generator: this script converts a dynamo particle table in a RELION-readable format. This allows RELION to start its 3d auto-refine with particles that of sufficient quality.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By using these tools users of dynamo can exploit the functions available in RELION. In this case, RELION will be used to refine the average generated by dynamo. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Other interesting ways to exploits the dynamo&amp;lt;-&amp;gt;RELION converters can be:&amp;lt;br&amp;gt;&lt;br /&gt;
- reconstructing only binned tomograms with dynamo and generate an initial set of particles. Next, refining the unbinned particles in RELION. This approach allows for not needing to reconstruct all of the full-sized tomograms. Indeed, for large datasets and depending on the resources available, it might not be practically possible to store in memory all of the full-sized tomograms.&amp;lt;br&amp;gt;&lt;br /&gt;
- By converting the particles from RELION to dynamo, a user can exploit the dynamo functionalities that are not available in RELION, both in data analysis and visualization.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the unaligned, not dose weighted, not CTF corrected tilt series.&amp;lt;br&amp;gt;&lt;br /&gt;
- the AWF folder paths.&amp;lt;br&amp;gt;&lt;br /&gt;
- the CTF information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the dose information.&amp;lt;br&amp;gt;&lt;br /&gt;
- the microscope parameters.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle table.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dynamo-RELION will be done using the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;. Firstly, the script will recover the CTF information, the dose information, the microscope parameters and the alignment parameters previously computed and will generate a tomogram.star file. This file allows RELION to know how to locally reconstruct subtomograms directly from the unaligned, not dose weighted, not CTF corrected tilt series.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Change the root of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the first part of the script are the path to all the files required. RELION implicitly handles dose weighting, ctf correction, tilt series alignment and local reconstructions, so RELION needs access to this information. RELION has an implementation to automatically do this but only for IMOD output folders. A custom function to do the same with dynamo alignments is used in the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The RELION also need the microscope parameters.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Update the parameters of convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part of the script &amp;lt;code&amp;gt;convert_data.m&amp;lt;/code&amp;gt; will convert dynamo particle table in a particle.star file that is meant to be compatible with the previously generated tomogram.star file. A particle.star file is paired with a tomogram.star file in similarly to how a dynamo particles table is paired with a dynamo catalogue of tomograms.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Try the conversion:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;run convert_data.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
Two files have been generated: particles_converted.star and tomogram_converted.star.&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect tomogram_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;tomogram_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
The script is divided in 6 parts: an header and 5 tomogram blocks. The header includes the information of the microscope parameters as well as the location of the raw tilt series. Each tomogram block is split in as many lines as micrographs present in that tilt series. Each lines encodes the alignment parameter, the ctf parameters and the dose.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Inspect particles_converted.star:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open(&#039;particles_converted.star&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
You will see the files has an header as well as a body with as many lines as particles. Each line includes the alignment parameters of a particle and the identification of which tilt series generates that particle.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
From here on everything can be done with RELION. For example, the particles can be shifted in Z so that the GAG layer will be centered. Do this with:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;system(&#039;relion_star_handler --i particles_converted.star --o particles_converted_shifted.star --center --center_Z 32&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- a tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- a particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Final RELION refinement =&lt;br /&gt;
== Initial comments ==&lt;br /&gt;
&lt;br /&gt;
As said in the previous section, RELION will be used to refine the average generated by dynamo. Since now the converted star file have been generated, all of the folowing steps are done in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
RELION will be used to locally backproject the particles, create an initial template and run a 3d auto-refine project. These are the RELION equivalent steps of the dynamo steps of particles cropping, particle averaging and STA.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This step is strongly inspired by the RELION Subtomogram tutorial: https://relion.readthedocs.io/en/release-4.0/STA_tutorial/index.html. In particular the &amp;quot;Make pseudo-subtomograms&amp;quot;, &amp;quot;Reconstruct particle&amp;quot;, &amp;quot;High-resolution 3D refinement&amp;quot; and &amp;quot;Masks &amp;amp; Postprocessing&amp;quot; steps. Inspection of the RELION Subtomogram tutorial can be used to find how other RELION tools can be used to improve the resolution even further. However, in this workflow, only the basic RELION steps will be exploited.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
- the tomogram.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- the particle.star.&amp;lt;br&amp;gt;&lt;br /&gt;
- The usual FSC mask.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Practical notes ==&lt;br /&gt;
&lt;br /&gt;
The Reconstruct particle job will be the first step. This will generate the template for the alignment.&amp;lt;br&amp;gt;&lt;br /&gt;
The inputs will be the tomogram.star and the particle.star generated previously and the template will be generated of size 192x192x192 unbinned pixels by local back-projection of 2D patches of dimension 512x512.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following steps indicate how to set up the RELION job.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;open the RELION4 tomogram GUI (relion --tomo)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Click on the RELION4 tomogram GUI Tomo reconstruct particles&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_IO_v2.png|centre|thumb|600px| RELION Tomo reconstruct particle I/O field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Fill in the tomogram.star and the SHIFTED particle.star that was created in the previous step.&lt;br /&gt;
&lt;br /&gt;
A version of these star files was precomputed and can be found in:&lt;br /&gt;
data/RELION_initial_starfiles/tomo.star&lt;br /&gt;
data/RELION_initial_starfiles/particle_zp32.star&lt;br /&gt;
&lt;br /&gt;
Then go on the Average page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will appear like this:&lt;br /&gt;
[[File:RELION_reconstruct_average.png|centre|thumb|600px| RELION Tomo reconstruct particle average field.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Set the parameters like in the previous figure&lt;br /&gt;
&lt;br /&gt;
Go on the Running page&lt;br /&gt;
&lt;br /&gt;
This is where you can set the computing resources available to RELION.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:RELION_reconstruct_Running.png|centre|thumb|600px| RELION Tomo reconstruct particle running field.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;br /&gt;
Once this is done, click the Run! button.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The generated &amp;lt;code&amp;gt;merged.mrc&amp;lt;/code&amp;gt; average should present the general structure of the GAG. It should look like the left-most average of the following figure:&lt;br /&gt;
&lt;br /&gt;
[[File:range_of_relion_initial_positions.png|centre|thumb|600px| RELION Make pseudo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
The creation of all of the particles is done with the Make pseudo-subtomos job. The same size as the template are used.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Make pseudo-subtomos step is described here put will not be done because of time limitations&amp;lt;/pre&amp;gt;&lt;br /&gt;
A RELION job can be chained by giving as input of a job the optimisation set of a previous completed job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_IO.png|centre|thumb|600px| RELION Make pseudo-subtomos I/O field.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_psuedo_reconstuct.png|centre|thumb|600px| RELION Make pseudo-subtomos reconstruct field.]]&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_pseudo_Running.png|centre|thumb|600px| RELION Make pseudo-subtomos running field.]]&lt;br /&gt;
&lt;br /&gt;
Finally a 3D auto-refinement job can be started. The following parameters can be given:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;This Refine3D step is described here but will not be done because of time limitations. This step took 40h on 8 GPUs and the computed results are provided in the folder:&lt;br /&gt;
&lt;br /&gt;
data/RELION_final_results/refinement&lt;br /&gt;
data/RELION_final_results/postprocess&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here are some notes on the chosen parameters:&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference can be band-passed at 12 A. A non-bandpassed reference could generate artefacts.&amp;lt;br&amp;gt;&lt;br /&gt;
- the reference will be C6.&amp;lt;br&amp;gt;&lt;br /&gt;
- a convenient Mask diameter is 230 A. This created a spherical mask that is used in addition to the alignment mask.&amp;lt;br&amp;gt;&lt;br /&gt;
- an initial angular sampling of 3.7 degrees and an initial offset range of 5 pixels with step of 1 pixel.&amp;lt;br&amp;gt;&lt;br /&gt;
- If possible, GPU computing should be used with the identifications of all GPUs&amp;lt;br&amp;gt;&lt;br /&gt;
- RELION requires a certain number of mpi processes to be defined in the Running tab. In the example, by setting 8 GPUs in the compute tab, we require 9 mpi processes: 4 for the even particles, 4 for the odd particles and one mpi master process.&amp;lt;br&amp;gt;&lt;br /&gt;
- By default RELION uses all of the GPU memory available.  GPU device memory (in Mb) to leave free after allocation can be set with the flag --free_gpu_memory.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:RELION_refine_IO.png|centre|thumb|600px| RELION 3D auto-refine I/O field.]]&lt;br /&gt;
[[File:RELION_refine_Reference.png|centre|thumb|600px| RELION 3D auto-refine reference field. Note the low-pass and the symmetry.]]&lt;br /&gt;
[[File:RELION_refine_CTF.png|centre|thumb|600px| RELION 3D auto-refine CTF field.]]&lt;br /&gt;
[[File:RELION_refine_optimisation.png|centre|thumb|600px| RELION 3D auto-refine optimisation field. Note the mask diameter.]]&lt;br /&gt;
[[File:RELION_refine_autosampling.png|centre|thumb|600px| RELION 3D auto-refine auto-sampling field.]]&lt;br /&gt;
[[File:RELION_refine_compute.png|centre|thumb|600px| RELION 3D auto-refine compute field. Note that the ids of the GPUs are separated by the colon symbol &amp;quot;:&amp;quot;.]]&lt;br /&gt;
[[File:RELION_refine_Running.png|centre|thumb|600px| RELION 3D auto-refine running field. Note the number of mpi processes is one more than the number of GPUs]]&lt;br /&gt;
&lt;br /&gt;
The final refined and postprocessed average can be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;relion_refined_average = dread([root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;]);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: blue&amp;quot;&amp;gt;Open the [root,&#039;data/RELION_final_results/postprocess/postprocess.mrc&#039;] file with Chimera, set the step to 1 and use the tool/Hide Dust function to clear the view.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:final_chimera_HIV1.png|centre|thumb|600px| Chimera screenshot with Hide dust tool.]]&lt;br /&gt;
&lt;br /&gt;
[[File:final_FSC_curve.png|centre|thumb|600px| RELION FSC computed curve of the HIV1 average.]]&lt;br /&gt;
&lt;br /&gt;
== Outputs ==&lt;br /&gt;
&lt;br /&gt;
- two half-maps generated using the gold standard protocol in RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the FSC curve.&amp;lt;br&amp;gt;&lt;br /&gt;
- the high-resolution average RELION.&amp;lt;br&amp;gt;&lt;br /&gt;
- the aligned particle positions in RELION.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=File:Last-average-second-per-tomogram-average-sta.png&amp;diff=4981</id>
		<title>File:Last-average-second-per-tomogram-average-sta.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=File:Last-average-second-per-tomogram-average-sta.png&amp;diff=4981"/>
		<updated>2024-03-05T11:31:36Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
	<entry>
		<id>https://www.dynamo-em.org//w/index.php?title=File:Subboxing-tbl-vs-last-ite-per-tomogram-project-tbl-sta.png&amp;diff=4980</id>
		<title>File:Subboxing-tbl-vs-last-ite-per-tomogram-project-tbl-sta.png</title>
		<link rel="alternate" type="text/html" href="https://www.dynamo-em.org//w/index.php?title=File:Subboxing-tbl-vs-last-ite-per-tomogram-project-tbl-sta.png&amp;diff=4980"/>
		<updated>2024-03-05T11:30:08Z</updated>

		<summary type="html">&lt;p&gt;AlmaVivas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>AlmaVivas</name></author>
	</entry>
</feed>