├── .gitignore ├── convert_to_jpg.bash ├── rename_files.bash ├── gold_or_no_gold.com ├── gnuplot_fsc.bash ├── ice_catcher.bash ├── project_map.bash ├── README.md ├── half_half_mapmaker.bash ├── star2jpg.bash ├── star2jpg_part_threshold.com └── run_ctffind.com /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /convert_to_jpg.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #run as: ./convert_to_jpg *.mrc 3 | for i in "$@" # for every item matching pattern suplied on command line do the following: 4 | do 5 | mrc2tif -S -C ${i} ${i%.mrc}.tif 6 | convert -contrast-stretch -4%x0.5% -auto-gamma -brightness-contrast 10x20 -quality 100 -resize 20% ${i%.mrc}.tif ${i%.mrc}_enhanced.jpg 7 | rm ${i%.mrc}.tif 8 | done 9 | -------------------------------------------------------------------------------- /rename_files.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #Usage: ./rename_files.com 17feb*mrc 3 | #Output: {prefix}_00001.mrc, {prefix}_00002.mrc, etc 4 | PREFIX="mic" 5 | N=1 6 | for i in "$@" #For file in pattern supplied on command line (e.g.17feb*mrc) 7 | do 8 | printf -v J "%05d" $N #Pad counter with zeroes to fixed width 9 | rename "s/.*\./${PREFIX}_${J}\./" ${i} #Rename each file to PREFIX_number.SUFFIX 10 | N=$((N+1)) #Increment counter 11 | done 12 | -------------------------------------------------------------------------------- /gold_or_no_gold.com: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #if histogram is bimodal, guess that there is gold or carbon in frame, write to gold.lst 3 | #Otherwise, write to no_gold.lst 4 | touch no_gold.lst 5 | touch gold.lst 6 | for i in "$@" #For file in pattern supplied on command line (e.g.17feb*mrc) 7 | do 8 | clip histogram -s ${i} > histogram.tmp 9 | tail -n1 histogram.tmp > histogram_cut.tmp 10 | GOLD_QUERY=`cat histogram.tmp | wc -l` 11 | if [[ ${GOLD_QUERY} == 3 ]]; then 12 | echo ${i} >> gold.lst 13 | else 14 | echo ${i} >> no_gold.lst 15 | fi 16 | done 17 | -------------------------------------------------------------------------------- /gnuplot_fsc.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #run as ./gnuplot_fsc.bash relion_post.star 3 | #plots Res. vs corrected FSC (assuming these are in 3rd and fourth columns of star file) 4 | file1="$@" 5 | awk 'NR > 3 {if (NF > 6) print 1.0/$3,$4}' $file1 > ${file1}.tmp 6 | gnuplot<p { p = NF } 20 | END { 21 | for(j=1; j<=p; j++) { 22 | str=a[1,j] 23 | for(i=2; i<=NR; i++){ 24 | str=str" "a[i,j]; 25 | } 26 | print str 27 | } 28 | }' > tmp1 29 | 30 | ice_intensity=`grep "0.271436" tmp1 | awk '{print $3}' | bc -l` 31 | 32 | echo "ice_intensity=${ice_intensity}" 33 | if (( $(echo "$ice_intensity > $ice_threshold" | bc -l ) )); then 34 | echo "${basename} ${ice_intensity}" >> icy_list.txt 35 | fi 36 | done 37 | sort -k2nr icy_list.txt > icy_list_sorted.txt 38 | -------------------------------------------------------------------------------- /project_map.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #Run as ./project.bash map.mrc 3 | #Useful to generate stack of projections in various orientations 4 | 5 | #Reminder; Euler angles defined such that rot is rotation about initial z; tilt is rotation about new y (y'), 6 | #and psi is rotation about final z (z"). So no need to alter psi for purposes of generating templates (as 7 | #it will only affect 2D orientation of final template, which doesn't matter when searching) 8 | 9 | APIX=4.28 #pixel size of input model 10 | 11 | #Change these depending on symm 12 | angles_rot=( 0 22.5 45 67.5) 13 | angles_tilt=( 0 22.5 45 67.5 90 ) 14 | 15 | touch tmp.star 16 | 17 | echo " 18 | data_ 19 | 20 | loop_ 21 | _rlnImageName #1" > tmp.star 22 | wait 23 | for rot in ${angles_rot[@]} 24 | do 25 | for tilt in ${angles_tilt[@]} 26 | do 27 | relion_project --i "$@" --rot ${rot} --tilt ${tilt} --psi 0 --xoff 0 --yoff 0 --ctf --o ${rot}_${tilt}_0.mrc --angpix ${APIX} 28 | wait 29 | echo "${rot}_${tilt}_0.mrc" >> tmp.star 30 | wait 31 | done 32 | done 33 | relion_stack_create --i tmp.star --o out_stack 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EM-scripts 2 | 3 | Various jiffies that I find useful for data processing. 4 | 5 | `convert_to_jpg` uses ImageMagick to make a nice-looking jpg from an mrc. 6 | 7 | `project_map` makes several projections of an input map in selected 8 | orientations using relion_project, and generates a stack of these 9 | projections for use as particle-picking templates. 10 | 11 | `rename_files` renames a set of files to mic_00001.mrc, mic_00002.mrc, 12 | etc. 13 | 14 | `star2jpg` takes a relion-generated data.star as input and uses 15 | ImageMagick to create jpgs of each mic with particle positions and 16 | numbers indicated, and per-mic Pmax, NSS and defocus printed - useful 17 | for post-refinement screening of mics, or as a sanity check to assess 18 | junkiness of 2D/3D classes. 19 | 20 | `unblur_gctf_wrapper` runs unblur and Gctf, and creates contrast-adjusted jpg images with defocus etc written for diagnosis/screening. Requires ImageMagick. You may need to edit the names of the unblur, summovie and gctf executables. Run on multiple cores using GNU parallel, e.g.: `find ./ -maxdepth 1 -name "mic*mrc" -print | parallel -j 12 './unblur.com {/}' >& log &` 21 | 22 | `gnuplot_fsc` makes a pretty-ish FSC curve in SVG format from `relion_postprocess` star file using gnuplot. 23 | 24 | `ice_catcher` tries to guess whether an image has crystalline ice. Input is \_avrot.txt files from CTFFIND. 25 | 26 | `gold_or_no_gold` tries to guess whether an image has gold/carbon/vaccum present in the frame based on whether the histogram is bimodal or not. 27 | 28 | `run_ctffind` runs ctffind on movies and generates some diagnostics (e.g. ice_catcher is integrated) 29 | -------------------------------------------------------------------------------- /half_half_mapmaker.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #Run as ./half_half_maps.com data.star 3 | 4 | 5 | angpix=1.255 #pixel size of input data star 6 | threads=24 #threads for each relion_reconstruct job 7 | prefix="vol" #prefix for output files 8 | 9 | #Shouldn't need to alter anything further down 10 | 11 | data_star="$@" 12 | 13 | rand_field=`grep _rlnRandomSubset "$@" | awk 'BEGIN {FS="#"} ; {print $2}'` 14 | 15 | #get header 16 | awk '{if (NF<=2) {print}}' < $data_star > head.tmp 17 | 18 | #get body 19 | awk '{if (NF>2) {print}}' < $data_star > body.tmp 20 | 21 | wait 22 | 23 | #shuffle body 24 | shuf -o body_shuf.tmp body.tmp 25 | 26 | #split into two files (xaa and xab) 27 | split --number l/2 body_shuf.tmp 28 | 29 | wait 30 | 31 | awk -v rand_field=$rand_field '{if ($rand_field==1) {print}}' xaa > half1_half1.tmp 32 | 33 | awk -v rand_field=$rand_field '{if ($rand_field==2) {print}}' xaa > half1_half2.tmp 34 | 35 | awk -v rand_field=$rand_field '{if ($rand_field==1) {print}}' xab > half2_half1.tmp 36 | 37 | awk -v rand_field=$rand_field '{if ($rand_field==2) {print}}' xab > half2_half2.tmp 38 | 39 | wait 40 | 41 | cat head.tmp half1_half1.tmp > ${prefix}_half1_half1.star 42 | 43 | cat head.tmp half1_half2.tmp > ${prefix}_half1_half2.star 44 | 45 | cat head.tmp half2_half1.tmp > ${prefix}_half2_half1.star 46 | 47 | cat head.tmp half2_half2.tmp > ${prefix}_half2_half2.star 48 | 49 | wait 50 | 51 | relion_reconstruct --i ${prefix}_half1_half1.star --o ${prefix}_half1_half1_class001_unfil.mrc --angpix $angpix --ctf --j $threads >& half1_half1.log & 52 | 53 | relion_reconstruct --i ${prefix}_half1_half2.star --o ${prefix}_half1_half2_class001_unfil.mrc --angpix $angpix --ctf --j $threads >& half1_half2.log & 54 | 55 | relion_reconstruct --i ${prefix}_half2_half1.star --o ${prefix}_half2_half1_class001_unfil.mrc --angpix $angpix --ctf --j $threads >& half2_half1.log & 56 | 57 | relion_reconstruct --i ${prefix}_half2_half2.star --o ${prefix}_half2_half2_class001_unfil.mrc --angpix $angpix --ctf --j $threads >& half2_half2.log & 58 | 59 | rm xaa 60 | 61 | rm xab 62 | 63 | rm body.tmp 64 | 65 | rm body_shuf.tmp 66 | 67 | rm head.tmp 68 | 69 | rm half?_half?.tmp 70 | -------------------------------------------------------------------------------- /star2jpg.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #run as ./star2jpg.com data.star 3 | 4 | RADIUS=10 #particle radius in pixels 5 | 6 | MIC_FIELD=`grep _rlnMicrographName "$@" | awk 'BEGIN {FS="#"} ; {print $2}'` 7 | X_FIELD=`grep _rlnCoordinateX "$@" | awk 'BEGIN {FS="#"} ; {print $2}'` 8 | Y_FIELD=`grep _rlnCoordinateY "$@" | awk 'BEGIN {FS="#"} ; {print $2}'` 9 | DEF_FIELD=`grep _rlnDefocusU "$@" | awk 'BEGIN {FS="#"} ; {print $2}'` 10 | PART_FIELD=`grep _rlnImageName "$@" | awk 'BEGIN {FS="#"} ; {print $2}'` 11 | 12 | awk -v mic_field=$MIC_FIELD '(NF>=3){print $mic_field}' "$@" | sort | uniq > tmp_mic_list 13 | sed -i '/^$/d' tmp_mic_list 14 | 15 | #check that we have Imagemagick etc: 16 | hash convert 2>/dev/null || { echo >&2 "Can't find convert - check that ImageMagick is available"; exit 1; } 17 | 18 | 19 | mkdir jpg_out 20 | 21 | while read line; do 22 | mic_name=$(cut -d ' ' -f${MIC_FIELD} <<< $line) 23 | mrc2tif -S -C ${mic_name} tmp.tif 24 | mic_name=${mic_name##*/} 25 | grep $mic_name "$@" > single_mic.star 26 | particle_count=`cat single_mic.star | wc -l` 27 | convert tmp.tif -morphology Convolve Gaussian:0x2 tmp.tif 28 | convert -contrast-stretch -4%x0.5% -auto-gamma -brightness-contrast 10x20 -resize 15% -rotate 180 -flop tmp.tif ${particle_count}p_${mic_name%.mrc}.jpg 29 | cp ${particle_count}p_${mic_name%.mrc}.jpg tmp_unlabeled.jpg 30 | touch tmp_cmd_file 31 | while read line2; do 32 | x_coord=$(cut -d ' ' -f${X_FIELD} <<< $line2) 33 | y_coord=$(cut -d ' ' -f${Y_FIELD} <<< $line2) 34 | defocus=$(cut -d ' ' -f${DEF_FIELD} <<< $line2) 35 | x_coord=`echo "$x_coord*0.15" | bc -l` 36 | y_coord=`echo "$y_coord*0.15" | bc -l` 37 | part_name=$(cut -d ' ' -f${PART_FIELD} <<< $line2) 38 | part_no=$(cut -d '@' -f1 <<< $part_name) 39 | part_no=$((10#$part_no)) 40 | edge=`echo "$x_coord+($RADIUS*0.15)" | bc -l` 41 | echo "-draw \"circle ${x_coord},${y_coord} ${edge},${y_coord}\"" >> tmp_cmd_file 42 | done < single_mic.star 43 | defocus=`echo "$defocus*0.0001" | bc -l` 44 | defocus=$( printf "%1.1f" $defocus ) 45 | convert -stroke Firebrick -strokewidth 2 -fill red @tmp_cmd_file -gravity northwest -fill RoyalBlue3 -stroke none -pointsize 20 -annotate 0x0+0+15 "Defocus: ${defocus}µm, ${particle_count} particles" ${particle_count}p_${mic_name%.mrc}.jpg ${particle_count}p_${mic_name%.mrc}.jpg 46 | # convert -gravity northwest -fill DarkBlue -pointsize 20 -annotate 0x0+0+15 "Defocus: ${defocus}µm, ${particle_count} particles" ${particle_count}p_${mic_name%.mrc}.jpg ${particle_count}p_${mic_name%.mrc}.jpg 47 | convert ${particle_count}p_${mic_name%.mrc}.jpg tmp_unlabeled.jpg +append ${particle_count}p_${mic_name%.mrc}.jpg 48 | mv ${particle_count}p_${mic_name%.mrc}.jpg ./jpg_out 49 | rm tmp_unlabeled.jpg 50 | rm tmp_cmd_file 51 | done < tmp_mic_list 52 | -------------------------------------------------------------------------------- /star2jpg_part_threshold.com: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #run as ./star2jpg.com data.star 3 | 4 | RADIUS=10 #particle radius in pixels (for display purposes) 5 | 6 | MIC_FIELD=`grep _rlnMicrographName "$@" | awk 'BEGIN {FS="#"} ; {print $2}'` 7 | X_FIELD=`grep _rlnCoordinateX "$@" | awk 'BEGIN {FS="#"} ; {print $2}'` 8 | Y_FIELD=`grep _rlnCoordinateY "$@" | awk 'BEGIN {FS="#"} ; {print $2}'` 9 | DEF_FIELD=`grep _rlnDefocusU "$@" | awk 'BEGIN {FS="#"} ; {print $2}'` 10 | PART_FIELD=`grep _rlnImageName "$@" | awk 'BEGIN {FS="#"} ; {print $2}'` 11 | 12 | particle_threshold=10 13 | 14 | awk -v mic_field=$MIC_FIELD '(NF>=3){print $mic_field}' "$@" | sort | uniq > tmp_mic_list 15 | sed -i '/^$/d' tmp_mic_list 16 | 17 | #check that we have Imagemagick etc: 18 | hash convert 2>/dev/null || { echo >&2 "Can't find convert - check that ImageMagick is available"; exit 1; } 19 | 20 | 21 | mkdir jpg_out 22 | 23 | rm single_mic.star 24 | rm tmp.tif 25 | 26 | while read line; do 27 | mic_name_orig=$(cut -d ' ' -f${MIC_FIELD} <<< $line) 28 | mic_name=${mic_name_orig##*/} 29 | grep $mic_name "$@" > single_mic.star 30 | particle_count=`cat single_mic.star | wc -l` 31 | if (( ${particle_count} < ${particle_threshold} )); then 32 | mrc2tif -S -C ${mic_name_orig} tmp.tif 33 | convert tmp.tif -morphology Convolve Gaussian:0x2 tmp.tif 34 | convert -contrast-stretch -4%x0.5% -auto-gamma -brightness-contrast 10x20 -resize 15% -rotate 180 -flop tmp.tif ${particle_count}p_${mic_name%.mrc}.jpg 35 | # cp ${particle_count}p_${mic_name%.mrc}.jpg tmp_unlabeled.jpg 36 | # touch tmp_cmd_file 37 | # while read line2; do 38 | # x_coord=$(cut -d ' ' -f${X_FIELD} <<< $line2) 39 | # y_coord=$(cut -d ' ' -f${Y_FIELD} <<< $line2) 40 | # defocus=$(cut -d ' ' -f${DEF_FIELD} <<< $line2) 41 | # x_coord=`echo "$x_coord*0.15" | bc -l` 42 | # y_coord=`echo "$y_coord*0.15" | bc -l` 43 | # part_name=$(cut -d ' ' -f${PART_FIELD} <<< $line2) 44 | # part_no=$(cut -d '@' -f1 <<< $part_name) 45 | # part_no=$((10#$part_no)) 46 | # edge=`echo "$x_coord+($RADIUS*0.15)" | bc -l` 47 | # echo "-draw \"circle ${x_coord},${y_coord} ${edge},${y_coord}\"" >> tmp_cmd_file 48 | # done < single_mic.star 49 | # defocus=`echo "$defocus*0.0001" | bc -l` 50 | # defocus=$( printf "%1.1f" $defocus ) 51 | # convert -stroke Firebrick -strokewidth 2 -fill red @tmp_cmd_file -gravity northwest -fill RoyalBlue3 -stroke none -pointsize 20 -annotate 0x0+0+15 "Defocus: ${defocus}µm, ${particle_count} particles" ${particle_count}p_${mic_name%.mrc}.jpg ${particle_count}p_${mic_name%.mrc}.jpg 52 | # convert -gravity northwest -fill DarkBlue -pointsize 20 -annotate 0x0+0+15 "Defocus: ${defocus}µm, ${particle_count} particles" ${particle_count}p_${mic_name%.mrc}.jpg ${particle_count}p_${mic_name%.mrc}.jpg 53 | # convert ${particle_count}p_${mic_name%.mrc}.jpg tmp_unlabeled.jpg +append ${particle_count}p_${mic_name%.mrc}.jpg 54 | mv ${particle_count}p_${mic_name%.mrc}.jpg ./jpg_out 55 | rm tmp.tif 56 | # rm tmp_cmd_file 57 | fi 58 | done < tmp_mic_list 59 | -------------------------------------------------------------------------------- /run_ctffind.com: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | #For running on non-gain-corrected TIF movies, with separate gain reference: 4 | #find ./ -maxdepth 1 -name "*tif" -print | parallel -j 40 './run_ctffind.com {/}' >& log & 5 | # 6 | #If run using the above method, it may miss a handful of files on the first run. 7 | #That's okay - just run it without parallel afterwards to clean up the scraps, e.g.: 8 | #./run_ctffind.com *tif >& log & 9 | # 10 | #After completion, combine per-mic star files as follows (this example also sorts by CTF fit res): 11 | # 12 | #cat starfile_header.txt > ctffind_out.star 13 | #cat *ctf.star | awk 'NF==11{print}{}' | sort -k11n >> ctffind_out.star 14 | # 15 | # 16 | #To stop, make a file called "stop" in the working directory, e.g. "touch stop" 17 | #(You will still need to kill the launch script if using parallel, e.g. "killall perl") 18 | # 19 | #Script will add two extra columns - _rlnCrossCorrelation and _rlnIceIntensity. 20 | #These are useful for sorting the files (to identify poor CTF fits and icy mics) 21 | #But they are not read by RELION, so you may want to delete these labels from the header before importing. 22 | # 23 | ###########Parameters########### 24 | 25 | APIX=1.06 #Pixel size (A) 26 | FRAMES=50 #No. frames in each stack 27 | TOTAL_DOSE=71 #Total accumulated dose (e- per A^2) 28 | AKV=300.0 #Acc. voltage (kV) 29 | INITIAL_DOSE=0.0 #Pre-exposure dose (e- per A^2) 30 | GAIN_REF=gain_ref.mrc #Gain reference (mrc format) 31 | CS=2.7 32 | AC=0.07 33 | AVE_FRAMES=1 #Frames to average for ctf determination. 4e-/A^2 worth a good starting point. If using raw (unaligned_ movies maybe 1 is better. 34 | CTFFIND_COMMAND="ctffind" 35 | DSTEP=5.0 #Detector pixel size (um) 36 | 37 | #ctffind_params 38 | RES_LOW=30.0 39 | RES_HIGH=4 40 | SPECTRUM_SIZE=1024 41 | MIN_DEF=2000.0 42 | MAX_DEF=30000.0 43 | SEARCH_STEP=500.0 44 | EXPECTED_ASTIG=500.0 45 | THREADS=24 46 | 47 | ###### Nothing below here should need alteration ####### 48 | 49 | DOSE=`echo "$TOTAL_DOSE/$FRAMES" | bc -l` 50 | DSTEP_A=`echo "$DSTEP*10000" | bc -l` 51 | MAG=`echo "$DSTEP_A/$APIX" | bc -l` 52 | SCRIPT_PID=`echo $$` 53 | 54 | touch starfile_header.txt 55 | 56 | echo """ 57 | data_ 58 | 59 | loop_ 60 | _rlnMicrographName #1 61 | _rlnCtfImage #2 62 | _rlnDefocusU #3 63 | _rlnDefocusV #4 64 | _rlnDefocusAngle #5 65 | _rlnVoltage #6 66 | _rlnSphericalAberration #7 67 | _rlnAmplitudeContrast #8 68 | _rlnMagnification #9 69 | _rlnDetectorPixelSize #10 70 | _rlnFinalResolution #11 71 | _rlnCrossCorrelation #12 72 | _rlnIceIntensity #13 """ > starfile_header.txt 73 | 74 | for i in "$@" 75 | do 76 | 77 | if [[ -f "${i%.tif}_ctf.star" ]] && [[ -f "${i%.tif}_ctf.star" ]] && [[ `cat "${i%.tif}_ctf.txt" | wc -l` == 6 ]]; then 78 | echo "Output files already exist!" 79 | else 80 | 81 | #Run ctffind 82 | $CTFFIND_COMMAND << eof 83 | ${i} 84 | YES 85 | $AVE_FRAMES 86 | ${i%.tif}_ctf.mrc 87 | $APIX 88 | $AKV 89 | $CS 90 | $AC 91 | $SPECTRUM_SIZE 92 | $RES_LOW 93 | $RES_HIGH 94 | $MIN_DEF 95 | $MAX_DEF 96 | $SEARCH_STEP 97 | NO 98 | NO 99 | YES 100 | $EXPECTED_ASTIG 101 | NO 102 | YES 103 | YES 104 | NO 105 | $GAIN_REF 106 | NO 107 | NO 108 | $THREADS 109 | eof 110 | 111 | 112 | wait 113 | 114 | if [[ `cat ${i%.tif}_ctf.txt | wc -l` == 6 ]]; then 115 | def1=$( tail -n1 ${i%.tif}_ctf.txt | awk '{print $2}' ) 116 | def1_A=`echo "$def1"` 117 | def1=`echo "$def1*0.0001" | bc -l` 118 | def1=$( printf "%1.1f" $def1 ) 119 | 120 | def2=$( tail -n1 ${i%.tif}_ctf.txt | awk '{print $3}' ) 121 | def2_A=`echo "$def2"` 122 | def2=`echo "$def2*0.0001" | bc -l` 123 | def2=$( printf "%1.1f" $def2 ) 124 | 125 | def_ang=$( tail -n1 ${i%.tif}_ctf.txt | awk '{print $4}' ) 126 | 127 | res=$( tail -n1 ${i%.tif}_ctf.txt | awk '{print $7}' ) 128 | res_A=`echo "$res"` 129 | res=$( printf "%1.1f" $res ) 130 | 131 | ccc=$( tail -n1 ${i%.tif}_ctf.txt | awk '{print $6}' ) 132 | 133 | tail -n6 ${i%.tif}_ctf_avrot.txt | awk ' 134 | { 135 | for (i=1; i<=NF; i++) { 136 | a[NR,i] = $i 137 | } 138 | } 139 | NF>p { p = NF } 140 | END { 141 | for(j=1; j<=p; j++) { 142 | str=a[1,j] 143 | for(i=2; i<=NR; i++){ 144 | str=str" "a[i,j]; 145 | } 146 | print str 147 | } 148 | }' > tmp1 149 | 150 | ice_intensity=`grep "0.271436" tmp1 | awk '{print $3}' | bc -l` 151 | 152 | if (( $(echo "$ice_intensity > 2.0" | bc -l ) )); then 153 | echo "${i} ${ice_intensity}" >> icy_list.txt 154 | fi 155 | 156 | cat starfile_header.txt > ${i%.tif}_ctf.star 157 | echo "${i%.tif}_DW.mrc ${i%.tif}_ctf.mrc ${def1_A} ${def2_A} ${def_ang} ${AKV} ${CS} ${AC} ${MAG} ${DSTEP} ${res_A} ${ccc} ${ice_intensity}" >> ${i%.tif}_ctf.star 158 | 159 | else 160 | 161 | echo """Hmmm, ${i} looks like it failed CTFFIND... :-( 162 | Oh well, moving on...""" 163 | fi 164 | 165 | if [[ -f "stop" ]]; then 166 | echo "Stopping..." 167 | echo "Stopped." 168 | kill "$SCRIPT_PID" 169 | fi 170 | 171 | wait 172 | fi 173 | done 174 | --------------------------------------------------------------------------------