Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 22 15:39:51 2019
@author: Amaury Leroy
"""
import re
from Bio.ExPASy import Prosite
help(Prosite)
# Questions 1/2 en important depuis mes fichiers,
#j'ai préféré ça plutôt que de télécharger direct mais faudrait changer
handle = open("prosite.dat.txt")
for record in Prosite.parse(handle):
if "P-loop" in record.description:
print(record.pattern)
print(record.name)
print(record.accession)
#Questions 3/4/5
import gzip
from Bio import SeqIO
with gzip.open("orf_coding_all.fasta.gz", "rt") as handle:
sequences= list(SeqIO.parse(handle, "fasta") )
print(sum(len(r) for r in SeqIO.parse(handle, "fasta")))
seq_trad=[]
for i in range(len(sequences)):
seq_trad.append(sequences[i].seq.translate(table="Yeast Mitochondrial"))
with gzip.open("orf_trans_all.fasta.gz", "rt") as handle:
seq_trad_true= list(SeqIO.parse(handle, "fasta") )
compteur = 0
for i in range(len(seq_trad)) :
if str(seq_trad[i])!=str(seq_trad_true[i].seq):
compteur+=1
print(compteur, " erreur(s) de traduction") #j'affiche dès qu'une séquence est mal
#traduite (au moins une erreur), en pratique j'ai testé au sein d'une séquence y a
#au moins 3-4 erreurs de traduction
#Question 6. Il manque le stockage et l'histogramme horizontal
regex = "[AG]-x(4)-G-K-[ST]".translate({ord(k):v for k,v in {"-":"", "(":"{", ")":"}","x":"."}.items()})
creg = re.compile(regex)
re.search(creg, "MSQQVGNSIRRKLVIVGDGACGKTCLLIVFSK")
re.search(creg, str(seq_trad_true[0].seq))