def borodovsky_blosum_50_2(): seqs = sequence.readFastaFile("./files/simple_seqs/borodovsky.fasta") profile1 = aln_profile.AlignmentProfile([seqs[0]]) profile2 = aln_profile.AlignmentProfile([seqs[1]]) phmm = align.load_params(params.borodovsky_4_7, [profile1, profile2], sub_matrix.blosum62LatestProbs, log_transform=False) return phmm
def durbin_blosum_50_2(): seqs = sequence.readFastaFile("./files/simple_seqs/durbin_2.fasta") profile1 = aln_profile.AlignmentProfile([seqs[0]]) profile2 = aln_profile.AlignmentProfile([seqs[1]]) phmm = align.load_params(params.basic_params, [profile1, profile2], sub_matrix.blosum50, log_transform=True) return phmm
def probabilities_blosum_62_2(): seqs = sequence.readFastaFile("./files/simple_seqs/simple_2.fasta") profile1 = aln_profile.AlignmentProfile([seqs[0]]) profile2 = aln_profile.AlignmentProfile([seqs[1]]) phmm = align.load_params(params.basic_params, [profile1, profile2], sub_matrix.blosum62LatestProbs, log_transform=True) return phmm
def two_col_62_2(): seqs = sequence.readFastaFile("./files/custom_seqs/2_col.fasta") profile1 = aln_profile.AlignmentProfile([seqs[0]]) profile2 = aln_profile.AlignmentProfile([seqs[1]]) phmm = align.load_params(params.basic_params, [profile1, profile2], sub_matrix.blosum62, log_transform=True) return phmm
def ox_104t17_1(): seqs = sequence.readFastaFile( "./files/qscore_corrections/ox_104t17_1.fasta") profile1 = aln_profile.AlignmentProfile([seqs[0]]) profile2 = aln_profile.AlignmentProfile([seqs[1]]) phmm = align.load_params(params.qscore_params, [profile1, profile2], sub_matrix.blosum62EstimatedWithX, log_transform=True) return phmm
def runBaumWelch(parameters, profiles, aln_type, count=0, stop=2): if count == stop: return parameters pair_hmm = align.load_params(parameters, profiles, subsmat=sub_matrix.blosum62EstimatedWithX_dict, log_transform=True, predecessors=predecessors) print ('Delta value is ') print (pair_hmm.delta) print ('Epsilon value is') print (pair_hmm.epsilon) print ("Emission X value is ") print (pair_hmm.emissionX) print ("Emission Y value is ") print (pair_hmm.emissionY) if aln_type == 'viterbi': pair_hmm.performViterbiAlignment() copy_hmm = copy.deepcopy(pair_hmm) aligned_profile = copy_hmm.get_alignment(type_to_get='viterbi') print (aligned_profile) # Update parameters parameters['epsilon'] = float(pair_hmm.epsilon + 0.00001) parameters['delta'] = float(pair_hmm.delta + 0.00001) parameters['emissionX'] = float(pair_hmm.emissionX + 0.00001) parameters['emissionY'] = float(pair_hmm.emissionY + 0.00001) return runBaumWelch(parameters, profiles, aln_type, count +1) elif aln_type == 'mea': pair_hmm.performMEAAlignment() copy_hmm = copy.deepcopy(pair_hmm) aligned_profile = copy_hmm.get_alignment(type_to_get='mea') print (aligned_profile) # Update parameters parameters['epsilon'] = float(pair_hmm.epsilon + 0.00001) parameters['delta'] = float(pair_hmm.delta + 0.00001) parameters['emissionX'] = float(pair_hmm.emissionX + 0.00001) parameters['emissionY'] = float(pair_hmm.emissionY + 0.00001) return runBaumWelch(parameters, profiles, aln_type, count +1) # seqs = sequence.readFastaFile(sequences, alphabet=Protein_Alphabet_wB_X_Z) # # aln_order = [("N0", [seqs[0].name, seqs[1].name])] # # seqs = get_profiles(seqs, aln_order) # # # Reload parameters # # pair_hmm = align.load_params(parameters, seqs, subsmat=sub_matrix.blosum62EstimatedWithX_dict, # log_transform=True) # seq_file = '../tests/files/custom_seqs/2_col.fasta' # output_file = '../tests/files/custom_seqs/col_3.aln' # aln_type = 'mea' # seqs = sequence.readFastaFile(seq_file, alphabet=Protein_Alphabet_wB_X_Z) # # # for seq_order in list(itertools.combinations(seqs, 2)): # # profiles = [aln_profile.AlignmentProfile([x]) for x in seq_order] # print (seq_order) # # change_params = runBaumWelch(change_params, profiles, aln_type) # # # print (params) # print (change_params) # alignment = align.align_seqs(seq_file, # output_file, aln_type, # params=params, subsmat=sub_matrix.blosum62EstimatedWithX_dict,log_transform=True) # # change_alignment = align.align_seqs(seq_file, # output_file, aln_type, # params=change_params, subsmat=sub_matrix.blosum62EstimatedWithX_dict,log_transform=True)