Xmipp2coord

From Relion
Jump to navigation Jump to search
#!/usr/bin/env csh
#
#
if ($# == 3 ) then
 set xmdfile = $1
 set tablename = $2
 set downsample = $3
 relion_star_printtable ${xmdfile} ${tablename} _micrograph _xcoor _ycoor | awk -F"/" '{print $NF}' | sort > tt.dat
 foreach mic (`cat tt.dat | awk '{print $1}' | uniq`)
   set coordfile=`echo ${mic} | sed 's|.mrc|.coord|'`
   echo "Creating " $coordfile " ... "
   echo "        x         y      density" > ${coordfile}
   grep ${mic} tt.dat | awk -v"down=${downsample}" '{x=down*$2; y=down*$3; printf "%10i%10i%12s\n", x, y, "1.0"}' >> ${coordfile}
 end
 rm -f tt.dat
 echo "Done!"
else
 echo "Usage: " $0 "<input xmd file> <tablename> <downsamplefactor>"
 echo "Run this script in the directory where all your mrc micrographs are"
endif


Notes

  • The tablename is the name that XMIPP3 has given to the STAR-file table with all the images, e.g. data_noname or data_class000001_images.
  • The downsample factor is the one you used in XMIPP3 to extract your particles.
  • If you run this script in the Micrographs directory, the coordinate files will already be in their correct position.