Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^8: Comparing adjacent lines

by aaron_baugher (Curate)
on Jul 16, 2012 at 19:52 UTC ( [id://982074]=note: print w/replies, xml ) Need Help??


in reply to Re^7: Comparing adjacent lines
in thread Comparing adjacent lines

The problem here is that you're getting your $exon variable confused with $gtf[2]. You're using $exon to hold the counter which you increment on matching lines, but then you clobber it by assigning $gtf[2] to it after that, but then you don't use it after that. Also, if you're going to use a counter, you don't need to use a regex to increment the digit part of the field. Also, there's no need for an elsif when there are only two possibilities (eq and ne).

if ( $gtf[9] ne $previous ){ $exon = 1; # reset counter } else { $exon++; # increment counter } $gtf[2] = "exon$exon"; # put counter back in field

Aaron B.
Available for small or large Perl jobs; see my home node.

Replies are listed 'Best First'.
Re^9: Comparing adjacent lines
by daccame (Initiate) on Jul 16, 2012 at 22:06 UTC

    Perfect!! Thank you.

    Most of those things you pointed out were an accumulation of different things I tried...and then forgot to clean up afterwards. You have been incredibly helpful, thanks again.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-03-28 22:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found