UNIX Course Part III Advanced Operations
Andy Hauser LAFUGA Gene Center Munich LMU June, 2016
1
UNIX Course Part III Advanced Operations Andy Hauser LAFUGA Gene - - PowerPoint PPT Presentation
UNIX Course Part III Advanced Operations Andy Hauser LAFUGA Gene Center Munich LMU June, 2016 1 How many sense vs. anti- sense genes are in ecoli? 2 Solutions from last session $ grep 'CDS' | cut -f 7 ecoli_1-7.gtf | sort | uniq -c 2367
Andy Hauser LAFUGA Gene Center Munich LMU June, 2016
1
2
$ grep 'CDS' | cut -f 7 ecoli_1-7.gtf | sort | uniq -c 2367 + 2198 -
$ grep -c "CDS\t.*\t\-" ecoli_1-7.gtf 2198 $ grep -c "CDS\t.*\t\+" ecoli_1-7.gtf 2367
$ grep "CDS\t.*\t\-" ecoli_1-7.gtf | wc -l 2198 $ grep "CDS\t.*\t\+" ecoli_1-7.gtf | wc -l 2367
3
$ seq 1 5 1 2 3 4 5 $ seq 5 1 5 4 3 2 1 $ seq 9 2 13 9 11 13 $ seq -w 9 11 09 10 11
arguments are range from and to also goes form higher to lower third argument in the middle is step size
$ seq 1 5 > 1to5 $ seq 5 1 > 5to1 $ paste 1to5 5to1 1 5 2 4 3 3 4 2 5 1
$ echo hello world | tr e a hallo world $ echo hello world | tr ehw aHW Hallo World $ echo hello world | tr a-z A-Z HELLO WORLD
$ echo hello world | rev dlrow olleh
Hey what do we need that for … ?!?
$ echo AAAGTAAC | tr AGTC TCAG | rev GTTACTTT
$ echo hello world | read myline $ echo $myline hello world
$ while read myline; do echo line: $myline done < 1to5 line: 1 line: 2 line: 3 line: 4 line: 5
$ for i in 1 2 3 4 5; do echo line: $i done line: 1 line: 2 line: 3 line: 4 line: 5
$ echo `cat 1to5` 1 2 3 4 5 $ for i in `cat 1to5`; do echo line: $i done line: 1 line: 2 line: 3 line: 4 line: 5
$ seq 8 12 > 8to12 $ awk '{print length}' 8to12 1 1 2 2 2 $ awk '/1/ {print length}' 8to12 2 2 2 $ paste 1to5 8to12 1 8 2 9 3 10 4 11 5 12 $ paste 1to5 8to12 | awk '{print $1}' 1 2 3 4 5 $ paste 1to5 8to12 | awk '{print $2}' 8 9 10 11 12
// matches like grep
$ sed 's/1/2/' 8to12 8 9 20 21 22 $ sed '/11/s/1/2/' 8to12 8 9 10 21 12 $ sed -n '/11/s/1/2/p' 8to12 21 $ sed -n '/1./s/1/2/p' 8to12 20 21 22
sed takes grep like regular expressions lines to act on can be selected with // Many commands. e.g. s/// for replacing text