SlideShare une entreprise Scribd logo
1  sur  51
Télécharger pour lire hors ligne
Introduction to Programming and Algorithms


       Paolo Marcatili
       “Sapienza” University of Rome
       Biocomputing group
       
       




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Course Calendar & structure 

  Fri 2, Dec: Introduction & Unix
  Fri 13, Jan: Perl – Data types
  Fri 20, Jan: Perl – IO and loops
  Fri 27, Jan: Algorithms: Sort and Search
  Thu 2, Feb: Perl – Parsing 
  Thu 9, Feb: Seminar – Machine Learning 
  Fri 10, Feb: Perl – Practicals
  Fri 17, Feb: Perl – Practicals




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Unix for Bioinformaticians

                               A survival guide




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Agenda
 •    Unix
 •    Folders
 •    Files
 •    Processes
 •    Redirection




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Unix




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
What is Unix? Unix
                                         





Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
What is Unix? 

 Operating system
 stable, 
 multi-user, 
 multi-tasking 
 for servers, 
 desktops 
 and laptops.
 

Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Types of Unix
 •  Solaris"
    
 •  OS-X"
    
 •  Linux!




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Unix Operating System




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
What’s in Unix?
 
 Files (data) 
 
 
 
 Processes (actions)



Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Unix Filesystem




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Terminal
 It makes the difference!
 
 Powerful
 Transparent
 User-unfriendly




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Our Task Today




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Human Immunoglobulins




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Human Immunoglobulins




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
The data
 We have 3 files
 
 Fasta Sequences of
 Heavy (heavy.fasta)
 Lambda (lambda.fasta)
 Kappa (kappa.fasta)



Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
The Task
 •    Look data
 •    Correct errors
 •    Do some analysis
 •    Make a single fasta file




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Folders: read and write




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Change Directory
 To know where you are
 >pwd
 /home/bioinfoSMFN
 Let’s move!
 >cd /home/bioinfoSMFN/Desktop/task
 Or
 >cd Desktop/
 

Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Folder content
 Let’s check what’s in the folder:
 >ls
 Better
 >ls -la
 
 Cheat: parameters are useful!
 >ls -lart
 

Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Wildcards
 Extremely useful!
 
 >ls -la *heavy*
 >ls -la heavy.?asta
 
 *= 0,1,2,…. occurences of whatever
 ?= exactly 1 occurence of whatever
 

Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Commands
 To know more about a command:
 
 >man ls
 >whatis ls
 >apropos ls
 
 Or Google! 
 

Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Unix Permissions




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Folders - summary
 Command       
Meaning
 ls
         
 
list files and directories
 ls -a 
     
 
list all files and directories
 mkdir 
 
make a directory
 cd directory 
change to named directory
 cd 
 
 
change to home-directory
 cd ~ 
 
change to home-directory
 cd .. 
 
change to parent directory
 pwd 
 
path of the current directory

Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Files: read and write




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Backup original data
 Create a directory
 >mkdir backup
 Copy all the files in the directory
 >cp heavy.fasta backup/
 >cp heavy.fasta heavy_copy.fasta
 >mv heavy_copy.fasta backup/
  heavy_backup.fasta


Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Read a file
 Let’s see…
 >cat heavy.fasta
 




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Read a file
 Let’s see…
 >cat heavy.fasta
 
 Mmh…
 >less heavy.fasta
 Hint: q to quit… 
 but if you are stuck try ctrl+c

Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Look for text
 If we want to look for something
 while in less:
 /
 91979410 (enter)
 




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Edit a file
 Let’s remove the first H sequence
 >vi heavy.fasta
 >nano heavy.fasta
 
 For those who live in 2008
 >gedit heavy.fasta



Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Look for text
 How many Igs in each file?
 We can count the lines!
 >wc heavy.fasta
 




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Look for text
 How many Igs in each file?
 We can count the lines!
 >wc heavy.fasta
 
 Lines > proteins!!!
 



Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Grep
 # of proteins = # of “>” in a file
 
 >grep “>” heavy.fasta
 >grep -c “>” heavy.fasta
 
 Do it for all the files and write the result
 (I think they are too many…)

Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Grep
 >grep -c V-region heavy.fasta
 >grep -c v-region heavy.fasta
 >grep -ci v-region heavy.fasta
 
 Ok, better!
 



Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Files: sumary
 cp file1 file2 
copy file1 and call it file2
 mv file1 file2 
move or rename file1 to file2
 rm file 
 
remove a file
 cat file 
 
display a file
 less file 
display a file a page at a time
 head file
 
display the first few lines
 tail file 
 
display the last few lines
 grep 'key' file 
search a file for keywords
 wc file 
 
number of lines
 
 
Bioinformatics master course, ‘11/’12 
 
 
 
Paolo Marcatili
Processes




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Run a process
 Process = execution of some instructions
 Usually the instructions are in a file.
 
 e.g. less -> /usr/bin/less
 
 So 
 >/usr/bin/less heavy.fasta

Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Run - It’s simple
 Ok, so let’s try
 >./loop.pl




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Run - It’s simple
 Ok, so let’s try
 >./loop.pl
 
 Ok, and now?




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Controlling processes
 Ctrl+z -> go to sleep
 
 Now you’ve got the control again!
 But it’s not still dead…
 bg
 Ctrl+C
 

Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Controlling processes
 Or:
 >./loop.pl
 Ctrl+z 
 >ps
 >top (q to exit)
 >kill the_number_that_you_have_just_read
 

Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Redirection

                              Control the force
                                      



Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Inputs and outputs
                Keyboard
               Mouse
                                Tablet




                                            Kernel




                  Display
              Printer
                                  File




Bioinformatics master course, ‘11/’12   
    
     
   
Paolo Marcatili
Write into a file
 >Cat > lista.txt
 
 Heavy 29061
 Ctrl+d
 
 And
 >less lista.txt

Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Append to a file
 >Cat >> lista.txt
 
 Kappa 7476
 Ctrl+d
 
 And
 >less lista.txt
 

Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
The big one!
 >cat heavy.fasta > bigone.fasta
 >cat kappa >> bigone.fasta
 >cat lambda.fasta >> bigone.fasta
 >grep -c “>” bigone.fasta
 




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Extract headers
 >grep “>” bigone.fasta > headers.head
 >sort headers.head > headers_sort.head
 
 Do we need the first file?




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Extract headers
 >grep “>” bigone.fasta > headers.head
 >sort headers.head > headers_sort.head
 
 Do we need the first file? No!
 >grep “>” bigone.fasta | sort >
    headers_sorted.head
 | is called pipe, and it’s something


Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Redirect everything!
 >grep ">" biggone.fasta 2> err.log
 >less err.log
 
 
 




Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Redirect - summary 

 command > file 
redirect std output to a file
 command >> file 
append std output to a file
 command < file 
redirect std input from a file
 cmd1 | cmd2 
pipe the output of cmd1 to the 
                             
   
input of cmd2
 cat f1 f2 > f0 
concatenate f1 and f2 to f0
 sort 
 
 
sort data
 
 

Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili
Quiz
 •  What does this command perform?"
    >grep -v ">" heavy.fasta
 •  How many proteins in each file?
 •  How many residues in each file?"
    (hint: wc -m counts the # of char in a line)
 •  Average length of proteins in each file? 
 •  Average content of Prolines of VH, VL and
    VK?"
    (hint: look at grep parameters)

Bioinformatics master course, ‘11/’12   
   
   
   
Paolo Marcatili

Contenu connexe

En vedette

AAC elektroniset apuvalineet 2009
AAC elektroniset apuvalineet 2009AAC elektroniset apuvalineet 2009
AAC elektroniset apuvalineet 2009Miika Lehtonen
 
Sdq koulutus-miika-esitys-2015-06-02-paiv2016
Sdq koulutus-miika-esitys-2015-06-02-paiv2016Sdq koulutus-miika-esitys-2015-06-02-paiv2016
Sdq koulutus-miika-esitys-2015-06-02-paiv2016Miika Lehtonen
 
Sdq koulutus-miika-esitys-2015-06-02
Sdq koulutus-miika-esitys-2015-06-02Sdq koulutus-miika-esitys-2015-06-02
Sdq koulutus-miika-esitys-2015-06-02Miika Lehtonen
 
Mediamuffinssi maxim2006(2012ver)
Mediamuffinssi maxim2006(2012ver)Mediamuffinssi maxim2006(2012ver)
Mediamuffinssi maxim2006(2012ver)Miika Lehtonen
 
Boardmaker koulutus 2013-06-05
Boardmaker koulutus 2013-06-05Boardmaker koulutus 2013-06-05
Boardmaker koulutus 2013-06-05Miika Lehtonen
 
Orientationprimary
OrientationprimaryOrientationprimary
Orientationprimarysdembowski
 
Monarch butterfly
Monarch butterflyMonarch butterfly
Monarch butterflysdembowski
 

En vedette (10)

Book raffle
Book raffleBook raffle
Book raffle
 
Master datatypes 2011
Master datatypes 2011Master datatypes 2011
Master datatypes 2011
 
AAC elektroniset apuvalineet 2009
AAC elektroniset apuvalineet 2009AAC elektroniset apuvalineet 2009
AAC elektroniset apuvalineet 2009
 
Sdq koulutus-miika-esitys-2015-06-02-paiv2016
Sdq koulutus-miika-esitys-2015-06-02-paiv2016Sdq koulutus-miika-esitys-2015-06-02-paiv2016
Sdq koulutus-miika-esitys-2015-06-02-paiv2016
 
Sdq koulutus-miika-esitys-2015-06-02
Sdq koulutus-miika-esitys-2015-06-02Sdq koulutus-miika-esitys-2015-06-02
Sdq koulutus-miika-esitys-2015-06-02
 
Mediamuffinssi maxim2006(2012ver)
Mediamuffinssi maxim2006(2012ver)Mediamuffinssi maxim2006(2012ver)
Mediamuffinssi maxim2006(2012ver)
 
Boardmaker koulutus 2013-06-05
Boardmaker koulutus 2013-06-05Boardmaker koulutus 2013-06-05
Boardmaker koulutus 2013-06-05
 
Orientationprimary
OrientationprimaryOrientationprimary
Orientationprimary
 
Hashes Master
Hashes MasterHashes Master
Hashes Master
 
Monarch butterfly
Monarch butterflyMonarch butterfly
Monarch butterfly
 

Similaire à Master unix 2011

SFScon19 - Marco Marinello - Telegram Sysadmin Toolkit easily monitor your se...
SFScon19 - Marco Marinello - Telegram Sysadmin Toolkit easily monitor your se...SFScon19 - Marco Marinello - Telegram Sysadmin Toolkit easily monitor your se...
SFScon19 - Marco Marinello - Telegram Sysadmin Toolkit easily monitor your se...South Tyrol Free Software Conference
 
Reconstructive Software Archaeology
Reconstructive Software ArchaeologyReconstructive Software Archaeology
Reconstructive Software ArchaeologyDoctorWkt
 
Slackware Demystified [SELF 2011]
Slackware Demystified [SELF 2011]Slackware Demystified [SELF 2011]
Slackware Demystified [SELF 2011]Vincent Batts
 
Emacs presentation
Emacs presentationEmacs presentation
Emacs presentationLingfei Kong
 
Tarantool: теперь и с SQL
Tarantool: теперь и с SQLTarantool: теперь и с SQL
Tarantool: теперь и с SQLMail.ru Group
 
Configuration Management and Salt
Configuration Management and SaltConfiguration Management and Salt
Configuration Management and Salt55020
 
Linux Kernel - Let's Contribute!
Linux Kernel - Let's Contribute!Linux Kernel - Let's Contribute!
Linux Kernel - Let's Contribute!Levente Kurusa
 
OSDC 2018 | The Computer science behind a modern distributed data store by Ma...
OSDC 2018 | The Computer science behind a modern distributed data store by Ma...OSDC 2018 | The Computer science behind a modern distributed data store by Ma...
OSDC 2018 | The Computer science behind a modern distributed data store by Ma...NETWAYS
 
Uccn1003 -may10_-_lab_09_-_wireshark_analysis_live_capture
Uccn1003  -may10_-_lab_09_-_wireshark_analysis_live_captureUccn1003  -may10_-_lab_09_-_wireshark_analysis_live_capture
Uccn1003 -may10_-_lab_09_-_wireshark_analysis_live_captureShu Shin
 
[Bucharest] Reversing the Apple Sandbox
[Bucharest] Reversing the Apple Sandbox[Bucharest] Reversing the Apple Sandbox
[Bucharest] Reversing the Apple SandboxOWASP EEE
 
The computer science behind a modern disributed data store
The computer science behind a modern disributed data storeThe computer science behind a modern disributed data store
The computer science behind a modern disributed data storeJ On The Beach
 
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...SaltStack
 
Configuration Management with Saltstack
Configuration Management with SaltstackConfiguration Management with Saltstack
Configuration Management with Saltstackinovex GmbH
 

Similaire à Master unix 2011 (20)

Master perl io_2011
Master perl io_2011Master perl io_2011
Master perl io_2011
 
Unix Master
Unix MasterUnix Master
Unix Master
 
SFScon19 - Marco Marinello - Telegram Sysadmin Toolkit easily monitor your se...
SFScon19 - Marco Marinello - Telegram Sysadmin Toolkit easily monitor your se...SFScon19 - Marco Marinello - Telegram Sysadmin Toolkit easily monitor your se...
SFScon19 - Marco Marinello - Telegram Sysadmin Toolkit easily monitor your se...
 
Reconstructive Software Archaeology
Reconstructive Software ArchaeologyReconstructive Software Archaeology
Reconstructive Software Archaeology
 
Lec7
Lec7Lec7
Lec7
 
monitor_begin_s.PDF
monitor_begin_s.PDFmonitor_begin_s.PDF
monitor_begin_s.PDF
 
A false digital alibi on mac os x
A false digital alibi on mac os xA false digital alibi on mac os x
A false digital alibi on mac os x
 
Slackware Demystified [SELF 2011]
Slackware Demystified [SELF 2011]Slackware Demystified [SELF 2011]
Slackware Demystified [SELF 2011]
 
MOSP Walkthrough 2009
MOSP Walkthrough 2009MOSP Walkthrough 2009
MOSP Walkthrough 2009
 
Emacs presentation
Emacs presentationEmacs presentation
Emacs presentation
 
Tarantool: теперь и с SQL
Tarantool: теперь и с SQLTarantool: теперь и с SQL
Tarantool: теперь и с SQL
 
Configuration Management and Salt
Configuration Management and SaltConfiguration Management and Salt
Configuration Management and Salt
 
Linux Kernel - Let's Contribute!
Linux Kernel - Let's Contribute!Linux Kernel - Let's Contribute!
Linux Kernel - Let's Contribute!
 
OSDC 2018 | The Computer science behind a modern distributed data store by Ma...
OSDC 2018 | The Computer science behind a modern distributed data store by Ma...OSDC 2018 | The Computer science behind a modern distributed data store by Ma...
OSDC 2018 | The Computer science behind a modern distributed data store by Ma...
 
Falco meetup OpenShift
Falco meetup OpenShiftFalco meetup OpenShift
Falco meetup OpenShift
 
Uccn1003 -may10_-_lab_09_-_wireshark_analysis_live_capture
Uccn1003  -may10_-_lab_09_-_wireshark_analysis_live_captureUccn1003  -may10_-_lab_09_-_wireshark_analysis_live_capture
Uccn1003 -may10_-_lab_09_-_wireshark_analysis_live_capture
 
[Bucharest] Reversing the Apple Sandbox
[Bucharest] Reversing the Apple Sandbox[Bucharest] Reversing the Apple Sandbox
[Bucharest] Reversing the Apple Sandbox
 
The computer science behind a modern disributed data store
The computer science behind a modern disributed data storeThe computer science behind a modern disributed data store
The computer science behind a modern disributed data store
 
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
 
Configuration Management with Saltstack
Configuration Management with SaltstackConfiguration Management with Saltstack
Configuration Management with Saltstack
 

Dernier

2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 

Dernier (20)

2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 

Master unix 2011

  • 1. Introduction to Programming and Algorithms Paolo Marcatili “Sapienza” University of Rome Biocomputing group Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 2. Course Calendar & structure Fri 2, Dec: Introduction & Unix Fri 13, Jan: Perl – Data types Fri 20, Jan: Perl – IO and loops Fri 27, Jan: Algorithms: Sort and Search Thu 2, Feb: Perl – Parsing Thu 9, Feb: Seminar – Machine Learning Fri 10, Feb: Perl – Practicals Fri 17, Feb: Perl – Practicals Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 3. Unix for Bioinformaticians A survival guide Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 4. Agenda •  Unix •  Folders •  Files •  Processes •  Redirection Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 5. Unix Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 6. What is Unix? Unix Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 7. What is Unix? Operating system stable, multi-user, multi-tasking for servers, desktops and laptops. Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 8. Types of Unix •  Solaris" •  OS-X" •  Linux! Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 9. Unix Operating System Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 10. What’s in Unix? Files (data) Processes (actions) Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 11. Unix Filesystem Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 12. Terminal It makes the difference! Powerful Transparent User-unfriendly Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 13. Our Task Today Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 14. Human Immunoglobulins Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 15. Human Immunoglobulins Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 16. The data We have 3 files Fasta Sequences of Heavy (heavy.fasta) Lambda (lambda.fasta) Kappa (kappa.fasta) Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 17. The Task •  Look data •  Correct errors •  Do some analysis •  Make a single fasta file Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 18. Folders: read and write Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 19. Change Directory To know where you are >pwd /home/bioinfoSMFN Let’s move! >cd /home/bioinfoSMFN/Desktop/task Or >cd Desktop/ Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 20. Folder content Let’s check what’s in the folder: >ls Better >ls -la Cheat: parameters are useful! >ls -lart Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 21. Wildcards Extremely useful! >ls -la *heavy* >ls -la heavy.?asta *= 0,1,2,…. occurences of whatever ?= exactly 1 occurence of whatever Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 22. Commands To know more about a command: >man ls >whatis ls >apropos ls Or Google! Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 23. Unix Permissions Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 24. Folders - summary Command Meaning ls list files and directories ls -a list all files and directories mkdir make a directory cd directory change to named directory cd change to home-directory cd ~ change to home-directory cd .. change to parent directory pwd path of the current directory Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 25. Files: read and write Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 26. Backup original data Create a directory >mkdir backup Copy all the files in the directory >cp heavy.fasta backup/ >cp heavy.fasta heavy_copy.fasta >mv heavy_copy.fasta backup/ heavy_backup.fasta Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 27. Read a file Let’s see… >cat heavy.fasta Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 28. Read a file Let’s see… >cat heavy.fasta Mmh… >less heavy.fasta Hint: q to quit… but if you are stuck try ctrl+c Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 29. Look for text If we want to look for something while in less: / 91979410 (enter) Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 30. Edit a file Let’s remove the first H sequence >vi heavy.fasta >nano heavy.fasta For those who live in 2008 >gedit heavy.fasta Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 31. Look for text How many Igs in each file? We can count the lines! >wc heavy.fasta Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 32. Look for text How many Igs in each file? We can count the lines! >wc heavy.fasta Lines > proteins!!! Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 33. Grep # of proteins = # of “>” in a file >grep “>” heavy.fasta >grep -c “>” heavy.fasta Do it for all the files and write the result (I think they are too many…) Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 34. Grep >grep -c V-region heavy.fasta >grep -c v-region heavy.fasta >grep -ci v-region heavy.fasta Ok, better! Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 35. Files: sumary cp file1 file2 copy file1 and call it file2 mv file1 file2 move or rename file1 to file2 rm file remove a file cat file display a file less file display a file a page at a time head file display the first few lines tail file display the last few lines grep 'key' file search a file for keywords wc file number of lines Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 36. Processes Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 37. Run a process Process = execution of some instructions Usually the instructions are in a file. e.g. less -> /usr/bin/less So >/usr/bin/less heavy.fasta Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 38. Run - It’s simple Ok, so let’s try >./loop.pl Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 39. Run - It’s simple Ok, so let’s try >./loop.pl Ok, and now? Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 40. Controlling processes Ctrl+z -> go to sleep Now you’ve got the control again! But it’s not still dead… bg Ctrl+C Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 41. Controlling processes Or: >./loop.pl Ctrl+z >ps >top (q to exit) >kill the_number_that_you_have_just_read Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 42. Redirection Control the force Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 43. Inputs and outputs Keyboard Mouse Tablet Kernel Display Printer File Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 44. Write into a file >Cat > lista.txt Heavy 29061 Ctrl+d And >less lista.txt Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 45. Append to a file >Cat >> lista.txt Kappa 7476 Ctrl+d And >less lista.txt Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 46. The big one! >cat heavy.fasta > bigone.fasta >cat kappa >> bigone.fasta >cat lambda.fasta >> bigone.fasta >grep -c “>” bigone.fasta Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 47. Extract headers >grep “>” bigone.fasta > headers.head >sort headers.head > headers_sort.head Do we need the first file? Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 48. Extract headers >grep “>” bigone.fasta > headers.head >sort headers.head > headers_sort.head Do we need the first file? No! >grep “>” bigone.fasta | sort > headers_sorted.head | is called pipe, and it’s something Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 49. Redirect everything! >grep ">" biggone.fasta 2> err.log >less err.log Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 50. Redirect - summary command > file redirect std output to a file command >> file append std output to a file command < file redirect std input from a file cmd1 | cmd2 pipe the output of cmd1 to the input of cmd2 cat f1 f2 > f0 concatenate f1 and f2 to f0 sort sort data Bioinformatics master course, ‘11/’12 Paolo Marcatili
  • 51. Quiz •  What does this command perform?" >grep -v ">" heavy.fasta •  How many proteins in each file? •  How many residues in each file?" (hint: wc -m counts the # of char in a line) •  Average length of proteins in each file? •  Average content of Prolines of VH, VL and VK?" (hint: look at grep parameters) Bioinformatics master course, ‘11/’12 Paolo Marcatili