bioperl读写fasta/fastq压缩文件

bioperl读写gz压缩格式的fasta/fastq文件方法如下:

输入文件句柄:

fastq文件

open my F Q , " z c a t i n f i l e . f q . g z ∣ " o r d i e " FQ ,"zcat infile.fq.gz|" or die "FQ,"zcatinfile.fq.gz"ordie"!";

myf q = B i o : : S e q I O − > n e w ( − f h = > fq=Bio::SeqIO->new(-fh=>fq=Bio::SeqIO>new(fh=>FQ,-format=>‘fastq’);

fasta文件
open my F A , " z c a t i n f i l e . f a . g z ∣ " o r d i e " FA ,"zcat infile.fa.gz|" or die "FA,"zcatinfile.fa.gz"ordie"!";
myf a = B i o : : S e q I O − > n e w ( − f h = > fa=Bio::SeqIO->new(-fh=>fa=Bio::SeqIO>new(fh=>FA,-format=>‘fasta’);

输出文件句柄:

fastq文件

open my $GZ ,"| gzip >outfile.fq.gz" or die $!;

my$out = Bio::SeqIO->new(-fh => $GZ , -format => ‘fastq’);

fasta文件

open my $GZ ,"| gzip >outfile.fa.gz" or die $!;

my$out = Bio::SeqIO->new(-fh => $GZ , -format => ‘fasta’);

ref:http://www.omicsclass.com/article/581