美文网首页
选择blast比对第一条best hit的结果

选择blast比对第一条best hit的结果

作者: 徐诗芬 | 来源:发表于2021-04-14 12:53 被阅读0次

blast的结果中每条contig都会有很多hit,最好不用max_target_hit这个参数,因为它输出的是数据库中top的序列而不一定是比对最好的序列,即使所有版本都包含相同的最佳匹配结果,但是BLAST却返回不同的结果。而且以不同的方式对数据库进行排序,也会导致在将max_target_seqs参数设置为1时,BLAST返回不同的“top hit”。因此我们需要自己挑出所有hit中第一条打分最高的hit。
参考:https://www.jianshu.com/p/7eb530bc1a9c

nohup time blastn -db ref_prok_rep_genomes -query ../nextpolish/genome.nextpolish.fasta -perc_identity 90 -num_threads 16 -evalue 1e-5 -outfmt "6 std sscinames qcovus" -out nextpolish_blast_all.txt &

python blast_best.py nextpolish_blast_all.txt nextpolish_blast_best.txt
#!/usr/bin/python
# -*- coding: utf-8 -*-
# conda activate python3
"""
    作者:徐诗芬
    内容:读取并输出所有blast结果中最好的第一条hit结果
    日期:2021.1.22
"""
import sys

def usage():
    print('Usage: python blast_best.py [input_file] [outfile]')


def main():

    # global name
    inf = open(sys.argv[1], 'rt')
    ouf = open(sys.argv[2], 'wt')

    flag_list = []
    for line in inf:
        line = line.strip()
        name = line.split("\t")[0]
        #id = eval(line.split("\t")[2])
        if name not in flag_list:
            ouf.write(line + '\n')
        else:
            continue
        flag_list.append(name)

    inf.close()
    ouf.close()

try:
    main()
except IndexError:
    usage()

相关文章

  • 选择blast比对第一条best hit的结果

    blast的结果中每条contig都会有很多hit,最好不用max_target_hit这个参数,因为它输出的是数...

  • blast本地比对输出结果

    之前写过一篇如何使用blast+套件进行本地blast库的创建及比对,今天跟大家聊聊比对结果的输出格式。 比对命令...

  • blast本地比对输出结果

    之前写过一篇如何使用blast+套件进行本地blast库的创建及比对,今天跟大家聊聊比对结果的输出格式。 比对命令...

  • bowtie2比对结果之multi-hits

    了解到在seq中multi-hits的定义是 unique best hit, 即是read比对到了不同的位置,但...

  • 2022-06-05多序列比对教程

    1、格式化数据库 2、序列比对(筛选blast最优结果)

  • BLAST 比对

    BLAST 序列比对 通过BLAST,可以快速的从数据库中,找到和已知序列最相似的序列。uniprot,ncbi,...

  • blast比对

    使用blast在鱼的基因组上识别C-lectin基因 1. 下载基因组 wget -cftp://ftp.ncbi...

  • XMLtoPairwise | 又多一个BLAST结果解析器

    写在前面 前两天,推了一篇《简洁 | 优雅地整理 BLAST 比对结果》。其中我大体介绍了四种 BLAST 常用格...

  • diamond

    BLAST本地比对太慢?不怕用diamond 生信入门:序列比对之diamond

  • blat下载与安装

    blat是一款很经典的比对工具,与blast相比,具有速度快、共线性输出比对结果等优点。但是,blat源码包里面的...

网友评论

      本文标题:选择blast比对第一条best hit的结果

      本文链接:https://www.haomeiwen.com/subject/equklltx.html