从多序列比对MSA中计算每个位置氨基酸的概率特征

2023-12-15 12:20

本文主要是介绍从多序列比对MSA中计算每个位置氨基酸的概率特征,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

 对于蛋白质序列中的每个位置,从 protein['msa']特征计算氨基酸(22种,包括X和gap)的概率值,从而得到protein['hhblits_profile']特征,protein['msa']先进行one-hot转化再reduce_mean计算。

import pickle
import tensorflow as tfdef make_hhblits_profile(protein):"""Compute the HHblits MSA profile if not already present."""if 'hhblits_profile' in protein:return protein# 表示蛋白质氨基酸存在于特定位置的概率值# Compute the profile for every residue (over all MSA sequences).protein['hhblits_profile'] = tf.reduce_mean(tf.one_hot(protein['msa'], 22), axis=0)return proteinwith open("Human_HBB_tensor_dict.pkl",'rb') as f:Human_HBB_tensor_dict = pickle.load(f)protein = Human_HBB_tensor_dict# protein['msa'] 维度为 shape=(771, 144)
print("protein['msa']")
print(protein['msa'])# tf.one_hot(protein['msa'], 22) 维度为shape=(771, 144, 22)
#print("tf.one_hot(protein['msa'], 22)")
#print(tf.one_hot(protein['msa'], 22)) protein = make_hhblits_profile(protein)# protein['hhblits_profile'] 维度为shape=(144, 22)
print("protein['hhblits_profile']")
print(protein['hhblits_profile'])

这篇关于从多序列比对MSA中计算每个位置氨基酸的概率特征的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/496432

相关文章

hdu4865(概率DP)

题意:已知前一天和今天的天气概率,某天的天气概率和叶子的潮湿程度的概率,n天叶子的湿度,求n天最有可能的天气情况。 思路:概率DP,dp[i][j]表示第i天天气为j的概率,状态转移如下:dp[i][j] = max(dp[i][j, dp[i-1][k]*table2[k][j]*table1[j][col] )  代码如下: #include <stdio.h>#include

poj 1113 凸包+简单几何计算

题意: 给N个平面上的点,现在要在离点外L米处建城墙,使得城墙把所有点都包含进去且城墙的长度最短。 解析: 韬哥出的某次训练赛上A出的第一道计算几何,算是大水题吧。 用convexhull算法把凸包求出来,然后加加减减就A了。 计算见下图: 好久没玩画图了啊好开心。 代码: #include <iostream>#include <cstdio>#inclu

uva 10131 最长子序列

题意: 给大象的体重和智商,求体重按从大到小,智商从高到低的最长子序列,并输出路径。 代码: #include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>#include <cstring>#include <cmath>#include <stack>#include <vect

uva 1342 欧拉定理(计算几何模板)

题意: 给几个点,把这几个点用直线连起来,求这些直线把平面分成了几个。 解析: 欧拉定理: 顶点数 + 面数 - 边数= 2。 代码: #include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>#include <cstring>#include <cmath>#inc

uva 11178 计算集合模板题

题意: 求三角形行三个角三等分点射线交出的内三角形坐标。 代码: #include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>#include <cstring>#include <cmath>#include <stack>#include <vector>#include <

XTU 1237 计算几何

题面: Magic Triangle Problem Description: Huangriq is a respectful acmer in ACM team of XTU because he brought the best place in regional contest in history of XTU. Huangriq works in a big compa

POJ1269 判断2条直线的位置关系

题目大意:给两个点能够确定一条直线,题目给出两条直线(由4个点确定),要求判断出这两条直线的关系:平行,同线,相交。如果相交还要求出交点坐标。 解题思路: 先判断两条直线p1p2, q1q2是否共线, 如果不是,再判断 直线 是否平行, 如果还不是, 则两直线相交。  判断共线:  p1p2q1 共线 且 p1p2q2 共线 ,共线用叉乘为 0  来判断,  判断 平行:  p1p

POJ1631最长单调递增子序列

最长单调递增子序列 import java.io.BufferedReader;import java.io.InputStream;import java.io.InputStreamReader;import java.io.PrintWriter;import java.math.BigInteger;import java.util.StringTokenizer;publ

leetcode105 从前序与中序遍历序列构造二叉树

根据一棵树的前序遍历与中序遍历构造二叉树。 注意: 你可以假设树中没有重复的元素。 例如,给出 前序遍历 preorder = [3,9,20,15,7]中序遍历 inorder = [9,3,15,20,7] 返回如下的二叉树: 3/ \9 20/ \15 7   class Solution {public TreeNode buildTree(int[] pr

音视频入门基础:WAV专题(10)——FFmpeg源码中计算WAV音频文件每个packet的pts、dts的实现

一、引言 从文章《音视频入门基础:WAV专题(6)——通过FFprobe显示WAV音频文件每个数据包的信息》中我们可以知道,通过FFprobe命令可以打印WAV音频文件每个packet(也称为数据包或多媒体包)的信息,这些信息包含该packet的pts、dts: 打印出来的“pts”实际是AVPacket结构体中的成员变量pts,是以AVStream->time_base为单位的显