in reply to Re: Adding missing values into a hash
in thread Adding missing values into a hash

Thank you very much for your answer :)

Your answer seems quite interesting but I don't know why but I obtain too many "NA".

With de first part of the script I obtain for example

AA=> NA, NA,1,2,5,NA,NA,NA,NA,NA

instead of

AA=> 1,2,5

Perhaps is related with

my (undef,%hash) = split /[\t;=]/,$line;

because you are spliting 3 times, I don't know.

The final csv is

AA => NA,NA,NA

AB => NA,NA,NA

AC => NA,NA,NA

Perhaps is because the problem with de "NA".

Replies are listed 'Best First'.
Re^3: Adding missing values into a hash
by poj (Abbot) on Jun 19, 2014 at 15:00 UTC

    Do you have other lines in the file apart from those like
    ##INFO=<ID=AA, and 1 AA=1;AB=2;AC=3 ? Blank lines for example.

    poj

      No, I don't have any other lines in the file :(

      I have the same problem if I use your complete script with:

      __DATA__

      ##INFO=<ID=AA,

      ##INFO=<ID=AB,

      ##INFO=<ID=AC,

      1 AA=1;AB=2;AC=3

      2 AA=2;AB=2

      3 AA=5;AB=1;AC=1

      I only obtain "NA" values in CVS file

        Check you have a tab character between between 1 and AA=1, 2 and AA=2, 3 and AA=5, not spaces

        poj