Discovering the linux world through jupyter¶

No description has been provided for this image No description has been provided for this image

Christine Tranchant-Dubreuil and François Sabot

The objectives¶

No description has been provided for this image Run your own analysis using jupyter book and Linux !

After this course, you will able to :

  • Know the main Linux commands
  • Move into the Linux file tree : pwd, ls, cd, mkdir`
  • Work with text files: head, tail, wc, grep
  • Chain and combine commands
  • Run programs from the command line

What is Linux ?¶

No description has been provided for this image

An operating system well known for :

  • its security and stability
  • its frequent updates
  • its (no) fees and openSource (mostly) softwares

Created in 1991 by Linus Torvalds

Linux source code opensource and free : copy, modify, redistribute

What is Linux ?¶

No description has been provided for this image
  • Robust et multi-plateform OS : computer, server, android…

  • Multi-users system : Several users can work simultaneously

  • Multi-tasking system (processes/programs) Every user can run several programs at the same time

How to use Linux ?¶

  • 2 classical ways :

    Graphical User Interface
    No description has been provided for this image

No description has been provided for this image

How to use Linux ?¶

  • 2 classical ways :

    Graphical User Interface

    Command-Line Interface through a terminal
    No description has been provided for this image

No description has been provided for this image

How to use Linux ?¶

  • a new and alternative ways :

    jupyter book
    No description has been provided for this image

No description has been provided for this image

Why using Linux ?¶

  • Numerous fast and powerful programs

  • Easy to link commands and programs (workflow)

  • Numerous bioinformatics softwares available

  • 90% of servers on Linux

Why using Linux ?¶

Need to practice!!!

Important investissments to have good results !!! No description has been provided for this image

Let's go through jupyter¶

No description has been provided for this image

First steps on Linux¶

Commands for moving around the file system and manipulating files/folders

No description has been provided for this image

Linux command syntax¶

command [ -options] [ arguments ]

Your first command pwd¶

pwd print the name of the current directory (the full path)

In [ ]:
pwd
No description has been provided for this image

2nd command ls¶

  • without argument : list all the files in the current directory (by default)
In [ ]:
ls

ls + option -l¶

ls -l : list files with more information about each file (long)

In [ ]:
ls -l

2nd command + argument ls¶

with directory path as argument

In [ ]:
ls /home/jovyan/SV_DATA/REF
No description has been provided for this image


  • What is a file tree for Linux?
No description has been provided for this image

The file tree - file system¶

  • Directory structure starts at the root directory called “/” (slash)
No description has been provided for this image

The file tree - Main directories¶

No description has been provided for this image

Path of a file¶

  • Path = location to a file/directory in the file system

  • On linux filetree, you can use absolute or relative path

No description has been provided for this image
  • What is the difference between the absolute and relative path ?

What is an absolute path of a file or a directory ?¶

  • Path = location to a file/directory in the file system
ABSOLUTE
Complete path of a file
starting from the root directory /
starts always with /
always good wherever user is working

What is a relative path of a file or a directory ?¶

  • Path = location to a file/directory in the file system
RELATIVE
Path related to the present working directory
(where the user is working)
Never starts with /
Depends on where the user is working

In brief¶

  • Path = location to a file/directory in the file system
ABSOLUTE RELATIVE
Complete path of a file
starting from the root directory /
Path related to the present working directory
(where the user is working)
starts always with / Never starts with /
always good wherever user is working Depends on where the user is working

Absolute Path¶

  • Always start with / (root directory)

  • Always works wherever user is working on the server or vm

No description has been provided for this image
No description has been provided for this image
  • What is the absolute path of the file sequence.fasta ?

Absolute Path¶

  • Always start with / (root directory)

  • Always works wherever user is working on the server or vm

No description has been provided for this image
No description has been provided for this image
  • What is the absolute path of the directory script ?

Relative Path¶

  • Path related to the present working directory

  • Never starts with /

No description has been provided for this image
No description has been provided for this image
  • What is the relative path of the file sequence.fasta ?

Relative Path¶

  • Path related to the present working directory

  • Never starts with /

No description has been provided for this image
No description has been provided for this image
  • What is the relative path of the directory fasta ?

Rules for naming file and directory names¶

  • linux is case sensitive

      Sequence.fasta    SEQUENCE.fasta   sequence.fasta

Rules for naming file and directory names¶

  • linux is case sensitive
  • Only ROMAN letters, numbers and _ -

Rules for naming file and directory names¶

  • linux is case sensitive

  • Only ROMAN letters, numbers and _ -

  • No space, accent or special symbol

      & ~ # ”  ' { ( [ | ` \ ^ @ ) ] } $ * % ! / ; , ?

Rules for naming file and directory names¶

  • linux is case sensitive
  • Only ROMAN letters, numbers and _ -
  • No space, accent or special symbol
  • No need to use filename extension (.txt), just to improve readability of filenames.

A few Basic Commands¶

pwd Display the full path of the current directory
ls List all files/directories
ls -l Display all files (Long listing)

A few Basic Commands¶

How to get help about one command

  • with the ’option --help ou -h
  • with the command man

Command cd¶

  • Move from the current directory into a new directory

cd DIRECTORY NAME (absolute or relative path)

No description has been provided for this image
  • Move into the REF directory (absolute path)
No description has been provided for this image
No description has been provided for this image
  • Move into the SV_DATA directory (absolute path)
No description has been provided for this image
No description has been provided for this image
  • Move into the SHORT_READS directory (relative path)
No description has been provided for this image

Some Commands¶

pwd Display the full path of the current directory
ls List all files/directories
cd DIR_NAME Change the working directory
rm nom_fichier Remove a directory
cp file1 file2 Make a copy of file1 and calls it file2
cp FILE_NAME DIR_NAME Copy the file FILE_NAME in the directory DIR_NAME
cp FILE DIR/NEW_FILE Mix of 2

Commands for displaying text files and searching word¶

command cat¶

  • cat nom_fichier : Displays the content of a file on the screen

(Don’t use it with big files!!)

In [ ]:
cat _PUT_THE_CORRECT_PATH_TO_ASSEMBLIES/assembly-stats.txt_

command wc¶

  • wc -l : Displays the nomber of lines in a file
In [ ]:
wc -l PUT_THE_CORRECT_PATH_TO_REF/GCA_002220235.1_ASM222023v1_genomic.gff

command head¶

  • head nom_fichier : writes the first ten lines of a file to the screen
In [ ]:
head PUT_THE_CORRECT_PATH_TO_REF/GCA_002220235.1_ASM222023v1_genomic.gff
In [ ]:
head -n 20 PUT_THE_CORRECT_PATH_TO_REF/GCA_002220235.1_ASM222023v1_genomic.gff

command tail¶

  • tail nom_fichier : writes the last ten lines of a file to the screen
In [ ]:
tail PUT_THE_CORRECT_PATH_TO_REF/GCA_002220235.1_ASM222023v1_genomic.gff