-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfastq2fasta.pl
executable file
·61 lines (44 loc) · 1.32 KB
/
fastq2fasta.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/perl
use strict;
use warnings;
#use Cwd;
##### ##### ##### ##### #####
use Getopt::Std;
use vars qw( $opt_a $opt_c $opt_v);
# Usage
my $usage = "
fastq2fasta.pl - converts fastq files to fasta format.
by
Brian J. Knaus
December 2009
Copyright (c) 2009 Brian J. Knaus.
License is hereby granted for personal, academic, and non-profit use.
Commercial users should contact the author (http://brianknaus.com).
Great effort has been taken to make this software perform its said
task however, this software comes with ABSOLUTELY NO WARRANTY,
not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Usage: perl script.pl options
required:
-a fastq input file.
optional:
-c inset in nucleotides, used to remove barcodes [default = 0].
-v verbose mode [T/F, default is F].
";
##### ##### ##### ##### #####
# Main.
my @temp;
while (<>){
chomp($temp[0] = $_); # First line is an id.
chomp($temp[1] = <>); # Second line is a sequence.
chomp($temp[2] = <>); # Third line is an id.
chomp($temp[3] = <>); # Fourth line is quality.
# Prune first char.
$temp[0] = substr($temp[0], 1);
# Substring to inset value.
$temp[1] = substr($temp[1], 0);
# Print to fasta file.
print STDOUT ">$temp[0]\n";
print STDOUT "$temp[1]\n";
}
##### ##### ##### ##### #####
# EOF.