Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from string import *
- import numpy as np
- str1=input("Votre fichier 1: ")
- str2=input("Votre fichier 2: ")
- def list_fasta (str): #Cela décompose un fichier fasta dans un dictionnaire, mais nous n'utiliserons que la clé "sNuc" du dictionnaire
- f= open(str, 'r')
- index = f.readline()
- dicosequence={}
- while index !="":
- if index[0] == '>':
- dicosequence["nom"]=index
- else:
- dicosequence["sNuc"]=index
- index= f.readline()
- return dicosequence
- seq1=list_fasta(str1)
- seq1=seq1["sNuc"]
- seq2=list_fasta(str2)
- seq2=seq1["sNuc"]
- def faites_votre_score_Nucleo():
- scoreperso={}
- scoreperso["match"] = input("Score match : \n")
- scoreperso["transition"] = input("Score mismatch Purine/Purine ou Pyrimidine/pyrimidine :\n")
- scoreperso["transversion"] = input("Score mismatch différents : \n")
- scoreperso["ouverture_gap"] = input("Score ouverture de gap : \n")
- scoreperso["ext_gap"] = input("Score extension gap : \n")
- return scoreperso
- #scoredefaut = {"match" : 2, "transversion" : -1, "transition" : 1, "ouverture_gap" : -10 , "ext_gap" : -1}
- def choix_nucleo():
- choix = input("voulez vous faire votre propre matrice? tapez y pour oui et n pour non\n")
- while choix !="y" and choix !="n":
- choix = input("voulez vous faire votre propre matrice? tapez y pour oui et n pour non:\n")
- if choix == "y":
- dicoscore = faites_votre_score_Nucleo()
- else:
- dicoscore = {"match" : 2, "transversion" : -1, "transition" : 1, "ouverture_gap" : -10 , "ext_gap" : -1}
- return dicoscore
- def choix_prot() :
- matrixFile=open("blosum62.txt","r")
- lines = matrixFile.readlines()
- matrixFile.close()
- dictaa = {}
- aminoacidstring = lines[0]
- aminoacidstring = aminoacidstring.split()
- i = 1
- while i <= (len(lines) - 1) :
- row = lines[i]
- row = row.split()
- j = 1
- for character in row[1 :25] :
- dictaa[aminoacidstring[i - 1], aminoacidstring[
- j - 1]] = character
- j += 1
- i += 1
- choix=input("Voulez vous choisir vos score de gap ? y : OUI, n : NON\n")
- while choix!="y" and choix!="n":
- choix = input("Voulez vous choisir vos score de gap ? y : OUI, n : NON\n")
- if choix=="y":
- dictaa["Ouverture_gap"]=input("Score ouverture de gap:\n")
- dictaa["ext_gap"]=input("Score d'extension de gap:\n")
- else:
- dictaa["Ouverture_gap"]=-10
- dictaa["ext_gap"]=-1
- return (dictaa)
- def interface_user():
- choix=input("1: Utiliser une matrice pour nucléotide\n2:Utiliser une matrice pour protéine\n")
- while choix !=1 and choix !="2":
- choix = input("1: Utiliser une matrice pour nucléotide\n2:Utiliser une matrice pour protéine\n")
- if choix=="1":
- choix_nucleo()
- else:
- choix_prot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement