美文网首页
脚本分享--将GenBank格式的文件转换为GFF3格式

脚本分享--将GenBank格式的文件转换为GFF3格式

作者: zd200572 | 来源:发表于2024-01-25 16:27 被阅读0次

小编欢乐豆又放出一个珍藏多年的脚本,2749行的长度,长到已经难以用GPT解读啦,不过用起来还是很方便的!这个perl脚本用于将GenBank格式的文件转换为GFF3格式。

脚本使用准备

perl是前提啦,当然,如果用Linux,有自带的,就不需要再安装啦!推荐使用WSL2。以下是我的依赖安装记录:

# 修改 cpan镜像地址:
vi  ~/.cpan/CPAN/MyConfig.pm 

# 不习惯vi的话gedit也可以的,前提是安装了的 gedit ~/.cpan/CPAN/MyConfig.pm 
# 这一行修改为中科大的源,这样就能节省很多模块的下载时间啦
  'urllist' => [q[http://mirrors.ustc.edu.cn/CPAN/]],
cpan
# 安装 Bioperl
install  Bio::Root::RootI # 敲上几个回车就解决啦!

参数和用法

以下是脚本的一些主要选项和用法:

 perl Genbank_to_gff3.pl -h
Usage:
      Genbank_to_gff3.pl [options] filename(s)

      # process a directory containing GenBank flatfiles
      perl Genbank_to_gff3.pl --dir path_to_files --zip

      # process a single file, ignore explicit exons and introns
      perl Genbank_to_gff3.pl --filter exon --filter intron file.gbk.gz

      # process a list of files
      perl Genbank_to_gff3.pl *gbk.gz

      # process data from URL, with Chado GFF model (-noCDS), and pipe to database loader
      curl ftp://ftp.ncbi.nih.gov/genomes/Saccharomyces_cerevisiae/CHR_X/NC_001142.gbk \
      | perl Genbank_to_gff3.pl -noCDS -in stdin -out stdout \

        Options:
            --noinfer  -r  don't infer exon/mRNA subfeatures
            --conf     -i  path to the curation configuration file that contains user preferences
                           for Genbank entries (must be YAML format)
                           (if --manual is passed without --ini, user will be prompted to
                            create the file if any manual input is saved)
            --sofile  -l  path to to the so.obo file to use for feature type mapping
                           (--sofile live will download the latest online revision)
            --manual   -m  when trying to guess the proper SO term, if more than
                           one option matches the primary tag, the converter will
                           wait for user input to choose the correct one
                           (only works with --sofile)
            --dir      -d  path to a list of genbank flatfiles
            --outdir   -o  location to write GFF files (can be 'stdout' or '-' for pipe)
            --zip      -z  compress GFF3 output files with gzip
            --summary  -s  print a summary of the features in each contig
            --filter   -x  genbank feature type(s) to ignore
            --split    -y  split output to separate GFF and fasta files for
                           each genbank record
            --nolump   -n  separate file for each reference sequence
                           (default is to lump all records together into one
                           output file for each input file)
            --ethresh  -e  error threshold for unflattener
                           set this high (>2) to ignore all unflattener errors
            --[no]CDS  -c  Keep CDS-exons, or convert to alternate gene-RNA-protein-exon
                           model. --CDS is default. Use --CDS to keep default GFF gene model,
                           use --noCDS to convert to g-r-p-e.
            --format   -f  Input format (SeqIO types): GenBank, Swiss or Uniprot, EMBL work
                           (GenBank is default)
            --GFF_VERSION  3 is default, 2 and 2.5 and other Bio::Tools::GFF versions available
            --quiet        don't talk about what is being processed
            --typesource   SO sequence type for source (e.g. chromosome; region; contig)
            --help     -h  display this message

显然也难以使用GPT进行改写啦,一般的大模型都hold不住这么长的输入吧!没关系,我们先用起来试试!
随便从ncbi上下载一个gbk序列测试下,比如这条:
ftp://ftp.ncbi.nih.gov/genomes/Saccharomyces_cerevisiae/CHR_X/NC_001142.gbk

perl Genbank_to_gff3.pl --dir ./
# Input: .//E_coli.gbk
# working on region:NZ_KE701390, Escherichia coli KOEGE 71 (186a), Escherichia coli KOEGE 71 (186a) acYxK-supercont1.9, whole genome shotgun sequence., 23-JUN-2023
# GFF3 saved to ./E_coli.gbk.gff

相关文章

网友评论

      本文标题:脚本分享--将GenBank格式的文件转换为GFF3格式

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