Created
August 24, 2011 09:46
-
-
Save josephhughes/1167694 to your computer and use it in GitHub Desktop.
Perl script to split a file containing multiple fastq into separate fast files names according to the fast ID
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SplitFastq.pl is a perlscript written by Joseph Hughes, university of Glasgow | |
Usage: | |
perl SplitFastq.pl -in ourmultifastqfile | |
This script will split a file containing multiple fastq into separate fast files names according to the fast ID. | |
The script uses Bioperl. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# | |
# use this to split a file containing multiple fastq sequences | |
use strict; | |
use Bio::SeqIO; | |
use Getopt::Long; | |
my ($file); | |
&GetOptions( | |
'in:s' => \$file,#file with mutliple fastq | |
); | |
my $seq_in = Bio::SeqIO->new(-file => $file, -format=> 'fastq'); | |
while( my $seq = $seq_in->next_seq() ) { | |
my $id=$seq->id(); | |
print "ID: $id\n"; | |
my $outfile=$id.".fastq"; | |
my $seq_out = Bio::SeqIO->new(-file => ">$outfile", | |
-format => 'fastq',); | |
$seq_out->write_seq($seq); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment