-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStop_codons_of_+1_frames.pl
More file actions
77 lines (42 loc) · 1.57 KB
/
Stop_codons_of_+1_frames.pl
File metadata and controls
77 lines (42 loc) · 1.57 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
#!/usr/bin/perl -w
open(SEQFILE, "ScORFs.txt")||die "opening file $!";
@ORFarray = <SEQFILE>;
close (SEQFILE);
#this segment of code reads each line of the file, defining ORFs details, into an array
@NEWDATA=();
open (RESULTS, ">>results_file.txt") ||die "cannot open results.txt: $!";
@NEWDATA = <RESULTS>;
push (@NEWDATA, "Normal Stopcodons in ORFs\n");
for($index=0; $index<@ORFarray; $index++){
$gene = $ORFarray [$index];
#this 'for' loop takes each line of sequence details in turn out of the array ready for processing
$findtext = index ($gene, ">" , 0);
# finds out where the letter Y is, defining the beginning of the Scer yeast name
$scername= substr ($gene,$findtext,8);
# extracts the Scer gene name
$ATGregion = index ($gene, "ATG", 0);
$ORFseq = substr ($gene, $ATGregion+1);
$genelen = length ($ORFseq) -2;
#measures length of gene sequence
print "$scername \t $genelen \n";
my $len = 3;
$gene = $ORFseq;
for (my $ORFcod = 1; $ORFcod <= length $ORFseq; $ORFcod += ($len)) {
$stopsite1 = "TAA";
$stopsite2 = "TAG";
$stopsite3 = "TGA";
$codon = substr ($ORFseq, $ORFcod - 1, $len);
if ($codon eq $stopsite1 ){
push (@NEWDATA,"$codon\t");
}
elsif ($codon eq $stopsite2 ){
push (@NEWDATA,"$codon\t");
}
elsif ($codon eq $stopsite3 ){
push (@NEWDATA,"$codon\t");
}
}
}
print RESULTS @NEWDATA;
print scalar(@NEWDATA)-1;
close(RESULTS);