Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^8: Parsing problem

by MB123 (Initiate)
on Nov 09, 2012 at 12:31 UTC ( #1003116=note: print w/replies, xml ) Need Help??

in reply to Re^7: Parsing problem
in thread Parsing problem

Thank you for the very informative post.

I followed your instructions and the output printed perfectly into the command line. I changed the file extensions around (to BSAC.txt and and obtained the same result - uninitialised value errors and the Number of Strains and AA Change columns were left blank.

I decided to try pasting the rest of my file under the __DATA__ part of your code. For the most part it worked as expected, but with interspersed Use of uninitialised value within %cod in string eq at line 32, <DATA> line XXX.. These lines are referring to non-synonymous mutations that code for a STOP codon, like the one below-

FT SNP 2811491 FT /note="refAllele: G SNPstrains: 7414_8#89=A (SNP codon is ST +OP) (AA Gln->STOP) " FT /colour=4
I assume this is because the code has not matched 'non' in the line. Could this also be the cause of my uninitialised value error in the original post?

Many Thanks

Replies are listed 'Best First'.
Re^9: Parsing problem
by kcott (Chancellor) on Nov 16, 2012 at 09:02 UTC

    Your problem here is that the number after 'FT        /colour=' (in this case "4"), is used as a key for %cod but you've only assigned @cod{qw{1 2 3}}. Using the following line solved the problem for me (you'll probably want a different value):

    my %cod = ( 1 => "red", 2 => "non", 3 => "green", 4 => 'value for key +4' );

    Alternatively, you can check $cod{$1} before using it:

    if ( exists $cod{$1} and $cod{$1} eq "non" ) { printf ...

    -- Ken

Re^9: Parsing problem
by MB123 (Initiate) on Nov 10, 2012 at 12:15 UTC
    I changed all the (SNP codon is STOP) to 'non-synonymous' and have not achieved better results.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1003116]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2018-05-27 20:16 GMT
Find Nodes?
    Voting Booth?