#! /usr/local/bin/perl # mapdist.pl: calculates total map length based on poisson # expectation for number of linked loci # Steve DiFazio, 11-2002 use Getopt::Long; GetOptions( "link:f" => \$link); if(!($link)) { $link = 3; } if(!($ARGV[0])) { die " _______________________________________________________________\n Usage: perl mapdist.pl -l= lod_table.txt > out.txt \n where \t- is the lod score cutoff for linkage, \t is the lod table output from mapmaker (with photo \tmode activated)\n ** You can choose unique names for these input and output files ** _______________________________________________________________\n"; } warn "\n"; while (<>) { if((/^\s+[0-9]/) && ($_ !~ />/)) { ($n,@lod) = split(/\s+/); if($n>$maxn) { $maxn = $n; } foreach my $i (0 .. $#lod) { $comps++; if(($lod[$i] ne "-") && ($lod[$i] >= $link)) { $links++; } } } } # Divide total loci by 2 to account for repulsion phase alleles print "Total Loci:\t",$maxn/2,"\n"; print "Comparisons:\t",$comps/4,"\n"; print "Linked Loci:\t$links\n"; print "LOD Cutoff:\t$link\n";