File: star_datablock_ctfdat

package info (click to toggle)
relion 1.4+dfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 4,188 kB
  • sloc: cpp: 42,912; sh: 10,415; makefile: 267; ansic: 50; csh: 2
file content (24 lines) | stat: -rwxr-xr-x 1,055 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
if [ $# != 0 ]; then
 while read line; do
  # Get image name from first column
  image=`echo $line | awk '{print $1}'`
  # Get ctfparam name from second column
  ctfparam=`echo $line | awk '{print $2}'`
  # Strip directories from ctfparam and remove "_Periodogramavg.ctfparam" to get micrograph name
  micro=`echo $ctfparam | awk -F"/" '{print $NF}' | sed 's|_Periodogramavg.ctfparam||'`
  # Get metadata from the ctfparam, reverse sign for defocusU, defocusV and Q0
  metadata=`awk '{if ($1~"defocus" || $1~"Q0") {printf "%s%s", -$2," "} else if ($1~"sampling" || $1~"K=") {} else {printf "%s%s", $2," "} } END {printf "\n"}' <$ctfparam `
  echo $image $micro $metadata
 done < $1
else
 echo " === Usage: === "
 echo " ${0} <xmippctfdatfile> "
 echo " "
 echo " === Purpose: === "
 echo " This (bash) script generates the STAR datablock for all images in an xmipp-format CTFDAT file"
 echo " Note that the sign for XMIPP's defocusU, defocusV and Q0 values is reversed "
 echo " "
 echo " === Example: ==="
 echo " ${0} all_images.ctfdat "
fi