macでインフォマティクス

macでインフォマティクス

HTS (NGS) 関連のインフォマティクス情報についてまとめています。

フォーマット変換 GenBank => FASTA

2020 6/4 構成を変更

 

1、EMBOSSのseqretコマンドを使う(インストール)。

ゲノムのGenbankファイルを読み込んでfasta出力する。複数配列あるならmulti fasta出力される。

seqret input.gbk out.fasta

正規表現をサポートしているので、うまくワイルドカードを使えば大量のgenebakファイルから同時にfastaを抜き出すこともできる(正し*gbkと打っても受け付けない)。

  

2、BEDOPSのconvert2bedを使う。

> convert2bed -h

$ convert2bed -h

convert2bed

  version:  2.4.37

  author:   Alex Reynolds

 

  Usage:

 

  $ convert2bed --input=fmt [--output=fmt] [options] < input > output

 

  Convert BAM, GFF, GTF, GVF, PSL, RepeatMasker (OUT), SAM, VCF

  and WIG genomic formats to BED or BEDOPS Starch (compressed BED)

 

  Input can be a regular file or standard input piped in using the

  hyphen character ('-'):

 

  $ some_upstream_process ... | convert2bed --input=fmt - > output

 

  Input (required):

 

  --input=[bam|gff|gtf|gvf|psl|rmsk|sam|vcf|wig] (-i <fmt>)

      Genomic format of input file (required)

 

  Output:

 

  --output=[bed|starch] (-o <fmt>)

      Format of output file, either BED or BEDOPS Starch (optional, default is BED)

 

  Other processing options:

 

  --do-not-sort (-d)

      Do not sort BED output with sort-bed (not compatible with --output=starch)

  --max-mem=<value> (-m <val>)

      Sets aside <value> memory for sorting BED output. For example, <value> can

      be 8G, 8000M or 8000000000 to specify 8 GB of memory (default is 2G)

  --sort-tmpdir=<dir> (-r <dir>)

      Optionally sets [dir] as temporary directory for sort data, when used in

      conjunction with --max-mem=[value], instead of the host's operating system

      default temporary directory

  --starch-bzip2 (-z)

      Used with --output=starch, the compressed output explicitly applies the bzip2

      algorithm to compress intermediate data (default is bzip2)

  --starch-gzip (-g)

      Used with --output=starch, the compressed output applies gzip compression on

      intermediate data

  --starch-note="xyz..." (-e "xyz...")

      Used with --output=starch, this adds a note to the Starch archive metadata

  --help | --help[-bam|-gff|-gtf|-gvf|-psl|-rmsk|-sam|-vcf|-wig] (-h | -h <fmt>)

      Show general help message (or detailed help for a specified input format)

  --version (-w)

      Show application version

GFF=> BED 

convert2bed --input=gff < input.gff3 > output.bed

 GFF3にも対応。

 

 3、Biostarsのスレッドで紹介されているスクリプトを使う。

Challenge: Convert GenBank to Fasta without bioperl, without emboss, or any other dependencies

f:id:kazumaxneo:20190131150326j:plain

 たとえばgenbank2fasta.plとして保存し、以下のように実行

perl genbank2fasta.pl input.gbff > output.fa

 

4、オンラインのツールを使う。


 

引用

Biostars

Challenge: Convert GenBank to Fasta without bioperl, without emboss, or any other dependencies