Professional Documents
Culture Documents
Virginie Orgogozo
April 6 2012
Alias
shortcut for a commonly used shell command
~/.bash_profile or ~/.bashrc file:
()
In the shell:
$cdp
$cxscript2.py
$agCYGexamples/FPexcerpt.fta
$myjobs
$hgpcfb
$alias
Functions
For a more complex set of shell commands
In the shell:
$pdftkGenomeBiolPaper.pdfcat2endoutputDoe2012.pdf
$firstpageGenomeBiolPaper.pdfDoe2012.pdf
~/.bash_profile or ~/.bashrc file:
()
function firstpage() { pdftk $1 cat 2-end output $2 ;}
$listall
listall() {
ls -la
echo Above are all the directories of the following
folder:
pwd
date
}
Defines
the
function
virginie@Darwin:~$repeaterhelloeverybody!Howare
you?
helloiswhatyousaidfirst
helloeverybody!Howareyou?iseverythingyousaid
virginie@Darwin:$
Usage of
the
function
Defines
the
function
Usage of
the
function
u_file1.dat
u_file2.dat
u_file3.dat
...
renamer(){
EXT="dat"
PRE="u_"
(if the number of arguments is ..., then...)
if[$#lt1]
then
echo"Renameafile.txtlistas$PREfile.
$EXT"
else
forFILENAMEin"$@"
do
ROOTNAME="${FILENAME%.*}"
cp"$FILENAME""$PRE$ROOTNAME.$EXT"
echo"Copying$FILENAMEto
$PRE$ROOTNAME.$EXT"
done
fi
}
Copy and paste this text from pcfb/scripts/shellfunctions.sh in your shell
virginie@Darwin:~$cd~/pcfb/examplesspectra/
virginie@Darwin:~/pcfb/examples/spectra$ls
LEDBlue.txtLEDGreen.txtLEDRed.txtLEDYellow.txt
virginie@Darwin:~/pcfb/examples/spectra$renamer*.txt
CopyingLEDBlue.txttou_LEDBlue.dat
CopyingLEDGreen.txttou_LEDGreen.dat
CopyingLEDRed.txttou_LEDRed.dat
CopyingLEDYellow.txttou_LEDYellow.dat
virginie@Darwin:~/pcfb/examples/spectra$ls
LEDBlue.txtLEDRed.txtu_LEDBlue.datu_LEDRed.dat
LEDGreen.txtLEDYellow.txtu_LEDGreen.datu_LEDYellow.dat
virginie@Darwin:~/Documents/WWW/BioInfoCourses/pcfb/examples/spectr
a$
Wrappers
Program that controls and expands the functionality of another program
Pipelines
Automated workflow
Very important for efficiency, consistency and record