genetist
Novice
Jul 9, 2013, 2:37 AM
Post #1 of 8
(1422 views)

how to compare rows in same file with perl

Can't Post


Hi to all, My data looks like this Code pedigree A B C D E F X X1 / / / C/C A/A / Y Y1 C/C C/C A/A A/A A/A A/A 1 X1/Y1 C/C C/C A/A A/A Z/Z A/A 2 X1/Y1 C/C / A/A A/A A/A A/A 3 X1/Y1 / C/C A/A A/A A/A A/A 4 X1/Y1 Z/Z C/C A/A A/A A/A A/A 5 X1/Y1 C/C C/C A/A A/A A/A A/A 6 X1/Y1 / / / / A/A / 7 X1/Y1 / C/C A/A A/A A/A / 8 X1/Y1 C/C C/C A/A A/A A/A A/A 9 X1/Y1 C/C / A/A A/A A/A A/A 10 X1/Y1 C/C C/C A/A A/A A/A A/A 11 X1/Y1 C/C C/C Z/Z A/A A/A A/A 12 X1/Y1 C/C / A/A A/A A/A A/A 13 X1/Y1 C/C C/C A/A A/A A/A A/A 14 X1/Y1 C/C C/C A/A A/A A/A A/A 15 X1/Y1 C/C C/C Z/Z A/A A/A A/A 16 X1/Y1 C/C C/C A/A A/A A/A A/A First I count total number of different coulmnswithin a pair of X1 and Y1across from cloumn A to B, If data is missing (/) or unscorable (Z) for any one of X1 or Y1 with in a pair of X1Y1 then if condition consider that column is same between X1 and Y1 else that column is different. I tried folowwing code to do that but not succeed, #!/usr/bin/perl open(DATA,"<perl.csv"); for($column = 1 ; $column <= 8 ; $column++) { for($row = 1 ; $row <= 2 ; $row++) { if($row1==$row2) { $result = "EQ"; } else { $result="NQ"; } print $result; } print "\n"; } , I need help in solving this problem, any help would be appreciated thanks in advance :)
