Python study Introduction Basic command in linux Python
Python study Introduction Basic command in linux
Python? � One of the easiest computer programming language � Helper for dealing huge size of information and data
Linux? � One of the open source OS(Operating System) � CUI(Character user interface) ◦ Cf) Windows – GUI(Graphic user interface) ◦ Suitable for dealing huge size of information and data
Basic command in Linux � ls ◦ Listing files and directories � cd ◦ Change directory ◦ Practice) enter into /data 2/python_study
Basic command in Linux � mkdir ◦ Make directory ◦ Usage) mkdir dir_name ◦ Practice) make directory named as your name
Basic command in Linux � vi ◦ Open text editing program ◦ Make new text file ◦ usage) vi filename_to_edit vi filename_to_make ◦ Practice) make text file named as yourname in your directory, write something and save it �Insert, replace, esc �: q : wq : q!
Basic command in Linux � mv ◦ Moving files or directories ◦ Rename files or directories ◦ Usage) mv present_file_path_to_move ◦ Practice) �Change directory into upper directory �cm) cd. . �Make some text file by vi �Move text file to your directory �Rename text file
Basic command in Linux � cp ◦ ◦ Coping files or directories Usage) cp file_path_to_copy cp can rename file If you want to copy directory, you have to use –r option �Cp –r dir_path_to_copy ◦ Practice) �Make directory in your directory �Copy some file into directory with rename and w/o rename
Basic command in Linux � rm ◦ Removing files or directories ◦ Usage) rm file_name ◦ If you want to remove directory, you have to use –r option �rm –r dir_name ◦ Practice) �Remove the directory and file
Basic command in Linux � less ◦ ◦ Read only text viewer Have advantage for large size text file Usage) less file_name Searching function �/ ◦ Practice) �Open large text file by vi and less �/data 2/python_study/Gmax_109_gene_exons. gff 3 �Use searching function �/Gm 12
Basic command in Linux � cat ◦ Concatenate files ◦ Print out files ◦ Usage cat file_name 1 file_name 2 … ◦ Practice) �Print out file by cat �Print out file three times
Basic command in Linux � grep ◦ Grep the lines contain some words ◦ Usually use with cat ◦ Usage) cat file_name | grep ‘word’ � ‘|’ mean after � This usage mean we grep line which contain some word after print out file ◦ Various useful options � -v : vanish � -c : count � ‘word 1|word 2’ = word 1 or word 2 � grep ‘word 1’ | grep ‘word 2’ = word 1 and word 2 ◦ Practice) � � � Grep ‘Gm 12’ in /data 2/python_study/Gmax_109_gene_exons. gff 3 Grep ‘Gm 12’ or ‘Gm 15’ in same file Grep ‘gene’ and ‘m. RNA’ Count line contain ‘Gm 12’ Vanish line contain exon or CDS or m. RNA
Basic command in Linux � sort ◦ ◦ Sorting file Usually use with cat Usage) cat file_name | sort Various useful options �-k sort by column �-u sort and remove redundancy �-n numeric sort �-r reverse �-d delimiter setting ◦ Practice) �Sort /data 2/python_study/Gmax_109_gene_exons. gff 3 by start position(by column and numeric)
Basic command in Linux � cut ◦ Cutting column in file ◦ Usually use with cat ◦ Usage) cat file_name | cut –f n (n : integer) ◦ Practice) �Retrieve chromosome, start position, end position in /data 2/python_study/Gmax_109_gene_exons. gff 3
Basic command in Linux �> ◦ Standard input, output vs. file input, output �Input and output on screen or file ◦ > can save standard output to file output �cat file_name | grep ‘word’ > output_file � >> ◦ >> also can save standard output to file output �But just adding!
Handle file � Fasta file � Fastq file ◦ /data 2/python_study/ap 2. fa ◦ /data 2/python_study/example. fastq � Gff file ◦ /data 2/python_study/Gmax_109_gene_exons. gff 3 � Python file! ◦ /data 2/python_study/1 stday. py
Homework! � You have to run all the practice and save them as files in your directory
- Slides: 17