In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
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 perl removes ID repeated sequences in fasta or fastq files". The editor shows you the operation process through an actual case. The method of operation is simple, fast and practical. I hope that this article "perl how to remove ID repeated sequences in fasta or fastq files" can help you solve the problem.
The sequence ID in both fastq and fasta files is unique, and if it is not unique, it needs to be repeated for him. There is a script to achieve this function.
Script help:
UsageForced parameter:-fa fasta file-fq fastq file-fq1 fastq read1 file-fq2 fastq read2 file-f input file type, "fa" or "fq" must be given-od output dir must be given-n output filename must be givenOther parameter:-h Help document
Scripts can be imported in either fasta format or fastq format sequence files.
The-fa option is followed by the input fasta file, and the-fq option is followed by the input fastq file. If the fastq sequence is sequenced at both ends,-fq1 is followed by the read1 sequence, and-fq2 followed by the read2 sequence. -n followed by the prefix name of the output file, and-od followed by the output directory.
The script is as follows:
Use Getopt::Long;use strict;use Bio::SeqIO;use Bio::Seq;#get optsmy% opts;GetOptions (\% opts, "fa=s", "fq=s", "fq1=s", "fq2=s", "fades", "od=s", "natives", "h"); if (! defined ($opts {f}) | |! defined ($opts {od}) | |! defined ($opts {n}) | defined ($opts {h}) {print $FQ1,-format= > 'fasta') Open my$ GZ1, "| gzip > $opts {od} / ${n} .fa.gz" or die $!; my$out1 = Bio::SeqIO- > new (- fh = > $GZ1,-format = > 'fasta'); my% id;while (my$ obj1=$fq1- > next_seq ()) {my$ id1=$obj1- > id;if (exists $id {$id1}) {next;} else {$id {$id1} = 1;} $out1- > write_seq ($obj1) } if ($opts {f} eq "fq") {if (defined ($opts {fq})) {my$read1 = $opts {fq}; open my$ FQ1, "zcat $read1 |" or die "$!"; my$fq1=Bio::SeqIO- > new (- fh= > $FQ1,-format= > 'fastq'); open my$ GZ1, "| gzip > $opts {od} / ${n} .fq.gz" or die $!; my$out1 = Bio::SeqIO- > new (- fh= > $GZ1,-format= >' fastq'); my% id While (my$ obj1=$fq1- > next_seq ()) {my$ id1=$obj1- > id;if (exists $id {$id1}) {next;} else {$id {$id1} = 1;} $out1- > write_seq ($obj1);}} elsif (defined ($opts {fq1}) & defined ($opts {fq2})) {my$read1 = $opts {fq1}; my$read2 = $opts {fq2}; open my$ FQ1, "zcat $read1 |" or die $! "; my$fq1=Bio::SeqIO- > new (- fh= > $FQ1,-format= > 'fastq')) Open my$ FQ2, "zcat $read2 |" or die "$!"; my$fq2=Bio::SeqIO- > new (- fh= > $FQ2,-format= > 'fastq'); open my$ GZ1, "| gzip > $opts {od} / ${n} _ R1.fq.gz" or die $!; my$out1 = Bio::SeqIO- > new (- fh= > $GZ1,-format= >' fastq'); open my$ GZ2, "" | gzip > $opts {od} / ${n} _ R2.fq.gz "or die $! My$out2 = Bio::SeqIO- > new (- fh = > $GZ2,-format = > 'fastq'); my% id;while (my$ obj1=$fq1- > next_seq () and my$ obj2=$fq2- > next_seq ()) {my ($id1,$id2) = ($obj1- > id,$obj2- > id); if (exists $id {$id1}) {next;} else {$id {$id1} = 1;} $out1- > write_seq ($obj1); $out2- > write_seq ($obj2) That's all for "how perl removes ID repetitive sequences from fasta or fastq files". 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.