Bioinformatics

Python4

kawagoe yura 2023. 2. 9. 18:44

<modules>

- group of funtions, but is not built in default python

- have to import to use

- Biopython

 

 

sys.argv[#]

- refers the designated files using number and carries out coding contents

Usage

import sys

openfile = open(sys.argv[1], 'r').readlines()

openfile = open(sys.argv[2], 'r').readlines()

Command

python2_python_file_name_file_name[1]_file_name[2]

 

 

os.system()

- executes linux funtion by python

 

glob()

- retrieves files from the present directory and returns output as a list

Usage

import os, glob

filelists = glob.glob("_../*.out")

print filelists

for filename in filelists :

     os.system("less"+filename+"_|_sort_-k_2_-n_>_・・")

 

 

<parsing practice using genebank file&fasta format file> 

#26 . Genebank format file을 title과 seq으로 구분하여 출력하여라

output

 

 

 

#27. 위 문제에서 seq을 10개씩 나열하여 출력하여라

output
:

 

 

 

user interface를 이용해 입력파일과 출력파일을 지정하는 연습!

#30. fasta format DNA sequence file을 가지고와 reverse sequence를 새로운 파일로 저장하여라

 

#31. 위 문제의 reverse sequence를 reverse complement sequence로 변환하여 새로운 파일로 저장하여라

output
input file = AP2.fa

 

 

 

#33. Genebank file 하나를 읽어 title과 Organism, mRNA 부분만 출력하여라

output

 

 

 

#35_2. 2개 이상의 genebank file이 하나로 합쳐져 있을 경우에서 위 포맷으로 출력하여라

output

 

 

 

#36_2. Fasta format DNA sequence file을 읽어 sequence 3개와 이에 해당하는 codon을 한줄씩 출력하여라

output
:

 

 

 

#37. 위 문제의 출력양식을 sequence 60개와 이에 해당하는 codon 20개가 한줄이 되도록 바꾸어 출력하어라

output
:

 

 

 

#38_2. 위 문제를 standard codon table을 이용하여 같은 포맷으로 출력하여라(title 추가)

output

 

coding 사용된 codon_amino_table file

 

 

 

#28. 위 개체의 아미노산서열(codon)을 6개의 reading frame으로 출력하여라(각 forward 3개, complementary_reverse 3개)

output