bioperl怎么处理fasta和fastq序列

bioperl怎么处理fasta和fastq序列

这篇文章主要介绍“bioperl怎么处理fasta和fastq序列”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“bioperl怎么处理fasta和fastq序列”文章能帮助大家解决问题。

bioperl处理fasta序列最全代码:

bioperl怎么处理fasta和fastq序列

序列的读取与输出

useBio::SeqIO;useBio::Seq;useData::Dumper;$in=Bio::SeqIO->new(-file=>"D:/share/scripts/Arabidopsis_thaliana.TAIR10.cds.all.fa",-alphabet=>"dna",-format=>'Fasta');$out=Bio::SeqIO->new(-file=>">D:/share/scripts/aa.fa",-format=>'fasta');while(my$seqobj=$in->next_seq()){#thehumanread-ableidofthesequencemy$id=$seqobj->id();#stringofsequencemy$seq=$seqobj->seq();#adescriptionofthesequencemy$desc=$seqobj->desc();#oneof'dna','rna','protein'https://www.bioinformatics.org/sms/iupac.htmlmy$alphabet=$seqobj->alphabet();my$len=$seqobj->length();print$id."\n";print$seq."\n";print$desc."\n";print$alphabet."\n";print$len."\n";print$seqobj."\n";printDumper($seqobj);$out->write_seq($seqobj);last;}

Fastq序列的处理:

$in1=Bio::SeqIO->new(-file=>"D:/share/scripts/test_1.fastq",-format=>'fastq');$in2=Bio::SeqIO->new(-file=>"D:/share/scripts/test_2.fastq",-format=>'fastq');$out=Bio::SeqIO->new(-file=>">D:/share/scripts/test_1.fa",-format=>'fasta');while(my$seqobj1=$in1->next_seq()andmy$seqobj2=$in2->next_seq()){#thehumanread-ableidofthesequencemy$id=$seqobj->id();#stringofsequencemy$seq=$seqobj->seq();#adescriptionofthesequencemy$desc=$seqobj->desc();#oneof'dna','rna','protein'https://www.bioinformatics.org/sms/iupac.htmlmy$alphabet=$seqobj->alphabet();my$len=$seqobj->length();my$qual=$seqobj->qual();print$id."\n";print$seq."\n";print$desc."\n";print$alphabet."\n";print$len."\n";print"@{$qual}\n";printDumper($seqobj);$out->write_seq($seqobj);last;}

序列的截取 反向互补序列:

my$seqobj=Bio::Seq->new(-seq=>'actgtggcgtcaact',-desc=>'SampleBio::Seqobject',-id=>"ID1");#partofthesequenceasastringmy$subseq=$seqobj->subseq(5,10);print$subseq."\n";my$newSeqobj=Bio::Seq->new(-seq=>$subseq,-desc=>'subseq5-10',-id=>"ID2",);$out->write_seq($newSeqobj);


trunc和subseq有区别,trunc返回还是原来的序列对象,只是截短了,而subseq返回的是截取的序列字符串,一般subseq使用的多一些:

$out=Bio::SeqIO->new(-file=>">D:/share/scripts/subseq1.fa",-format=>'Fasta');my$subseqObj=$seqobj->trunc(5,10);my$subseq=$seqobj->subseq(5,10);print$subseqObj."\n";print$subseq."\n";$out->write_seq($subseqObj);my$revcom=$seqobj->revcom;#序列反向互补print$revcom."\n";print$subseqObj."\n";print$seqobj."\n";

DNA序列翻译成蛋白质序列:

#参数 1 stop *

# 2 unknown amino acid ('X').

my$translate0=$seqobj->translate(undef,undef,0);my$translate1=$seqobj->translate(undef,undef,1);my$translate2=$seqobj->translate(undef,undef,2);printDumper($translate0)."\n";printDumper($translate1)."\n";printDumper($translate2)."\n";

关于“bioperl怎么处理fasta和fastq序列”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识,可以关注恰卡编程网行业资讯频道,小编每天都会为大家更新不同的知识点。

发布于 2022-03-18 22:46:55
收藏
分享
海报
0 条评论
29
上一篇:vue中vm指的是什么 下一篇:perl怎么对组装结果中GAP左右批量设计引物
目录

    0 条评论

    本站已关闭游客评论,请登录或者注册后再评论吧~

    忘记密码?

    图形验证码