Perl intercepts FASTQ files

Source: Internet
Author: User

#!/usr/bin/perl-w Usewarnings; UseStrict;my $usage= qq{$0INPUT_FASTQ trim_length}; die "$usage \ n" if scalar @ARGV!=2;my($FASTQ,$trim _length) =@ARGV;Open(FASTQ,$FASTQ) or die "Can ' t open $FASTQ \ n"; while(my $readid= <FASTQ>) {        Chomp $readid; Chomp(my $sequence= <FASTQ>); Chomp(my $comment= <FASTQ>); Chomp(my $quality= <FASTQ>); my $sub _seq=length $sequence<$trim _length?$sequence:substr $sequence,0,$trim _length; my $sub _quality=length $sequence<$trim _length?$quality:substr $quality,0,$trim _length; Printqq{$readid\ n$sub _seq\ n$comment\ n$sub _quality\n};}CloseFASTQ;

FASTQ files Each 4 lines represent a sequence, using a loop that reads 4 rows at a time, and then processes;

When the end of the file is read, the $readid is empty, the loop terminates,

The basic idea is to see defuse (detection of fusion gene tools) source code to see, there is a trim_fastq.pl script, their own slightly modified under;

Used to be Python, the new company is Perl, fortunately, scripting language, it is easier to understand.

Perl intercepts FASTQ files

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.