Fun With GenBank Files


Okay, so this is not a very useful assignment, but it's kind of neat in a way. Try the following Perl script: #!/usr/bin/perl -w print "Available Files:\n"; @files = (); $folder = 'GENBANK'; unless(opendir(FOLDER, $folder)){ print "Cannot open folder\n"; exit; } @files = readdir(FOLDER); closedir(FOLDER); foreach $f (@files){ print "$f\n"; } print "Enter name of file: "; $filename = <STDIN>; chomp $filename; $filename = 'GENBANK/'.$filename; open(FH, $filename); @data = <FH>; close(FH); $inseq = 0; $nuc = ""; foreach my $line (@data){ if($line =~ /^ORIGIN/ ){ $inseq = 1; } elsif($line =~ /\/\// ){ $output = "<html><body bgcolor=white>\n"; $output .= "<h2>Colorful Nucleotides</h2>\n"; @nuc = split('',$nuc); foreach $n (@nuc){ if( $n eq 'c' ){ $output .= "<font color=red>c</font>\n"; } elsif( $n eq 't' ){ $output .= "<font color=green>t</font>\n"; } elsif( $n eq 'a' ){ $output .= "<font color=blue>a</font>\n"; } elsif( $n eq 'g' ){ $output .= "<font color=cyan>g</font>\n"; } } $output .= "</body></html>"; $outputfile = "color_seq.html"; open(CSEQ, ">$outputfile"); print CSEQ "$output"; close(CSEQ); } elsif($inseq == 1){ chomp($line); $nuc .= $line; } }

Assignment:
You get to do the same thing for the \translation section of any GenBank file. You will need to use RGB values to come up with 20 different color values. Otherwise, this is a pretty simple assignment.