#!/usr/local/bin/perl -w # Verify that a list of marker indicies is really a clique. # # Copyright (C) 1995, 1996 Humberto Ortiz Zuazaga and Rosemarie Plaetke. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # See the file licence.html for a copy of the GNU GPL use strict; use English; my $minbrk = 3; $minbrk = $ARGV[2] if $ARGV[2]; print "Verifying that all markers have at least $minbrk breaks.\n"; my @chrom = readchrom($ARGV[0]); my @map = readmap($ARGV[1]); my ($i, $j); my $breaks; my $chromosome; my ($first, $second); for $i (0..$#map) { for $j ($i+1..$#map) { $breaks = 0; foreach $chromosome (@chrom) { $first = substr($chromosome, $map[$i] - 1, 1); $second = substr($chromosome, $map[$j] - 1, 1); if (($first ne $second) and ($first ne 'U') and ($second ne 'U')) { $breaks++; } } if ($breaks < $minbrk) { print "Marker $map[$i] has only $breaks breaks with marker $map[$j].\n"; } } } ### sub readchrom { my ($filename) = @ARG; my ($markers, $chromosomes); my @chrom; my $line; open(CHROM, $filename) or die "readchrom: can't open $filename"; $markers = ; chomp $markers; print "Markers = $markers\n"; for $i (1 .. $markers) { ; } $chromosomes = ; chomp $chromosomes; print "Chromosomes = $chromosomes\n"; for $i (0 .. $chromosomes - 1) { $chrom[$i] = ; chomp $chrom[$i]; } close CHROM; return @chrom; } ### sub readmap { my ($file) = @ARG; my $line; my @map; open(MAP, $file) or die "readmap: can't open $file"; while ($line = ) { push @map, split ' ',$line; } return @map; }