Xmipp2coord: Difference between revisions

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

Revision as of 12:38, 26 March 2013

#!/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}" '{print down*$2, down*$3, "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