Difference between revisions of "User:Speleo3"

From PyMOLWiki
Jump to: navigation, search
(Build FREEMOL)
(Render movie from PNG files)
Line 97: Line 97:
  
 
cd $freemoltrunk
 
cd $freemoltrunk
 +
 +
sed -i 's/vdwtype\[11\]/vdwtype[14]/' src/mengine/src/field.h
 +
 
for name in mpeg_encode mengine apbs pdb2pqr; do
 
for name in mpeg_encode mengine apbs pdb2pqr; do
 
     (cd src/$name && ./configure && make && make install)
 
     (cd src/$name && ./configure && make && make install)
 
done
 
done
  
ln -s $FREEMOL $prefix/modules/pymol/pymol_path/freemol
+
cp -na freemol/libpy/freemol $prefix/modules/
 +
 
 +
ln -sfT $FREEMOL $prefix/modules/pymol/pymol_path/freemol
 
</source>
 
</source>
  
Line 109: Line 114:
 
wget -r -np -nd --level=1 -A .py \
 
wget -r -np -nd --level=1 -A .py \
 
     http://pldserver1.biochem.queensu.ca/~rlc/work/pymol/
 
     http://pldserver1.biochem.queensu.ca/~rlc/work/pymol/
 +
</source>
 +
 +
Render movie from PNG files (save as <code>png2mpeg1.sh</code>):
 +
 +
<source lang="bash">
 +
#!/bin/bash
 +
 +
set -e
 +
 +
usage="usage: $(basename $0) [-w width] [-f fps] [-b vbitrate] <indir> <outfile.mpeg>"
 +
width=""
 +
fps=25
 +
vbitrate=16000
 +
 +
args="$(getopt w:f:b:h "$@")" || args="-h"
 +
set -- $args
 +
 +
while [[ $# > 0 ]]; do
 +
    case "$1" in
 +
        --) shift; break ;;
 +
        -w) width=$2; shift 2 ;;
 +
        -f) fps=$2; shift 2 ;;
 +
        -b) vbitrate=$2; shift 2 ;;
 +
        -h) echo $usage; exit 1 ;;
 +
        *) echo "argument error: $1"; exit 1 ;;
 +
    esac
 +
done
 +
 +
if [[ $# > 2 ]]; then
 +
    echo "too many arguments: $3 ..."
 +
    echo $usage
 +
    exit 1
 +
fi
 +
 +
indir="$1"
 +
outfile="$2"
 +
 +
if [[ -z "$indir" ]]; then
 +
    echo "error: indir missing"
 +
    echo $usage
 +
    exit 2
 +
fi
 +
 +
if [[ -z "$outfile" ]]; then
 +
    echo "error: outfile missing"
 +
    echo $usage
 +
    exit 3
 +
fi
 +
 +
MENCODER="mencoder -quiet"
 +
MPEG1ARGS="-mf type=png:fps=$fps -ovc lavc -forceidx -noskip \
 +
    -of rawvideo -mpegopts format=mpeg1 \
 +
    -lavcopts vcodec=mpeg1video:vbitrate=$vbitrate:vhq:trell:keyint=25"
 +
 +
if [[ -n "$width" ]]; then
 +
    MPEG1ARGS="-zoom -xy $width -sws 9 $MPEG1ARGS"
 +
fi
 +
 +
pattern="mf://$indir/*.png"
 +
$MENCODER "$pattern" $MPEG1ARGS:vpass=1 -o /dev/null
 +
$MENCODER "$pattern" $MPEG1ARGS:vpass=2 -o "$outfile"
 
</source>
 
</source>

Revision as of 08:41, 15 October 2012

My name is Thomas Holder and I am a bioinformatician at the MPI for Developmental Biology in Tübingen, Germany.

I was awarded the Warren L. DeLano Memorial PyMOL Open-Source Fellowship for 2011-2012.

Contact

  • speleo3/users.sourceforge.net
  • thomas.holder/tuebingen.mpg.de

Scripts written by me

Scripts Pastebin

Some random scripts with no dedicated PyMOLWiki page.

Launch interactive python terminal with PyMOL process: (see also Launching From a Script)

#!/usr/bin/python2.6 -i

import sys, os

# autocompletion
import readline
import rlcompleter
readline.parse_and_bind('tab: complete')

# pymol environment
moddir='/opt/pymol-svn/modules'
sys.path.insert(0, moddir)
os.putenv('PYMOL_PATH', os.path.join(moddir, 'pymol/pymol_path'))

# pymol launching
import pymol
pymol.pymol_argv = ['pymol','-qc'] + sys.argv[1:]
pymol.finish_launching()
cmd = pymol.cmd

Build PyMOL: (see also Linux Install)

#!/bin/bash -e

src=/tmp
prefix=/opt/pymol-git

pyinstall() {
    cd $src
    name=$(basename $2)
    
    if [[ -e $name ]]; then
        cd $name && $1 pull
    else
        $1 clone $2 && cd $name
    fi

    python setup.py build install \
        --home=$prefix \
        --install-lib=$prefix/modules \
        --install-scripts=$prefix
}

pyinstall git git@github.com:speleo3/pymol
pyinstall git git@github.com:speleo3/pymol-psico
pyinstall hg https://hg.codeplex.com/csb

Build FREEMOL (see also MovieSchool 6)

#!/bin/bash -e

src=/tmp
prefix=/opt/pymol-git
export FREEMOL=$prefix/freemol

freemoltrunk=$src/freemol-trunk
if [[ ! -e $freemoltrunk ]]; then
    svn co svn://bioinformatics.org/svnroot/freemol/trunk $freemoltrunk
fi

cd $freemoltrunk

sed -i 's/vdwtype\[11\]/vdwtype[14]/' src/mengine/src/field.h

for name in mpeg_encode mengine apbs pdb2pqr; do
    (cd src/$name && ./configure && make && make install)
done

cp -na freemol/libpy/freemol $prefix/modules/

ln -sfT $FREEMOL $prefix/modules/pymol/pymol_path/freemol

Download all PyMOL scripts from Robert L. Campbell's website:

wget -r -np -nd --level=1 -A .py \
    http://pldserver1.biochem.queensu.ca/~rlc/work/pymol/

Render movie from PNG files (save as png2mpeg1.sh):

#!/bin/bash

set -e

usage="usage: $(basename $0) [-w width] [-f fps] [-b vbitrate] <indir> <outfile.mpeg>"
width=""
fps=25
vbitrate=16000

args="$(getopt w:f:b:h "$@")" || args="-h"
set -- $args

while [[ $# > 0 ]]; do
    case "$1" in
        --) shift; break ;;
        -w) width=$2; shift 2 ;;
        -f) fps=$2; shift 2 ;;
        -b) vbitrate=$2; shift 2 ;;
        -h) echo $usage; exit 1 ;;
        *) echo "argument error: $1"; exit 1 ;;
    esac
done

if [[ $# > 2 ]]; then
    echo "too many arguments: $3 ..."
    echo $usage
    exit 1
fi

indir="$1"
outfile="$2"

if [[ -z "$indir" ]]; then
    echo "error: indir missing"
    echo $usage
    exit 2
fi

if [[ -z "$outfile" ]]; then
    echo "error: outfile missing"
    echo $usage
    exit 3
fi

MENCODER="mencoder -quiet"
MPEG1ARGS="-mf type=png:fps=$fps -ovc lavc -forceidx -noskip \
    -of rawvideo -mpegopts format=mpeg1 \
    -lavcopts vcodec=mpeg1video:vbitrate=$vbitrate:vhq:trell:keyint=25"

if [[ -n "$width" ]]; then
    MPEG1ARGS="-zoom -xy $width -sws 9 $MPEG1ARGS"
fi

pattern="mf://$indir/*.png"
$MENCODER "$pattern" $MPEG1ARGS:vpass=1 -o /dev/null
$MENCODER "$pattern" $MPEG1ARGS:vpass=2 -o "$outfile"