chunks
来自「最经典的分子对结软件」· 代码 · 共 129 行
TXT
129 行
#!/bin/sh# This is a script designed to feed sybdb smaller pieces to avoid # memory limitations. Use no arguments to get usage instructions. DAG 3/95# Modified to improve space requirements throughout chunking process DAG 8/95.# Please customize the location of the DOCK bin directory at your sitedock_bin=/idk2/private/dock/bin# Check for proper invocationif [ $# -ne 3 ]; then echo "Usage: `basename $0` <input> <output> <chunk_size>" echo " where <input> is generally the output from sdf2mol2," echo " <output> is the desired output file name, and" echo " <chunk_size> is the number of molecules to process at a time." exit 1fiinput=$1output=$2chunksize=$3output_sybout=$output.syboutoutput_syblog=$output.syblogtmp=chunkpostfix=processedsplitmol=$dock_bin/splitmolsybdb=$dock_bin/sybdbsybdbout=sybdb.outsybdblog=sybdb.logexecutables="$splitmol $sybdb"newfiles="$output $output_sybout $output_syblog"# Make sure the executables are therefor exe in $executablesdo if [ ! -x $exe ]; then echo "Can not locate/execute $dock_bin/$exe." echo "Please update the location of the DOCK root within the `basename $0` script." exit 1 fidone# Make sure the input is readableif [ ! -r $input ]; then echo "Can not read from input: $input." exit 1fi# Check to see if the parameter file is present and alert userif [ ! -f gastpar.tab ]; then echo "WARNING - no gastpar.tab Gasteiger Marsili parameter file" echo "was found in this directory. Unless you have modified the" echo "Tripos-distributed version of this file in" echo " \$TA_ROOT/sybylbase/tables/gastpar.tab" echo "sulfoxides and sulfones will be assigned zero charges!" echo "Proceed? \c" read ans case $ans in [yY]) ;; *) echo "Aborting..." exit 1 ;; esacfi# Remove any existing chunks/bin/rm -f $tmp.*# Remove any existing log files and databasesfor new in $newfilesdo if [ -f $new ]; then echo "Desired output file exists: $new." echo "Remove it? \c" read ans case $ans in [yY]) /bin/rm -f $new ;; *) echo "Aborting..." exit 1 ;; esac fidonestartat=1stopat=$chunksize# Now process the database in chunks with sybdbwhile :do echo "\n===============================> Processing chunk at #$startat." # extract this chunk from the database - note that since we do this # within the loop, this is slower than splitting the entire database # prior to beginning the processing as the whole database needs to be # scanned for the appropriate chunk every time $splitmol -mol2 $input -splitby $chunksize -start $startat -stop $stopat -rel -out $tmp echo "" # if there were no molecules in the range, we are done if [ ! -f $tmp.00001 ]; then echo " Last chunk was empty - we are finished!" break fi # process the current chunk with sybdb echo "Processing with sybdb..." $sybdb $tmp.00001 $tmp.$postfix > /dev/null cat $sybdbout >> $output_sybout cat $sybdblog >> $output_syblog cat $tmp.$postfix >> $output /bin/rm -f $tmp.* # determine starting and stopping points for extraction startat=`expr $stopat + 1` stopat=`expr $stopat + $chunksize` done
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?