I opened the two files and used while loop (i.e. while within while). The if condition of this prog. is working good, but else condition will give lots of lines, because of while within while.. "last;" is also not working here..
Please help me to solve this
file 1
file 2chr17 69112551 chr7 151046672 chr7 151047369
chr1 66953622 66953654 chr1 67200451 67200472 chr1 67200475 67200478 chr1 67058869 67058880 chr1 67058881 67058885 chr1 67058887 67058895
Perl prog.
#!/usr/bin/perl -w $pwd = `pwd`; chomp($pwd); $file=$ARGV[0]; $file1=$ARGV[1]; open(IN,$file); while ($line=<IN>){ chomp($line); @ary = split(/\t/,$line); chomp($ary[0]);chomp($ary[1]); open(SK,$file1); while($line1=<SK>) { @any = split(/\t/,$line1); chomp($any[0]); chomp($any[0]);chomp($any[1]);chomp($any[2]); if ($ary[0] eq $any[0] and $ary[1] == $any[1]) or ($ary[0] eq $any[0] +and $ary[1] == $any[2]) { print "$line\tE\n"; } else { print "$line\tM\n"; } } }
In reply to compare two files on the basis of Two IDs by genome
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |