#!/usr/local/bin/perl -w # Example 5: lia_lung.pl # Creating a liability class column in LINKAGE pedigree file. # Case 1: Lung Cancer: Two files are needed, which share the # first 6 columns in common (pedID,personID,father,mother, gender, # affectionstatus). The rest of the first file stores the # marker information, whereas the rest of the second file contains # two columns: age and daily packs of cigarette one consumes # # Ref: Li and Haghighi, "Perl as a tool for linkage analysis", # Am J Hum Genet, suppl,65: A260 (1999) # # Contact: perl@linkage.rockefeller.edu # # Last update: October 17, 1999 # # Usage: lia_lung.pl # [marker file] # [extra phenotype file] # [age threshold] # [# of packs of cig threshold] $usage ="Usage: lia_lung.pl [marker file] [extra phenotype file] [age thre] [cig threshol]"; if($#ARGV != 3 ){ print "$usage\n"; exit; } $marker_file=$ARGV[0]; $pheno_file=$ARGV[1]; $age_thre =$ARGV[2]; $pack_thre =$ARGV[3]; open(MIN,"< $marker_file"); @mdata= grep(/\n/,); close(MIN); open(PIN,"< $pheno_file"); @phdata= grep(/\n/,); close(PIN); if($#mdata != $#phdata){ # check the two files have same num. of lines print "unequal size between $marker_file and $pheno_file\n"; exit; } foreach $i (0..$#mdata){ $mdata[$i] =~ s/^\s+//; $phdata[$i] =~ s/^\s+//; @mline= split(/\s+/,$mdata[$i]); @phline= split(/\s+/,$phdata[$i]); if( $mline[0] == $phline[0] && $mline[1]==$phline[1]){ if($phline[6] < $age_thre){ # age information # daily cigarettes consumption: -1 for no info if($phline[7] <0){ $lia=1; } elsif($phline[7] < $pack_thre){ $lia=2; } else{ $lia=3; } } else{ if($phline[7] <0){ $lia=1; } elsif($phline[7] < $pack_thre){ $lia=4; }else{ $lia=5; } } for($j=0;$j<=4;$j++){ print "$mline[$j] "; } print "$phline[5] "; # affection status print " $lia "; # the liability class determined vt age/cig cons for($j=5; $j<=$#mline;$j++){ print "$mline[$j] "; } print "\n"; } else{ print "$marker_file and $phenoe_file don't match\n"; exit; } }