Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does bioperl deal with fasta and fastq sequences

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how bioperl deals with fasta and fastq sequences". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how bioperl deals with fasta and fastq sequences" can help you solve the problem.

Bioperl handles the most complete code of the fasta sequence:

Sequence reading and output use Bio::SeqIO;use Bio::Seq;use Data::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 ()) {# the human read-able id of the sequencemy $id=$seqobj- > id (); # string of sequencemy $seq=$seqobj- > seq (); # a description of the sequencemy $desc=$seqobj- > desc () # one of '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"; print Dumper ($seqobj); $out- > write_seq ($seqobj); last } Fastq sequence processing: $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 () and my $seqobj2 = $in2- > next_seq ()) {# the human read-able id of the sequencemy $id=$seqobj- > id (); # string of sequencemy $seq=$seqobj- > seq () # a description of the sequencemy $desc=$seqobj- > desc (); # one of '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"; print Dumper ($seqobj); $out- > write_seq ($seqobj); last } sequence: my$seqobj = Bio::Seq- > new (- seq= > 'actgtggcgtcaact',-desc = >' Sample Bio::Seq object',-id = > "ID1"); # part of the sequence as a stringmy$subseq=$seqobj- > subseq (5pm 10); print $subseq. "\ n"; my$ newSeqobj = Bio::Seq- > new (- seq= > $subseq,-desc = > 'subseq 5-10,-id = > "ID2",); $out- > write_seq ($newSeqobj)

Trunc is different from subseq. Trunc returns the original sequence object, but it is truncated, while subseq returns the intercepted sequence string. Generally, subseq uses more:

$out = Bio::SeqIO- > new (- file = > "> D:/share/scripts/subseq1.fa",-format = > 'Fasta'); my$subseqObj= $seqobj- > trunc (5d10); my$subseq=$seqobj- > subseq (5d10); print $subseqObj. "\ n"; print $subseq. "\ n"; $out- > write_seq ($subseqObj); my$revcom= $seqobj- > revcom; # sequence reverse complementary print $revcom. "\ n"; print $subseqObj. "\ n"; print $seqobj. "\ n" DNA sequence is translated into protein sequence:

# Parameter 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); print Dumper ($translate0). "\ n"; print Dumper ($translate1). "\ n"; print Dumper ($translate2). "\ n"; that's all for bioperl's how to deal with fasta and fastq sequences. Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report