Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: difficulty in matching 2 fields of a same line

by Anonymous Monk
on Jun 27, 2012 at 18:09 UTC ( #978737=note: print w/ replies, xml ) Need Help??


in reply to Re: difficulty in matching 2 fields of a same line
in thread difficulty in matching 2 fields of a same line

example
14975:50417    1:N:0:CGATGT    -    chr11    108607098    GCTAGCTTACAGGTCACCTTGCTTGGTGTGGACAGT    JJIIJJJGGGIJHHHFJJJIJJJHHHHHFFFFFCCC    0    33:A>T,34:G>C    14975:50417    2:N:0:CGATGT    +    chr11    89267281    TCATGAAGTATAAAGTTACAGGGTGGTGATGTGATT    CCCFFFFFBHHHFIJIIIIIIIJAFH<FFHIGIIIJ    0
my code shud not be printing this line because here both fields are equal
but it does because there are sm extra tabs.

how do i tell it to compare only those fields starting with chr?


Comment on Re^2: difficulty in matching 2 fields of a same line
Download Code
Re^3: difficulty in matching 2 fields of a same line
by choroba (Canon) on Jun 27, 2012 at 18:26 UTC
    Let a regex find what you need
    my @cmp = $line[$i] =~ /\tchr([0-9]+)\t/g; if (2 == @cmp and $cmp[0] != $cmp[1]) { print $line[$i]; }

      hey thanks for that u guys are really amazing!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (13)
As of 2015-07-07 16:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (91 votes), past polls