#!/usr/bin/perl -w srand(time() ^($$ + ($$ <<15))) ; my $false=0; my $true=1; my $dummy; ########### store GO hierarchy open(FILE,'gene_ontology.obo'); my @go = ; close FILE; my $pos = 0; #which line of obo file my %h = (); #hash of id to term index my %h2 = (); #hash of alt_id to good id my $atstart = $false; #at first go term in obo file my @line; #array that holds the current line of file while(!$atstart){ @line = split(/\s+/, $go[$pos]); if(defined($line[0])){ #only for debugging print "$line[0]\n"; } if((defined($line[0]))&&(($line[0])eq("[Term]"))){ $atstart = $true; }#if $pos++; #will put pos past line that reads "[Term]" }#while my $term = 0; #index into associated arrays my @id; #GO id of term my @numparents; #needed? my @parent; #2-D array, numterms by numparents[numterms] (2nd D is variable) my $atend = $false; #at end of obo file my $atparent; my $obsolete; my $maxnumparents = -1; @line = split(/\s+/, $go[$pos]); # get teh first line while(!$atend){ #end of obo file #@line = split(/\s+/, $go[$pos]); #now at end of while loop and one above $id[$term] = substr($line[1],3,7); #will overwrite this if obsolete # id[0] here fist if(($id[$term]==4)||($id[$term]==5554)||($id[$term]==8372)){ #unknowns my $atnext = $false; while(!$atnext){ $pos++; @line = split(/\s+/, $go[$pos]); if((defined($line[0]))&&(($line[0])eq("id:"))){ $atnext = $true; }#if }#while }#if - did not increment term because not including unknowns elsif(($id[$term]==3674)||($id[$term]==5575)||($id[$term]==8150)){ #three "sub-roots" print "inside elsif - 3 subroots\n"; print "id[term] = $id[$term]\n"; $numparents[$term]=1; $parent[$term][0]='0003673'; #root node, ie Gene_Ontology my $atnext = $false; while(!$atnext){ $pos++; @line = split(/\s+/, $go[$pos]); if((defined($line[0]))&&(($line[0])eq("id:"))){ $atnext = $true; }#if }#while $h{$id[$term]} = $term; #divide by 1 to make integer $term++; #here you do want to include these terms, include 3 big roots }#elsif elsif($id[$term]==3673){#root node, ie Gene_Ontology print "term = $term\n"; print "id[term] = $id[$term]\n"; $numparents[$term]=0; print "numparents[term] = $numparents[$term]\n"; my $atnext = $false; while(!$atnext){ $pos++; @line = split(/\s+/, $go[$pos]); if((defined($line[0]))&&(($line[0])eq("id:"))){ $atnext = $true; }#if }#while $h{$id[$term]} = $term; #divide by 1 to make integer print "just defind h{3673}\n"; print "h{id[term]} = $h{$id[$term]}\n"; $term++; #here you do want to include these terms }#elsif else{ #print "term = $term, id[term] = $id[$term]\n"; $atparent = $false; $obsolete = $false; #$altidind = 0; while(!$atparent&&!$obsolete){ $pos++; @line = split(/\s+/, $go[$pos]); if(($line[0])eq("is_obsolete:")){ $obsolete = $true; }#if elsif((($line[0])eq("is_a:"))||(($line[0])eq("relationship:"))){ $atparent = $true; }#elsif((($line[0]...))) elsif(($line[0])eq("alt_id:")){ $altid = substr($line[1],3,7); $h2{$altid} = $id[$term]; #$altid[$term][$altidind]=substr($line[1],3,7); #print "id[term] = $id[$term]\n"; #print "altid[$term][$altidind] = $altid[$term][$altidind]\n"; #print "hit enter\n"; #my $dummy = ; #$altidind++; }#elsif }#while(!$atparent&&!$obsolete) if($obsolete){ $pos = $pos+3; #3 lines until next id - skip obsolete one -- why????? }#if($obsolete) - don't increment term - not including obsoletes (except root) else{ #here atparent must be true - OK my $ident; my $parindex = 0; while(defined($line[0])){ if(($line[0])eq("is_a:")){ $ident = $line[1]; #now need to take away "GO:" }#if elsif(($line[0])eq("relationship:")){ #assume this means part_of $ident = $line[2]; #print "in elsif\n"; #print "term = $term\n"; #print "id[term] = $id[$term]\n"; #print "ident = $ident\n"; #print "\n"; #my $dummy = ; }#else if if((($line[0])eq("is_a:"))||(($line[0])eq("relationship:"))){ #may be related synonym below parents $ident = substr($ident,3,7); $parent[$term][$parindex] = $ident; $parindex++; }#if $pos++; @line = split(/\s+/, $go[$pos]); }#while(defined...)) $pos = $pos + 2; $numparents[$term] = $parindex; #added one at end, but started at 0 if($parindex>$maxnumparents){ $maxnumparents=$parindex; }#if }#else @line = split(/\s+/, $go[$pos]); if(($line[1])eq("part_of")){ #true at end - if update file, check $atend = $true; #to check - change }#if elsif(!$obsolete){ #don't increment index if obsolete $h{$id[$term]} = $term; #divide by 1 to make integer $term++; }#elsif }#else - not unknown, root, or one of root's children }#while(!$atend) print "ontology.obo read successfully \n"; my $numterms = $term+1; #now define child array for use with negative annotations my @numchildren; for($i=0; $i<(scalar @id); $i++){ $numchildren[$i] = 0; }#for i for($i=0; $i<(scalar @id); $i++){ #could have used $numterms here for($j=0; $j<$numparents[$i]; $j++){ $parindex = $h{$parent[$i][$j]}; $child[$parindex][$numchildren[$parindex]] = $id[$i]; $numchildren[$parindex] = $numchildren[$parindex] + 1; }#for j }#for i ################################################### ################################################### ################################################### ################################################### open(FILE,'inter_fly_yeast.txt'); #file that contains GO annotations fly and yeast together. my @sgd = ; #inter close FILE; my @seqnames; my %hash = (); my $gene = 0; #index into array of genes my @geneid; #array of gene id's, as named in SGD #my @sgdann; #2-d array, 1st dim is index into array of genes, 2nd index is annotation of that gene open(ANN,">$ARGV[0]"); for($i=0; $i<(scalar @sgd); $i++){ @line = split(/\s+/, $sgd[$i]); $seqnames[$i] = $line[0]; $hash{$seqnames[$i]} = $i; print ANN "$line[0] "; for($j=1;$j<(scalar @line);$j++){ if(($line[$j])eq("NOT")){ $j++; $goid=$line[$j]; if((($goid)ne("0000004"))&&(($goid)ne("0005554"))&&(($goid)ne("0008372"))){ print ANN " NOT $goid"; writedescendants($goid); } } #if not one of the 3 unknowns else{ $goid=$line[$j]; if((($goid)ne("0000004"))&&(($goid)ne("0005554"))&&(($goid)ne("0008372"))){ print ANN " $goid"; writeancestors($goid); }#if not one of the 3 unknowns }#end else }#end for line print ANN "\n"; }#end fo sgd close(ANN); print "done with first GO reading\n"; open(FILE,'inter_fly_yeast.txt'); my @inter = ; close(FILE); my $numprots = scalar @inter; my %hprot; #hash protein name to index into protname array my @protname; #array of protein names that are in intersection of GRID and SGD, from inter.txt for($i=0; $i<$numprots; $i++){ @line = split(/\s+/, $inter[$i]); $protname[$i] = $line[0]; $hprot{$protname[$i]} = $i; print "protname[$i] = $protname[$i]\n"; }#for i ################################################################# ################################################################# new stuff about the similarity edges =skip ####################I provided the file -- to speed up the execution open(SIMNEW,">similarity_fly_yeast_numb.txt"); #homologoud protein pairs (array indexes) open(SIM,"similarity_fly_yeast.txt"); # homologous protein pairs (names) my @lines = ; my $numlines = scalar @lines; close(SIM); for($i = 0; $i < $numlines; $i++){ @line = split(/\s+/, $lines[$i]); if(defined($hprot{$line[0]}) && defined($hprot{$line[1]}) ){ #if in inter_fly_yeast.txt print SIMNEW "$hprot{$line[0]} $hprot{$line[1]} $line[2]\n"; # this will create a new similarity file with numbers instead of names } } close(SIM); close(SIMNEW); =cut ################################################################# ################################################################# ################################################################ ################################################################ open(ANN,"$ARGV[0]"); my @annotarr = ; my $numanngenes = scalar @annotarr; #number of genes in annotations.txt, may not all be annotated close(ANN); my @randnum; my $randnumind = 0; open(FILE,">$ARGV[1]"); for($i = 0; $i < $numanngenes; $i++){ @line = split(/\s+/, $annotarr[$i]); for($j=1; $j<(scalar @line);$j++){ if(($line[$j])ne("NOT")){ if(($line[$j]==3676)||($line[$j]==3677)||($line[$j]==43565)||($line[$j]==3700)||($line[$j]==8327) ||($line[$j]==3688)||($line[$j]==19237)||($line[$j]==3705)){ if(defined($hprot{$line[0]})){ #if in inter_fly_yeast.txt $randnum[$randnumind] = $hprot{$line[0]}; print FILE "$randnum[$randnumind] $line[0]\n"; $randnumind++; last; }#if }#if }#if not "NOT" }#for j }#for i close(FILE); $chk = scalar @randnum; print "size of randnum is $chk\n"; ################ ################## ################## ## TYTA! open(ANN,">annotationsrand3.txt"); my $vad; for($i=0; $i<$numanngenes; $i++){ @line = split(/\s+/, $annotarr[$i]); #from annotations.txt print ANN "$line[0]"; for($j=1;$j<(scalar @line);$j++){ $vad=0; if(($line[$j])ne("NOT")){ if(($line[$j]==3676)||($line[$j]==3677)||($line[$j]==43565)||($line[$j]==3700)||($line[$j]==8327) ||($line[$j]==3688)||($line[$j]==19237)||($line[$j]==3705)){ if((defined($line[$j-1]))&&(($line[$j-1])eq("NOT"))){ print ANN " NOT $line[$j]"; }#if else{ print ANN " $line[$j]"; ################################################ define negatives if($line[$j]==8327){ print ANN " NOT 3688"; print ANN " NOT 19237"; } if($line[$j]==3688){ print ANN " NOT 8327"; print ANN " NOT 19237"; } if($line[$j]==19237){ print ANN " NOT 3688"; print ANN " NOT 8327"; } if($line[$j]==43565){ print ANN " NOT 3700"; print ANN " NOT 3705"; } if($line[$j]==3700){ print ANN " NOT 43565"; print ANN " NOT 8327"; print ANN " NOT 3688"; print ANN " NOT 19237"; } ################################################ }#else }#if }#if not "NOT" }#for j print ANN "\n"; }#for i close(ANN); open(ANN,"; close(ANN); my @tonya; my @negatives; my $a=0; my $flag=0; ## eliminate duplicates, if exist open(ANN,">$ARGV[2]"); for($i = 0; $i<$numanngenes; $i++){ $flag=0; for($l=0; $l<10; $l++){ $tonya[$l]=0; } @line = split(/\s+/, $annotarr2[$i]); if(defined($hprot{$line[0]})){ #if in intersection of GRID and SGD my $protid = $hprot{$line[0]}; print ANN "$protid"; my $fl; $fl=0; my $numtermsthisline = (scalar @line)-1; for($j=1; $j<=$numtermsthisline; $j++){ if(($line[$j])eq("NOT")){ $fl=1; if($flag==0){ $negatives[$a]=$protid; $flag=1; $a++; } } elsif($line[$j]==3676 && $tonya[0]!=1){ if($fl==1){ print ANN " NOT"; $fl=0; } $tonya[0]=1; print ANN " 0"; } elsif($line[$j]==3677 && $tonya[1]!=1){ if($fl==1){ print ANN " NOT"; $fl=0; } print ANN " 1"; $tonya[1]=1; } elsif($line[$j]==43565 && $tonya[2]!=1){ if($fl==1){ print ANN " NOT"; $fl=0; } print ANN " 2"; $tonya[2]=1; } elsif($line[$j]==3700 && $tonya[3]!=1){ if($fl==1){ print ANN " NOT"; $fl=0; } print ANN " 3"; $tonya[3]=1; } elsif($line[$j]==8327 && $tonya[4]!=1){ if($fl==1){ print ANN " NOT"; $fl=0; } print ANN " 4"; $tonya[4]=1; } elsif($line[$j]==3688 && $tonya[5]!=1){ if($fl==1){ print ANN " NOT"; $fl=0; } print ANN " 5"; $tonya[5]=1; } elsif($line[$j]==19237 && $tonya[6]!=1){ if($fl==1){ print ANN " NOT"; $fl=0; } print ANN " 6"; $tonya[6]=1; } elsif($line[$j]==3705 && $tonya[7]!=1){ if($fl==1){ print ANN " NOT"; $fl=0; } print ANN " 7"; $tonya[7]=1; } elsif ($fl==1){ $fl=0; } }#for j print ANN "\n"; }#if }#for i close(ANN); ##without duplicated now ############################################ new ################################### $hasint = $false; open(ANN,"<$ARGV[2]"); my @thisann = ; close(ANN); open(MEME,">$ARGV[3]"); for($i=0; $i<(scalar @thisann); $i++){ @line = split(/\s+/,$thisann[$i]); if((scalar @line)>1){ print MEME "@line\n"; }#if }#for i close(MEME); open(MEME,"<$ARGV[3]"); @thisann = ; open(ANN,">$ARGV[4]"); open(CHECK,">$ARGV[5]"); open(MYMY,">$ARGV[6]"); my $count=0; my $count2=0; my @random; my $number; my $index; ######## eliminate 20% of annotated proteins -- separately negatives and positives. ###negatives from Fly and Yeast network, separately for($i=0; $i<$a*0.2*0.54; $i++){ $number=(rand()*100000)%($a*0.54); $index=$negatives[$number]; $random[$index]=1; } for($i=0; $i<$a*0.2*0.46; $i++){ $number=(rand()*100000)%($a*0.46); $index=$negatives[$a*0.54+$number]; $random[$index]=1; } for($i=0; $i<(scalar @thisann)*0.2*0.7-$a*0.2; $i++){ $number=(rand()*100000)%((scalar @thisann)*0.7); $random[$number]=1; } for($i=0; $i<(scalar @thisann)*0.2*0.3-$a*0.2; $i++){ $number=(rand()*100000)%((scalar @thisann)*0.3); $random[(scalar @thisann)*0.6+$number]=1; } for($i=0; $i<(scalar @thisann); $i++){ @line = split(/\s+/,$thisann[$i]); if(( $random[$i]==1) || ($random[$line[0]]==1)){ print CHECK "@line\n"; print MYMY "$seqnames[$line[0]] @line\n"; $count++; } else{ print ANN "@line\n"; } }#for i close(MEME); close(ANN); close(CHECK); open(ANN,"<$ARGV[4]"); @thisann = ; #overwriting thisann - leaving only the training set now. @annotarr2 = ; close(ANN); =skip for($i=0; $i<(scalar @thisann); $i++){ @line = split(/\s+/,$thisann[$i]); if((scalar @line)>1){ #print ANN "@line\n"; print MEME "@line\n"; }#if }#for i =cut open(GRIDEDG,"; close(GRIDEDG); $a0 = 1/6; $b0 = 1/6; $c0 = 1/6; $d0 = 1/2; #++ is d, binary order $a1 = 1/6; $b1 = 1/6; $c1 = 1/6; $d1 = 1/2; $a2 = 1/6; $b2 = 1/6; $c2 = 1/6; $d2 = 1/2; $a3 = 1/6; $b3 = 1/6; $c3 = 1/6; $d3 = 1/2; $a4 = 1/6; $b4 = 1/6; $c4 = 1/6; $d4 = 1/2; $a5 = 1/6; $b5 = 1/6; $c5 = 1/6; $d5 = 1/2; $a6 = 1/6; $b6 = 1/6; $c6 = 1/6; $d6 = 1/2; $a7 = 1/6; $b7 = 1/6; $c7 = 1/6; $d7 = 1/2; $a8 = 1/6; $b8 = 1/6; $c8 = 1/6; $d8 = 1/2; $a9 = 1/6; $b9 = 1/6; $c9 = 1/6; $d9 = 1/2; for($i=0; $i<(scalar @gridedg); $i++){ @line = split(/\s+/,$gridedg[$i]); $orf0 = $line[0]; $orf1 = $line[1]; $not00 = $false; $not01 = $false; $not02 = $false; $not03 = $false; $not04 = $false; $not05 = $false; $not06 = $false; $not07 = $false; $not08 = $false; $not09 = $false; $yes00 = $false; $yes01 = $false; $yes02 = $false; $yes03 = $false; $yes04 = $false; $yes05 = $false; $yes06 = $false; $yes07 = $false; $yes08 = $false; $yes09 = $false; $not10 = $false; $not11 = $false; $not12 = $false; $not13 = $false; $not14 = $false; $not15 = $false; $not16 = $false; $not17 = $false; $not18 = $false; $not19 = $false; $yes10 = $false; $yes11 = $false; $yes12 = $false; $yes13 = $false; $yes14 = $false; $yes15 = $false; $yes16 = $false; $yes17 = $false; $yes18 = $false; $yes19 = $false; for($j=0; $j<(scalar @thisann); $j++){ @line2 = split(/\s+/,$thisann[$j]); if($line2[0] == $orf0){ for($k=1; $k<(scalar @line2); $k++){ if(($line2[$k])ne("NOT")){ if($line2[$k]==0 ){ if(($line2[$k-1])eq("NOT")){ $not00 = $true; #$tonya[0]=1; }#if else{ $yes00 = $true; #$tonya[0]=1; }#else }#if 0 if($line2[$k]==1 ){ if(($line2[$k-1])eq("NOT")){ $not01 = $true; #$tonya[1]=1; }#if else{ $yes01 = $true; #$tonya[1]=1; }#else }#if 1 if($line2[$k]==2 ){ if(($line2[$k-1])eq("NOT")){ $not02 = $true; #$tonya[2]=1; }#if else{ $yes02 = $true; #$tonya[2]=1; }#else }#if 2 if($line2[$k]==3 ){ if(($line2[$k-1])eq("NOT")){ $not03 = $true; #$tonya[3]=1; }#if else{ $yes03 = $true; #$tonya[3]=1; }#else }#if 3 if($line2[$k]==4 ){ if(($line2[$k-1])eq("NOT")){ $not04 = $true; #$tonya[4]=1; }#if else{ $yes04 = $true; #$tonya[4]=1; }#else }#if 4 if($line2[$k]==5){ if(($line2[$k-1])eq("NOT")){ $not05 = $true; }#if else{ $yes05 = $true; }#else }#if 5 if($line2[$k]==6){ if(($line2[$k-1])eq("NOT")){ $not06 = $true; }#if else{ $yes06 = $true; }#else }#if 6 if($line2[$k]==7){ if(($line2[$k-1])eq("NOT")){ $not07 = $true; }#if else{ $yes07 = $true; }#else }#if 7 if($line2[$k]==8){ if(($line2[$k-1])eq("NOT")){ $not08 = $true; }#if else{ $yes08 = $true; }#else }#if 8 if($line2[$k]==9){ if(($line2[$k-1])eq("NOT")){ $not09 = $true; }#if else{ $yes09 = $true; }#else }#if 9 }#if not "NOT" }#for k }#if if($line2[0] == $orf1){ for($k=1; $k<(scalar @line2); $k++){ if(($line2[$k])ne("NOT")){ #just to stop perl from complaining if($line2[$k]==0){ if(($line2[$k-1])eq("NOT")){ $not10 = $true; }#if else{ $yes10 = $true; }#else }#if 0 if($line2[$k]==1){ if(($line2[$k-1])eq("NOT")){ $not11 = $true; }#if else{ $yes11 = $true; }#else }#if 1 if($line2[$k]==2){ if(($line2[$k-1])eq("NOT")){ $not12 = $true; }#if else{ $yes12 = $true; }#else }#if 2 if($line2[$k]==3){ if(($line2[$k-1])eq("NOT")){ $not13 = $true; }#if else{ $yes13 = $true; }#else }#if 3 if($line2[$k]==4){ if(($line2[$k-1])eq("NOT")){ $not14 = $true; }#if else{ $yes14 = $true; }#else }#if 4 if($line2[$k]==5){ if(($line2[$k-1])eq("NOT")){ $not15 = $true; }#if else{ $yes15 = $true; }#else }#if 5 if($line2[$k]==6){ if(($line2[$k-1])eq("NOT")){ $not16 = $true; }#if else{ $yes16 = $true; }#else }#if 6 if($line2[$k]==7){ if(($line2[$k-1])eq("NOT")){ $not17 = $true; }#if else{ $yes17 = $true; }#else }#if 7 if($line2[$k]==8){ if(($line2[$k-1])eq("NOT")){ $not18 = $true; }#if else{ $yes18 = $true; }#else }#if 8 if($line2[$k]==9){ if(($line2[$k-1])eq("NOT")){ $not19 = $true; }#if else{ $yes19 = $true; }#else }#if 9 }#if not "NOT" }#for k }#if }#for j if($not00&&$not10){ $hasint = $true; $a0 = $a0 + 1; } if($not01&&$not11){ $hasint = $true; $a1 = $a1 + 1; } if($not02&&$not12){ $hasint = $true; $a2 = $a2 + 1; } if($not03&&$not13){ $hasint = $true; $a3 = $a3 + 1; } if($not04&&$not14){ $hasint = $true; $a4 = $a4 + 1; } if($not05&&$not15){ $hasint = $true; $a5 = $a5 + 1; } if($not06&&$not16){ $hasint = $true; $a6 = $a6 + 1; } if($not07&&$not17){ $hasint = $true; $a7 = $a7 + 1; } if($not08&&$not18){ $hasint = $true; $a8 = $a8 + 1; } if($not09&&$not19){ $hasint = $true; $a9 = $a9 + 1; } if($not00&&$yes10){ $hasint = $true; $b0 = $b0 + 1; } if($not01&&$yes11){ $hasint = $true; $b1 = $b1 + 1; } if($not02&&$yes12){ $hasint = $true; $b2 = $b2 + 1; } if($not03&&$yes13){ $hasint = $true; $b3 = $b3 + 1; } if($not04&&$yes14){ $hasint = $true; $b4 = $b4 + 1; } if($not05&&$yes15){ $hasint = $true; $b5 = $b5 + 1; } if($not06&&$yes16){ $hasint = $true; $b6 = $b6 + 1; } if($not07&&$yes17){ $hasint = $true; $b7 = $b7 + 1; } if($not08&&$yes18){ $hasint = $true; $b8 = $b8 + 1; } if($not09&&$yes19){ $hasint = $true; $b9 = $b9 + 1; } if($yes00&&$not10){ $hasint = $true; $c0 = $c0 + 1; } if($yes01&&$not11){ $hasint = $true; $c1 = $c1 + 1; } if($yes02&&$not12){ $hasint = $true; $c2 = $c2 + 1; } if($yes03&&$not13){ $hasint = $true; $c3 = $c3 + 1; } if($yes04&&$not14){ $hasint = $true; $c4 = $c4 + 1; } if($yes05&&$not15){ $hasint = $true; $c5 = $c5 + 1; } if($yes06&&$not16){ $hasint = $true; $c6 = $c6 + 1; } if($yes07&&$not17){ $hasint = $true; $c7 = $c7 + 1; } if($yes08&&$not18){ $hasint = $true; $c8 = $c8 + 1; } if($yes09&&$not19){ $hasint = $true; $c9 = $c9 + 1; } if($yes00&&$yes10){ $hasint = $true; $d0 = $d0 + 1; } if($yes01&&$yes11){ $hasint = $true; $d1 = $d1 + 1; } if($yes02&&$yes12){ $hasint = $true; $d2 = $d2 + 1; } if($yes03&&$yes13){ $hasint = $true; $d3 = $d3 + 1; } if($yes04&&$yes14){ $hasint = $true; $d4 = $d4 + 1; } if($yes05&&$yes15){ $hasint = $true; $d5 = $d5 + 1; } if($yes06&&$yes16){ $hasint = $true; $d6 = $d6 + 1; } if($yes07&&$yes17){ $hasint = $true; $d7 = $d7 + 1; } if($yes08&&$yes18){ $hasint = $true; $d8 = $d8 + 1; } if($yes09&&$yes19){ $hasint = $true; $d9 = $d9 + 1; } }#for i open(OUT,">$ARGV[7]"); $p00 = $a0/($a0+$b0+$c0+$d0); #first 0 is term, 2nd represents -- $p01 = $b0/($a0+$b0+$c0+$d0); $p02 = $c0/($a0+$b0+$c0+$d0); $p03 = $d0/($a0+$b0+$c0+$d0); $p10 = $a1/($a1+$b1+$c1+$d1); #first ind is term, 2nd represents -- $p11 = $b1/($a1+$b1+$c1+$d1); $p12 = $c1/($a1+$b1+$c1+$d1); $p13 = $d1/($a1+$b1+$c1+$d1); $p20 = $a2/($a2+$b2+$c2+$d2); #first ind is term, 2nd represents -- $p21 = $b2/($a2+$b2+$c2+$d2); $p22 = $c2/($a2+$b2+$c2+$d2); $p23 = $d2/($a2+$b2+$c2+$d2); $p30 = $a3/($a3+$b3+$c3+$d3); #first ind is term, 2nd represents -- $p31 = $b3/($a3+$b3+$c3+$d3); $p32 = $c3/($a3+$b3+$c3+$d3); $p33 = $d3/($a3+$b3+$c3+$d3); $p40 = $a4/($a4+$b4+$c4+$d4); #first ind is term, 2nd represents -- $p41 = $b4/($a4+$b4+$c4+$d4); $p42 = $c4/($a4+$b4+$c4+$d4); $p43 = $d4/($a4+$b4+$c4+$d4); $p50 = $a5/($a5+$b5+$c5+$d5); #first 0 is term, 2nd represents -- $p51 = $b5/($a5+$b5+$c5+$d5); $p52 = $c5/($a5+$b5+$c5+$d5); $p53 = $d5/($a5+$b5+$c5+$d5); $p60 = $a6/($a6+$b6+$c6+$d6); #first ind is term, 2nd represents -- $p61 = $b6/($a6+$b6+$c6+$d6); $p62 = $c6/($a6+$b6+$c6+$d6); $p63 = $d6/($a6+$b6+$c6+$d6); $p70 = $a7/($a7+$b7+$c7+$d7); #first ind is term, 2nd represents -- $p71 = $b7/($a7+$b7+$c7+$d7); $p72 = $c7/($a7+$b7+$c7+$d7); $p73 = $d7/($a7+$b7+$c7+$d7); $p80 = $a8/($a8+$b8+$c8+$d8); #first ind is term, 2nd represents -- $p81 = $b8/($a8+$b8+$c8+$d8); $p82 = $c8/($a8+$b8+$c8+$d8); $p83 = $d8/($a8+$b8+$c8+$d8); $p90 = $a9/($a9+$b9+$c9+$d9); #first ind is term, 2nd represents -- $p91 = $b9/($a9+$b9+$c9+$d9); $p92 = $c9/($a9+$b9+$c9+$d9); $p93 = $d9/($a9+$b9+$c9+$d9); print "$a0 $b0 $c0 $d0\n"; print "$a1 $b1 $c1 $d1\n"; print "$a2 $b2 $c2 $d2\n"; print "$a3 $b3 $c3 $d3\n"; print "$a4 $b4 $c4 $d4\n"; print "$a5 $b5 $c5 $d5\n"; print "$a6 $b6 $c6 $d6\n"; print "$a7 $b7 $c7 $d7\n"; print OUT "0 $p00 $p01 $p02 $p03\n"; print OUT "1 $p10 $p11 $p12 $p13\n"; print OUT "2 $p20 $p21 $p22 $p23\n"; print OUT "3 $p30 $p31 $p32 $p33\n"; print OUT "4 $p40 $p41 $p42 $p43\n"; print OUT "5 $p50 $p51 $p52 $p53\n"; print OUT "6 $p60 $p61 $p62 $p63\n"; print OUT "7 $p70 $p71 $p72 $p73\n"; close(OUT); #################################################################################### ####################################################################################################### #subroutines sub writeancestors{ #print "writeancestors, arg = $_[0]\n"; my $indx; $indx = $h{$_[0]}; if(!defined($indx)){ # print "!defined(indx)\n"; # print "term = $_[0]\n"; # print "hit enter"; # my $dummy = ; }#if if(!defined($numparents[$indx])){ # print "!defined(numparents[indx])\n"; # print "indx = $indx\n"; # print "term = $_[0]\n"; }#if for $index2 (0 .. ($numparents[$indx]-1)){ print ANN " $parent[$indx][$index2]"; #parents should all be good id's, not alt_id's writeancestors($parent[$indx][$index2]); }#for index2 }#writeancestors sub writedescendants{ my $indx; $indx = $h{$_[0]}; if(!defined($indx)){ # print "!defined(indx)\n"; # print "term = $_[0]\n"; #print "hit enter"; #my $dummy = ; }#if if(!defined($numchildren[$indx])){ # print "!defined(numchildren[indx])\n"; # print "indx = $indx\n"; # print "term = $_[0]\n"; # print "hit enter\n"; # my $dummy = ; }#if for $index2 (0 .. ($numchildren[$indx]-1)){ print ANN " NOT $child[$indx][$index2]"; #parents should all be good id's, not alt_id's writedescendants($child[$indx][$index2]); }#for index2 }#writedescendants exit;