-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathfastq_transform.pl
More file actions
executable file
·78 lines (68 loc) · 1.52 KB
/
fastq_transform.pl
File metadata and controls
executable file
·78 lines (68 loc) · 1.52 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/perl -w
use strict;
########################################################################################
#
# in: A letter to be transformed [0], a letter to transformed to [1]
# and fastq file of the reads to be transformed [2]
# out: fastq file with transformed reads
#
########################################################################################
my $fastq_file = $ARGV[2];
my $s_str="";
my $tr_str="";
#print "inputfile $fastq_file\n";
if (($ARGV[0] =~ "[Tt]") and ($ARGV[1] =~ "[Cc]"))
{
$s_str = 'T';
$tr_str = 'C';
}
elsif (($ARGV[0] =~ "[Aa]") and ($ARGV[1] =~ "[Gg]"))
{
$s_str = 'A';
$tr_str = 'G';
}
elsif (($ARGV[0] =~ "[Tt]") and ($ARGV[1] =~ "[Gg]"))
{
$s_str = 'T';
$tr_str = 'G';
}
elsif (($ARGV[0] =~ "[Aa]") and ($ARGV[1] =~ "[Tt]"))
{
$s_str = 'A';
$tr_str = 'T';
}
elsif (($ARGV[0] =~ "[Tt]") and ($ARGV[1] =~ "[Aa]"))
{
$s_str = 'T';
$tr_str = 'A';
}
elsif (($ARGV[0] =~ "[Aa]") and ($ARGV[1] =~ "[Cc]"))
{
$s_str = 'A';
$tr_str = 'C';
}
elsif (($ARGV[0] =~ "[Gg]") and ($ARGV[1] =~ "[Cc]"))
{
$s_str = 'G';
$tr_str = 'C';
}
elsif (($ARGV[0] =~ "[Cc]") and ($ARGV[1] =~ "[Gg]"))
{
$s_str = 'C';
$tr_str = 'G';
}
else
{
print "Illegal letters to transform!\n";
die;
}
open (my $InFile,$fastq_file);
while (<$InFile>)
{
my $IDLine = $_;
my $SeqLine = <$InFile>;
my $BlankLine = <$InFile>;
my $BQLine = <$InFile>;
$SeqLine =~ s/$s_str/$tr_str/g;
print "$IDLine$SeqLine$BlankLine$BQLine";
}