find_SNPs1.pl

Invoke using:

http://cougar:8080/tigr-scripts/projects/find_SNPs1.pl?file=TB.mum.out



#!/usr/bin/perl use strict; use CGI qw/:standard/; print header; my $file = param('file'); print "<HTML>\n"; print "<h2>Parsing the contents of this file: $file</H2>\n"; use strict; my $insert_size = 1; my (@list); open(F_IN, $file) || print "was not able to open file\n"; while(<F_IN>) { if (!/>/) { s/^\s*//; my($x1, $x2, $l) = split(/\s+/); push(@list, $x1 . " " . $x2 . " " . $l); } } close(F_IN); @list = sort numerically (@list); my $first_time = 1; my $old_pos; my @list2; my $count_snps = 0; foreach my $row (@list) { my ($x1, $x2, $l) = split(/\s/,$row); if ($first_time != 1) { if (($x1 - $old_pos) == $insert_size) { $count_snps++; push(@list2, $old_pos); } } $first_time = 0; $old_pos = $x1 + $l; } print "SNP Count: $count_snps\n"; print "<TABLE BORDER = 1>\n"; print "<TR><TH>Position</TH></TR>\n"; foreach my $p (@list2) { print "<TR><TD>$p</TD></TR>\n"; } print "</TABLE>\n"; sub numerically { $a <=> $b; }

Finding if SNPs are in coding regions

Was done in this program.
left right