#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    15
    Rep Power
    0

    Selecting one coulmn values based on the differences in members of another column


    Hi to all,
    i have data like this
    ASSAY MP Cm chr# Qty poly#
    XY1723 408068 0.3 1 27 0
    XY1727 463360 0.3 1 28 0
    XY1708 880744 25.7 1 14 1
    XY1709 900596 25.8 1 11 1
    XY487 1174585 0 1 290 1
    XY1641 1239146 27.3 1 5 0
    XY1714 3057570 34.2 1 28 0
    XY1721 3522443 34.2 1 13 1
    my aim is to select ASSAY on every CHR# like this i have 12 chromosomes, The criteria to select assay column is, i want to select Assay based on MP column and CM column and i want to select ASSAY after a range of every100,000 (hundred thousand, 100kb) value in MP column and every 5 Cm in CM coulmn. For example if i select XY1723 and i want to select next memebr of assay column having MP column value should equal to 508068 and CM column value difference must be 5.
    This is the code i tried till now to get solution to my problem,
    Code:
    use 5.16.0;
    use warnings;
    my %data;
    my $MP_count = 100_000;
    my $Cm_count = 5;
    my $match = 0;
    my @fields = qw/MP Cm chr Qty poly/;
    
    while (<DATA>){
        next unless /XY\d+/;
        chomp;
        my $line =[split];
        my $key = shift @$line;
        $data{$key} = {map {$_ => shift @$line} @fields};
    }
    my $assay = $ARGV[0];
    die "No argument given" unless $assay;
    die "Assay name is not valid" unless $data{$assay};
    my ($mp,$cm) = ($data{$assay}->{MP},$data{$assay}->{Cm});
    for my $key (keys %data){
        if ($data{$key}->{MP} == $mp + $MP_count and abs($data{$key}->{Cm} - $cm) == 5){
            say "Match found: $key";
            $match++;
        }
    }
    
    say "Match not found" unless $match;
    Now i am getting error like this,
    No argument given at line No 19, <data> line 10.Can any one help me to solve this, any help would be appreciated
    Thanks and Regards,
    Genetist
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2012
    Posts
    832
    Rep Power
    496
    Your program requires at least one command line argument and apparently did not get it. How did you launch the program?

IMN logo majestic logo threadwatch logo seochat tools logo