本家様 https://grigoriefflab.umassmed.edu/ctf_estimation_ctffind_ctftilt

RockyLinux8で使ってみる
提供されているバイナリーバージョンの「ctffind-4.1.14-linux64.tar.gz」はREL7系(CentOS7)ではうまく動く.
しかしRHEL8系のRockyLinux8では実行すると下記のようにcore dumpして終わる.

Segmentation fault (core dumped)

動かいないみたい。
っで、ソースコードを入手して、コンパイルしてみる。

ソース展開、コンパイル

コンパイルに必要なライブラリをインストールします。

[root@c ~]# dnf --enablerepo=epel install wxBase3-devel wxGTK3-devel fftw-devel libtiff-devel libjpeg-turbo-devel

本家様からソースコードをダウンロードして展開します

[root@c ~]# cd /apps/src
[root@c src]# gzip -cd ctffind-4.1.14.tar.gz | tar xf -
[root@c src]# cd ctffind-4.1.14

ここで
https://grigoriefflab.umassmed.edu/comment/1696#comment-1696にある調整を加えます
具体的には下記のようにプログラムコードを修正します

--- ctffind-4.1.14/src/programs/ctffind/ctffind.cpp.orig        2020-05-09 02:28:31.000000000 +0900
+++ ctffind-4.1.14/src/programs/ctffind/ctffind.cpp     2021-11-09 13:08:47.351398779 +0900
@@ -267,11 +267,11 @@
 float FindRotationalAlignmentBetweenTwoStacksOfImages(Image *self, Image *other_image, int number_of_images, float search_half_range, float search_step_size, float minimum_radius, float maximum_radius);
 void ComputeImagesWithNumberOfExtremaAndCTFValues(CTF *ctf, Image *number_of_extrema, Image *ctf_values);
 int ReturnSpectrumBinNumber(int number_of_bins, float number_of_extrema_profile[], Image *number_of_extrema, long address, Image *ctf_values, float ctf_values_profile[]);
-bool ComputeRotationalAverageOfPowerSpectrum( Image *spectrum, CTF *ctf, Image *number_of_extrema, Image *ctf_values, int number_of_bins, double spatial_frequency[], double average[], double average_fit[], double average_renormalized[], float number_of_extrema_profile[], float ctf_values_profile[]);
+void ComputeRotationalAverageOfPowerSpectrum( Image *spectrum, CTF *ctf, Image *number_of_extrema, Image *ctf_values, int number_of_bins, double spatial_frequency[], double average[], double average_fit[], double average_renormalized[], float number_of_extrema_profile[], float ctf_values_profile[]);
 void ComputeEquiPhaseAverageOfPowerSpectrum( Image *spectrum, CTF *ctf, Curve *epa_pre_max, Curve *epa_post_max);
 void OverlayCTF( Image *spectrum, CTF *ctf, Image *number_of_extrema, Image *ctf_values, int number_of_bins_in_1d_spectra, double spatial_frequency[], double rotational_average_astig[], float number_of_extrema_profile[], float ctf_values_profile[], Curve *equiphase_average_pre_max, Curve *equiphase_average_post_max);
 void ComputeFRCBetween1DSpectrumAndFit( int number_of_bins, double average[], double fit[], float number_of_extrema_profile[], double frc[], double frc_sigma[], int first_fit_bin);
-bool RescaleSpectrumAndRotationalAverage( Image *spectrum, Image *number_of_extrema, Image *ctf_values, int number_of_bins, double spatial_frequency[], double average[], double average_fit[], float number_of_extrema_profile[], float ctf_values_profile[], int last_bin_without_aliasing, int last_bin_with_good_fit );
+void RescaleSpectrumAndRotationalAverage( Image *spectrum, Image *number_of_extrema, Image *ctf_values, int number_of_bins, double spatial_frequency[], double average[], double average_fit[], float number_of_extrema_profile[], float ctf_values_profile[], int last_bin_without_aliasing, int last_bin_with_good_fit );
 void Renormalize1DSpectrumForFRC( int number_of_bins, double average[], double fit[], float number_of_extrema_profile[]);
 float ReturnAzimuthToUseFor1DPlots(CTF *ctf);
 
@@ -2419,7 +2419,7 @@
 
 // Rescale the spectrum and its 1D rotational avereage so that the peaks and troughs are at 0.0 and 1.0. The location of peaks and troughs are worked out
 // by parsing the suppilied 1D average_fit array
-bool RescaleSpectrumAndRotationalAverage( Image *spectrum, Image *number_of_extrema, Image *ctf_values, int number_of_bins, double spatial_frequency[], double average[], double average_fit[], float number_of_extrema_profile[], float ctf_values_profile[], int last_bin_without_aliasing, int last_bin_with_good_fit )
+void RescaleSpectrumAndRotationalAverage( Image *spectrum, Image *number_of_extrema, Image *ctf_values, int number_of_bins, double spatial_frequency[], double average[], double average_fit[], float number_of_extrema_profile[], float ctf_values_profile[], int last_bin_without_aliasing, int last_bin_with_good_fit )
 {
        MyDebugAssertTrue(spectrum->is_in_memory, "Spectrum memory not allocated");
        MyDebugAssertTrue(number_of_bins > 1,"Bad number of bins: %i\n",number_of_bins);
@@ -2762,7 +2762,7 @@
 }
 
 //
-bool ComputeRotationalAverageOfPowerSpectrum( Image *spectrum, CTF *ctf, Image *number_of_extrema, Image *ctf_values, int number_of_bins, double spatial_frequency[], double average[], double average_fit[], double average_rank[], float number_of_extrema_profile[], float ctf_values_profile[])
+void ComputeRotationalAverageOfPowerSpectrum( Image *spectrum, CTF *ctf, Image *number_of_extrema, Image *ctf_values, int number_of_bins, double spatial_frequency[], double average[], double average_fit[], double average_rank[], float number_of_extrema_profile[], float ctf_values_profile[])
 {
        MyDebugAssertTrue(spectrum->is_in_memory, "Spectrum memory not allocated");
        MyDebugAssertTrue(number_of_extrema->is_in_memory,"Number of extrema image not allocated");

そうして

[root@c ctffind-4.1.14]# ./configure --prefix=/apps/ctffind-4.1.14
[root@c ctffind-4.1.14]# make; make install

使う

大抵は relion からコールされて使うのが常なのであんまりそのままでは使わない。
けど、こんな感じでインターラクティヴに使うものです。
(ヒアドキュメントみたいな実行方法もあるけど)

[root@c ~]# /apps/ctffind-4.1.14/bin/ctffind
 
 
        **   Welcome to Ctffind   **
 
            Version : 4.1.14
           Compiled : Nov  9 2021
               Mode : Interactive
 
Input image file name [input.mrc]                  :

コンパイルしたアプリを使うなら

コンパイル済みのアプリを他のpcに運んで使う際、下記が必要みたい

wxBase3

が必要

m1 macOSでctffind

作ってみた
まず Apple/command#s51b110d のように Homebrew をインストールします
その後に

[supervisor@mini-m1 ~]$ brew install fftw
[supervisor@mini-m1 ~]$ brew install wxWidgets

と fftw と wxWidgets をインストールします.
っでctffindのソースを展開して

[supervisor@mini-m1 ~]$ cd src
[supervisor@mini-m1 ~/src]$ tar xf ctffind-4.1.14.tar.gz
[supervisor@mini-m1 ~/src]$ cd ctffind-4.1.14
[supervisor@mini-m1 ~/src/ctffind-4.1.14]$

ここでソースコードの一部を修正します。上記のvoid修正を施した後に追加で下記のように「src/core/matrix.cpp」を修正します

--- src/core/matrix.cpp.orig    2022-09-28 01:19:32.000000000 +0900
+++ src/core/matrix.cpp 2022-09-28 01:27:54.000000000 +0900
@@ -4,7 +4,11 @@
 // think i got it from a book i had about game programming in c.. it's probably slower than what the compiler would do these days.
 
 #define AL_PI        3.14159265358979323846
-#define _AL_SINCOS(x, s, c)  __asm__ ("fsincos" : "=t" (c), "=u" (s) : "0" (x))
+#if defined(__i386__) || defined(__x86_64__)
+#define _AL_SINCOS(x, s, c) __asm__ ("fsincos" : "=t" (c), "=u" (s) : "0" (x))
+#else
+#define _AL_SINCOS(x, s, c) s = sinf(x); c = cosf(x);
+#endif
 #define FLOATSINCOS(x, s, c)  _AL_SINCOS((x) * AL_PI / 128.0, s ,c)
 
 #define MAKE_ROTATION_f(x, y, z)                \

その上で

[supervisor@mini-m1 ~/src/ctffind-4.1.14]$ ./configure --with-fftw-dir=/opt/homebrew
 
[supervisor@mini-m1 ~/src/ctffind-4.1.14]$ make

これで ctffind が作れます

[supervisor@mini-m1 ~/src/ctffind-4.1.14]$ ./ctffind
 
 
        **   Welcome to Ctffind   **
 
            Version : 4.1.14
           Compiled : Sep 28 2022
               Mode : Interactive
 
Input image file name [input.mrc]                  : ^C
[supervisor@mini-m1 ~/src/ctffind-4.1.14]$

な感じです


トップ   編集 添付 複製 名前変更     ヘルプ   最終更新のRSS
Last-modified: 2022-09-28 (水) 01:58:23 (255d)