#!/usr/bin/perl
########################################################################
## selectpg.cgi ##
## by Deyou Zheng 03/30/2005 ##
## format of a flatfile db into html file ##
########################################################################
use CGI;
use strict;
my $db = "chr22pgExp.txt"; #this is the flatfile db
my $query = new CGI;
my @key1 = $query->param("column");
my @key2 = $query->param("ExpEvidence");
my $key3 = $query->param("features");
open (DB, "$db") or die "$db not found $!\n";
my @tableheader = ();
while () {
@tableheader = split;
last;
}
print $query->header();
#print $query->start_html("List of chr22 pseudogenes");
print<List of chr22 pseudogenes
Create your own list of pseudogenes
Each of the chromosome 22 pseudogenes is associated with 40 or so features, based on sequence analysis, conservation in related organisms, expression evidence and the presence of upstream regulatory sites. Here, we select some of these features and create a table interactively according to your investigation interest. These features include pseudogene preservation in mouse/rat/chimp, expression evidence derived from EST, PCR tiling array (Rinn, 1 or 0) and transcriptional factor binding site (0 -- absent). Transcription data of high resolution oligonucleotide tiling array are from the NASA array (nasa, 0 -- not detected) and the Affymetrix array (11 cell lines -- A375 to U87, a value of <0.05 means transcriptional activity is likely in the cell line).
COMMON2
my @ids; ##contain field index to create table
print "
\n";
print "
";
for (my $i=0; $i < @tableheader; $i++) {
my $take_it = 0;
foreach my $k (@key1) { ##@key1 contains the fields to create table
if ($k eq $tableheader[$i]) {
$take_it = 1;
last;
}
}
if ($take_it) {
push @ids, $i; ##save the field index
print "
$tableheader[$i]
";
}
}
print "
\n";
while () {
next if (/^$/);
my @fields = split;
my $skip = 0;
if ($key3) {
for my $i (4,5,6,9) {
if ($fields[$i] < 0.5 && $key3 eq $tableheader[$i]) {
$skip = 1;
}
}
next if ($skip); ##skip if a pg doesn't meet a feature
}
if (@key2) {
for (my $i=1; $i < @tableheader; $i++) {
for (my $j=0; $j < @key2; $j++) {
if ($key2[$j] eq $tableheader[$i] ) {
if ($i == 10 && $fields[$i] ne "NA") {
$skip = 0;
} elsif ( $i<23 && $fields[$i] <1 || $i >22 && $fields[$i] > 0.05 ) {
$skip = 1;
}
}
}
}
next if ($skip); ##skip if a pg doesn't meet a feature
}
print "