前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >20220518_blastn结果转化为gff格式文件

20220518_blastn结果转化为gff格式文件

原创
作者头像
wilson_bit
发布2022-05-18 17:56:24
5670
发布2022-05-18 17:56:24
举报
文章被收录于专栏:igenomeigenomeigenome

20220518_blastn结果转化为gff格式文件

01 准备数据库序列文件以及待比对序列文件

(base) dell@dell-server:~/test$ ls -lhtr
总用量 904K
-rw-rw-r-- 1 dell dell 450K 5月  18 17:45 query.fastq
-rw-rw-r-- 1 dell dell 450K 5月  18 17:45 target_db.fastq

02 创建比对数据库

(base) dell@dell-server:~/test$  makeblastdb  -in  target_db.fasta  -dbtype nucl -parse_seqids  -out target_database


Building a new DB, current time: 05/18/2022 17:48:33
New DB name:   /home/dell/test/target_database
New DB title:  target_db.fasta
Sequence type: Nucleotide
Keep Linkouts: T
Keep MBits: T
Maximum file size: 1000000000B
Adding sequences from FASTA; added 500 sequences in 0.0449848 seconds.




(base) dell@dell-server:~/test$ ls -lhtr
总用量 1.1M
-rw-rw-r-- 1 dell dell 450K 5月  18 17:45 query.fasta
-rw-rw-r-- 1 dell dell 450K 5月  18 17:45 target_db.fasta
-rw-rw-r-- 1 dell dell 109K 5月  18 17:48 target_database.nsq
-rw-rw-r-- 1 dell dell  849 5月  18 17:48 target_database.nsi
-rw-rw-r-- 1 dell dell  42K 5月  18 17:48 target_database.nsd
-rw-rw-r-- 1 dell dell 2.0K 5月  18 17:48 target_database.nog
-rw-rw-r-- 1 dell dell 6.0K 5月  18 17:48 target_database.nin
-rw-rw-r-- 1 dell dell  37K 5月  18 17:48 target_database.nhr

03 准备待比对序列文件与数据库序列文件进行比对,并将结果转化为gff格式文件


这是未转化为gff格式之前的比对结果
(base) dell@dell-server:~/test$ blastn -db target_database   -query  query.fasta   -outfmt 6  | head
animal_mito;NC_031808.1;ATP6;LEN=684    animal_mito;NC_031808.1;ATP6;LEN=684    100.00  684     0       0       1       684     1    684      0.0     1264
animal_mito;NC_031808.1;ATP6;LEN=684    animal_mito;NC_036746.1;ATP6;LEN=684    89.62   684     71      0       1       684     1    684      0.0     870
animal_mito;NC_031808.1;ATP6;LEN=684    animal_mito;NC_002079.1;ATP6;LEN=684    86.99   684     89      0       1       684     1    684      0.0     771
animal_mito;NC_031808.1;ATP6;LEN=684    animal_mito;NC_036383.1;ATP6;LEN=684    85.67   684     98      0       1       684     1    684      0.0     721
animal_mito;NC_031808.1;ATP6;LEN=684    animal_mito;NC_045918.1;ATP6;LEN=684    85.38   684     100     0       1       684     1    684      0.0     710
animal_mito;NC_031808.1;ATP6;LEN=684    animal_mito;NC_031813.1;ATP6;LEN=684    81.95   687     118     5       1       684     1    684      5e-166  577
animal_mito;NC_031808.1;ATP6;LEN=684    animal_mito;NC_027953.1;ATP6;LEN=684    76.56   687     155     6       1       684     1    684      2e-104  372
animal_mito;NC_004299.1;ATP6;LEN=684    animal_mito;NC_004299.1;ATP6;LEN=684    100.00  684     0       0       1       684     1    684      0.0     1264
animal_mito;NC_004299.1;ATP6;LEN=684    animal_mito;NC_011632.1;ATP6;LEN=683    94.57   681     35      2       1       680     1    680      0.0     1051
animal_mito;NC_045918.1;ATP6;LEN=684    animal_mito;NC_045918.1;ATP6;LEN=684    100.00  684     0       0       1       684     1    684      0.0     1264


这是转化为gff格式之后的比对结果
(base) dell@dell-server:~/test$ blastn -db target_database   -query  query.fasta   -outfmt 6  | awk -v OFS="\t" '{ if ($10 > $9) print $2, "tblastn", "match", $9, $10, $12, "+", ".", "ID="$1; else print $2, "tblastn", "match", $10, $9, $12, "-", ".", "ID="$1 }' | head
animal_mito;NC_031808.1;ATP6;LEN=684    tblastn match   1       684     1264    +       .       ID=animal_mito;NC_031808.1;ATP6;LEN=684
animal_mito;NC_036746.1;ATP6;LEN=684    tblastn match   1       684     870     +       .       ID=animal_mito;NC_031808.1;ATP6;LEN=684
animal_mito;NC_002079.1;ATP6;LEN=684    tblastn match   1       684     771     +       .       ID=animal_mito;NC_031808.1;ATP6;LEN=684
animal_mito;NC_036383.1;ATP6;LEN=684    tblastn match   1       684     721     +       .       ID=animal_mito;NC_031808.1;ATP6;LEN=684
animal_mito;NC_045918.1;ATP6;LEN=684    tblastn match   1       684     710     +       .       ID=animal_mito;NC_031808.1;ATP6;LEN=684
animal_mito;NC_031813.1;ATP6;LEN=684    tblastn match   1       684     577     +       .       ID=animal_mito;NC_031808.1;ATP6;LEN=684
animal_mito;NC_027953.1;ATP6;LEN=684    tblastn match   1       684     372     +       .       ID=animal_mito;NC_031808.1;ATP6;LEN=684
animal_mito;NC_004299.1;ATP6;LEN=684    tblastn match   1       684     1264    +       .       ID=animal_mito;NC_004299.1;ATP6;LEN=684
animal_mito;NC_011632.1;ATP6;LEN=683    tblastn match   1       680     1051    +       .       ID=animal_mito;NC_004299.1;ATP6;LEN=684
animal_mito;NC_045918.1;ATP6;LEN=684    tblastn match   1       684     1264    +       .       ID=animal_mito;NC_045918.1;ATP6;LEN=684


最后输出gff格式输出结果
(base) dell@dell-server:~/test$ blastn -db target_database   -query  query.fasta   -outfmt 6  | awk -v OFS="\t" '{ if ($10 > $9) print $2, "tblastn", "match", $9, $10, $12, "+", ".", "ID="$1; else print $2, "tblastn", "match", $10, $9, $12, "-", ".", "ID="$1 }' > blastn_result.gff
(base) dell@dell-server:~/test$ ls -lhtr
总用量 1.4M
-rw-rw-r-- 1 dell dell 450K 5月  18 17:45 query.fasta
-rw-rw-r-- 1 dell dell 450K 5月  18 17:45 target_db.fasta
-rw-rw-r-- 1 dell dell 109K 5月  18 17:48 target_database.nsq
-rw-rw-r-- 1 dell dell  849 5月  18 17:48 target_database.nsi
-rw-rw-r-- 1 dell dell  42K 5月  18 17:48 target_database.nsd
-rw-rw-r-- 1 dell dell 2.0K 5月  18 17:48 target_database.nog
-rw-rw-r-- 1 dell dell 6.0K 5月  18 17:48 target_database.nin
-rw-rw-r-- 1 dell dell  37K 5月  18 17:48 target_database.nhr
-rw-rw-r-- 1 dell dell 226K 5月  18 17:54 blastn_result.gff

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 20220518_blastn结果转化为gff格式文件
    • 01 准备数据库序列文件以及待比对序列文件
      • 02 创建比对数据库
        • 03 准备待比对序列文件与数据库序列文件进行比对,并将结果转化为gff格式文件
        相关产品与服务
        数据库
        云数据库为企业提供了完善的关系型数据库、非关系型数据库、分析型数据库和数据库生态工具。您可以通过产品选择和组合搭建,轻松实现高可靠、高可用性、高性能等数据库需求。云数据库服务也可大幅减少您的运维工作量,更专注于业务发展,让企业一站式享受数据上云及分布式架构的技术红利!
        领券
        问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档