当前位置: 首页 > news >正文

网站建设的价值是什么鹿泉网络推广

网站建设的价值是什么,鹿泉网络推广,get写作网站,广州品牌网络营销方式同源搜索#xff0c;多序列比对等都是常用的方式#xff0c;但是有很多的软件可以实现这些同源搜索和多序列比对#xff0c;但是不同的软件输出的文件格式却是不完全一致#xff0c;有熟悉的FASTA格式的#xff0c;也有A2M, A3M,stockholm等格式。 详细介绍#xff1a; …同源搜索多序列比对等都是常用的方式但是有很多的软件可以实现这些同源搜索和多序列比对但是不同的软件输出的文件格式却是不完全一致有熟悉的FASTA格式的也有A2M, A3M,stockholm等格式。 详细介绍 https://github.com/soedinglab/hh-suite/wiki#multiple-sequence-alignment-formats A3M格式文件示例 每个序列都以  开头的行开始并包含序列的标识信息。在序列标识行之后是与该序列相关的比对信息通常使用字母来表示氨基酸或核酸。‘-’表示缺失小写字母表示插入。 Stockholm格式文件示例 import dataclasses from typing import Sequence, Tuple import string import collections# Sequence 表示序列类型内部的 Sequence[int] 表示整数序列。 # DeletionMatrix 表示一个由整数组成的二维数组。 DeletionMatrix Sequence[Sequence[int]]### 1. 定义Msa类 # Python中dataclass 是一个装饰器Decorator用于创建称为数据类data class的类。 # dataclass 装饰器自动生成一些特殊方法如 __init__、__repr__、__eq__ 等 # 减少了编写这些方法的样板代码。 dataclasses.dataclass(frozenTrue) class Msa:Class representing a parsed MSA file.## 初始化参数sequences: Sequence[str]deletion_matrix: DeletionMatrixdescriptions: Sequence[str]# __post_init__ 是Python数据类data class中的特殊方法# 用于在创建数据类的实例之后进行进一步的初始化操作def __post_init__(self):if not (len(self.sequences) len(self.deletion_matrix) len(self.descriptions)):raise ValueError(All fields for an MSA must have the same length. fGot {len(self.sequences)} sequences, f{len(self.deletion_matrix)} rows in the deletion matrix and f{len(self.descriptions)} descriptions.)def __len__(self):return len(self.sequences)def truncate(self, max_seqs: int):return Msa(sequencesself.sequences[:max_seqs],deletion_matrixself.deletion_matrix[:max_seqs],descriptionsself.descriptions[:max_seqs])m_seq [AAALLL,AT-LAL,S-ALLI] # 多序列比对后的数据m_del_matrix [[0,0,0,0,0,0],[0,0,0,0,0,0],[0,0,0,0,0,0]]m_descriptions [seq1,seq2,seq3]# 实例化 test_msa Msa(m_seq, m_del_matrix, m_descriptions) print(test_msa) print(len(test_msa)) # 去除msa第三条序列 print(test_msa.truncate(2))### 2. 定义函数解析fasta格式字符串 def parse_fasta(fasta_string: str) - Tuple[Sequence[str], Sequence[str]]:Parses FASTA string and returns list of strings with amino-acid sequences.Arguments:fasta_string: The string contents of a FASTA file.Returns:A tuple of two lists:* A list of sequences.* A list of sequence descriptions taken from the comment lines. In thesame order as the sequences.sequences []descriptions []index -1for line in fasta_string.splitlines():line line.strip()if line.startswith():index 1descriptions.append(line[1:]) # Remove the at the beginning.sequences.append()continueelif not line:continue # Skip blank lines. sequences[index] linereturn sequences, descriptionswith open(test_aln.a3m) as f:a3m_string f.read() sequences, description parse_fasta(a3m_string)print(sequences) print(description)## 多序列比对a3m格式 ## 1. 每个序列都以 开头的行开始并包含序列的标识信息。 ## 2.在序列标识行之后是与该序列相关的比对信息通常使用字母来表示氨基酸或核酸。 ## ‘-’表示缺失小写字母表示插入。### 3.定义函数解析a3m格式的msa字符串生成Msa实例该函数调用parse_fasta函数 def parse_a3m(a3m_string: str) - Msa:Parses sequences and deletion matrix from a3m format alignment.Args:a3m_string: The string contents of a a3m file. The first sequence in thefile should be the query sequence.Returns:A tuple of:* A list of sequences that have been aligned to the query. Thesemight contain duplicates.* The deletion matrix for the alignment as a list of lists. The elementat deletion_matrix[i][j] is the number of residues deleted fromthe aligned sequence i at residue position j.* A list of descriptions, one per sequence, from the a3m file.sequences, descriptions parse_fasta(a3m_string)deletion_matrix []for msa_sequence in sequences:deletion_vec []deletion_count 0for j in msa_sequence:if j.islower():deletion_count 1else:deletion_vec.append(deletion_count)deletion_count 0deletion_matrix.append(deletion_vec)# Make the MSA matrix out of aligned (deletion-free) sequences.# string.ascii_lowercase, string模块提供的字符串常量包含了所有小写字母的 ASCII 字符# str.maketrans 是 Python 字符串方法用于创建一个字符映射表translation table# 换成并删除string.ascii_lowercasedeletion_table str.maketrans(, , string.ascii_lowercase)# str.translate 使用映射表执行字符转换删除小写字母aligned_sequences [s.translate(deletion_table) for s in sequences]return Msa(sequencesaligned_sequences,deletion_matrixdeletion_matrix,descriptionsdescriptions)with open(test_aln.a3m) as f:a3m_string f.read()msa1 parse_a3m(a3m_string) print(msa1)### 4.定义函数 解析stockholm格式的msa字符串生成Msa实例 def parse_stockholm(stockholm_string: str) - Msa:Parses sequences and deletion matrix from stockholm format alignment.Args:stockholm_string: The string contents of a stockholm file. The firstsequence in the file should be the query sequence.Returns:A tuple of:* A list of sequences that have been aligned to the query. Thesemight contain duplicates.* The deletion matrix for the alignment as a list of lists. The elementat deletion_matrix[i][j] is the number of residues deleted fromthe aligned sequence i at residue position j.* The names of the targets matched, including the jackhmmer subsequencesuffix.## 有序字典保持多序列比对中的序列顺序name_to_sequence collections.OrderedDict()for line in stockholm_string.splitlines():line line.strip()# 去除空行和注释行if not line or line.startswith((#, //)):continuename, sequence line.split()if name not in name_to_sequence:name_to_sequence[name] name_to_sequence[name] sequencemsa []deletion_matrix []query keep_columns []for seq_index, sequence in enumerate(name_to_sequence.values()):## 第一行为query序列if seq_index 0:# Gather the columns with gaps from the queryquery sequencekeep_columns [i for i, res in enumerate(query) if res ! -]# Remove the columns with gaps in the query from all sequences.aligned_sequence .join([sequence[c] for c in keep_columns])msa.append(aligned_sequence)# Count the number of deletions w.r.t. query.deletion_vec []deletion_count 0# query序列相对于每一个同源序列氨基酸位置的缺失情况累加连续缺失for seq_res, query_res in zip(sequence, query): if seq_res ! - or query_res ! -: if query_res -:deletion_count 1else:deletion_vec.append(deletion_count)deletion_count 0deletion_matrix.append(deletion_vec)return Msa(sequencesmsa,deletion_matrixdeletion_matrix,descriptionslist(name_to_sequence.keys()))with open(test_aln.stockholm) as f:stockholm_string f.read() print(stockholm_string)msa2 parse_stockholm(stockholm_string) print(msa2)## 注parse_stockholm 和 parse_a3m 函数生成Msa对象中 ## deletion_matrix中在查询序列deletion位置填上缺失的个数 ## 下一个氨基酸位置的0跳过所以总长度相等 ## 如函数输入msa中第一条序列query序列为“A--CE-H” 则函数输出的第一条序列为“ACEH” ## deletion_matrix的第一个元素为[0,2,0,1]
http://www.w-s-a.com/news/396459/

相关文章:

  • 杭州建设工程网seo服务是什么
  • 兼职做问卷调查的网站wordpress mysql设置
  • 怎么在百度上能搜到自己的网站山西seo谷歌关键词优化工具
  • 网站搭建免费模板飞鱼crm下载
  • 网站开发竞品分析app制作公司深圳
  • 网站建设ssc源码修复设计班级网站建设
  • 网站重定向凡科做网站不要钱
  • 佛山html5网站建设微信营销软件破解版
  • 网站单页做301南京百度推广
  • 私人做网站要多少钱展芒设计网页
  • 怎样网站制作设计如何在网上推广农产品
  • 做关键词排名卖网站聚名网
  • 吉林省住房城乡建设厅网站首页体育器材网站建设方案
  • 网站建设及维护专业手机金融界网站
  • 常州网站建设工作室建立网站有怎么用途
  • 如何盗取网站推广策划书模板
  • 游戏网站建设计划书网络开发需要学什么
  • 手机网站维护费网站开发包括网站过程
  • 懂做游戏钓鱼网站的网站建设技术的发展
  • 网站被百度收录百度一下你就知道 官网
  • 雅客网站建设做网站用什么做
  • 做宣传海报网站专业网站设计速寻亿企邦
  • 秦皇岛市住房和城乡建设局网站有关网站开发的参考文献
  • 晋城城乡建设局网站深圳外贸业务员工资
  • 招聘网站开发的公司销售运营主要做什么
  • 徐州网站无障碍建设wordpress证书
  • c语言可以做网站吗请人做网站收费多少
  • 中英双语网站怎么做网站为什么做静态
  • 毕业设计做音乐网站可以吗网站运营方案
  • windos 下做网站工具网站右侧返回顶部