Windows 7 64位 配置PSI-Blast 生成PSSM矩阵

blast+的本地化构建

1.1程序下载 链接到:ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/

1.2安装流程

建议安装在非系统盘,如将下载的 BLAST 程序安装到 E:\blast,生成 bin、doc 两个子目录,其中 bin 是程序目录,doc是文档目录,这样就安装完毕了。

1.3用户环境变量设置

右 键点击“我的电脑”-“属性”,然后选择“高级系统设置”标签-“环境变量”(图1),在用户变量下方“Path”随安装过程已自动添加其变量值,即 “E:\Blast\bin”。 此时点击“新建”-变量名“BLASTDB”,变量值为“E:\Blast\db”(即数据库路径,图2)。 

1.4查看程序版本信息
点击 Windows 的“开始”菜单,输入“cmd”(XP系统在运行中输入cmd)(图3)调出 MS-DOS 命令行,转到 Blast 安装目录,输入命令“blastn -version”即可查看版本(图4):

2.blast+本地数据库的构建

2.1 数据的获取

法 1:直接从 NCBI或者其他数据库网站下载所需序列做成数据库,或者自己已有的测序数据(格式必须是 fasta,名字可以自己随便命名,具体做法下面有说明 )。

法 2:从NCBI中的 ftp 库下载所需要的某一个库或几个库,其链接为ftp://ftp.ncbi.nlm.nih.gov/blast/db/FASTA/其中 nr.gz 为非冗余的数据库,nt.gz 为核酸数据库,month.nt.gz 为最近一个月的核酸序列数据。下载的month.nt.gz先用winrar解压缩,然后用makeblastdb.exe格式化。

### PSI-BLAST 的使用方法 PSI-BLAST 是一种迭代式的序列比对工具,用于检测远缘同源关系。它基于置特异性评分矩阵 (PSSM, Position-Specific Scoring Matrix),能够更敏感地识别具有相似功能或结构的蛋白质。 #### 运行 PSI-BLAST 的基本命令 以下是运行 PSI-BLAST 的典型命令及其参数说明: ```bash ./bin/psiblast -query query.fasta -db ./db/swissprot -num_iterations 3 -out_ascii_pssm output.pssm -out results.txt ``` - `-query`: 输入查询序列文件路径,通常是一个 FASTA 文件[^1]。 - `-db`: 数据库路径,指定要搜索的目标数据库(如 SwissProt 或其他自定义数据库)。 - `-num_iterations`: 设置 PSI-BLAST 的迭代次数,默认为 3 次。 - `-out_ascii_pssm`: 输出 ASCII 格式的 PSSM 文件名。 - `-out`: 结果输出文件名,保存每次迭代的结果。 #### 转换 PSSM 文件到 Python 字典 PSI-BLAST 生成PSSM 文件可以被解析并存储在一个字典 `pssm_dict` 中以便进一步分析。例如,可以通过以下方式处理 PSSM 平均得分: ```python def parse_pssm(pssm_file): pssm_dict = {} with open(pssm_file, 'r') as f: lines = f.readlines() for line in lines: if not line.strip() or line.startswith(' '): # Skip empty and header lines continue parts = line.split() position = int(parts[0]) # Sequence position amino_acid = parts[1] # Amino acid at the position scores = list(map(int, parts[2:-1])) # Scores for each residue substitution avg_score = float(parts[-1]) # Average score of this position pssm_dict[position] = { 'amino_acid': amino_acid, 'scores': scores, 'avg_score': avg_score } return pssm_dict # Example usage pssm_data = parse_pssm('output.pssm') print(pssm_data) ``` 上述代码片段展示了如何读取 PSSM 文件并将数据存入字典中,其中每一项包含了氨基酸替换分数以及平均分[^3]。 #### 计算蛋白质结构完整性 如果需要评估蛋白质结构的完整性,可参考如下流程: ```python import pandas as pd def calculate_protein_integrity(entity_poly_sequence, atom_residue_count): total_residues = len(entity_poly_sequence) # Total residues declared in entity_poly table observed_residues = sum(atom_residue_count.values()) # Sum of all observed residues from atoms integrity_percentage = (observed_residues / total_residues) * 100 return integrity_percentage # Example data loading entity_poly_df = pd.read_csv('entity_poly.csv') atom_counts = {'ALA': 50, 'GLY': 30} # Hypothetical example counts per residue type sequence = ''.join(entity_poly_df['pdbx_seq_one_letter_code'].dropna()) integrity = calculate_protein_integrity(sequence, atom_counts) print(f'Protein Integrity Percentage: {integrity:.2f}%') ``` 此脚本利用了实体多聚体表 (`entity_poly`) 和原子部分中的残基计数来估算蛋白质的整体完整性[^2]。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值