小编欢乐豆又放出一个珍藏多年的脚本,2749 行的长度,长到已经难以用 GPT 解读啦,不过用起来还是很方便的!这个 perl 脚本用于将 GenBank 格式的文件转换为 GFF3 格式。
perl 是前提啦,当然,如果用 Linux,有自带的,就不需要再安装啦!推荐使用windows10/11的 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
GBK格式,从ncbi网页上下载下来的.gb后辍的,一样可以分析的,看下下是用的正则表达式匹配的:
gbk格式:
转换好的GFF3格式:
head E_coli.gbk.gff less -S
怎么样,有没有用,要不要收藏或者用起来呀? 如果在学习过程中有什么疑问欢迎大家留言讨论。