Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: duplicates getting omitted while comparing values inside foreach.

by ambrus (Abbot)
on Apr 16, 2009 at 08:51 UTC ( [id://757900]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    perl -we 'open $_, "<", shift or die for my($D, $Q); my $p = -1e9999; 
    +my $s = -1e9999; my $x; while (my $q = <$Q>) { chomp($q); my $k = (sp
    +lit " ", $q)[1]; $p <= $k or die "query not sorted"; $p = $k; while (
    +$s < $p and defined(my $d = <$D>)) { (my($l), $x) = (split " ", $d)[2
    +,0]; $s <= $l or die "db not sorted"; $s = $l; } my $z = $p == $s ? $
    +x : "-"; print $q, "    ", $z, "\n"; }' file1.db file2.query
    
  2. or download this
    1190    31277    A > T    1    0    0    -
    1190    31607    C > A    0    3    1    -
    ...
    1190    32199    C > T    0    1    1    -
    1190    32487    T > C    0    1    1    -
    1190    32496    A > G    0    3    0    -
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://757900]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-03-29 15:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found