#!/usr/bin/perl
use strict;
use warnings;
use List::Util qw(min max);
use Set::IntervalTree;
use GenomeLookupUtil;
my $chromCol = 0;
my $startCol = 0;
my $endCol = 0;
if($ARGV[2] eq "VSC") {
$chromCol = 0;
$startCol = 1;
$endCol = 2;
} else {
$chromCol = 1;
$startCol = 2;
$endCol = 3;
}
open (IN2,"$ARGV[0]") || die "counldn't open";
print STDERR "Read mask file \n";
my @masklines = ();
my $i = 0;
my %mask_hash = ();
my $current_chr = '01';
my $current_snp_ranges = Set::IntervalTree->new();
while (<IN2>){
my @masklines = split ("\t", $_);
if ($masklines[1] ne $current_chr) {
$mask_hash{$current_chr} = $current_snp_ranges;
$current_snp_ranges = Set::IntervalTree->new();
}
$current_chr = $masklines[$chromCol];
$current_snp_ranges->insert(
[ $masklines[$startCol], $masklines[$endCol] ],
$masklines[$startCol],
$masklines[$endCol]
);
}
$mask_hash{$current_chr} = $current_snp_ranges;
close (IN2);
当我运行带有不必要参数的代码时,这是一个文件,它显示错误为
Use of uninitialized value in subroutine entry at mytest.pl line 47, <IN2> line 100.
我已经初始化了所有变量,最重要的是我没有在我的代码中使用任何子例程。第 47 行是
$current_snp_ranges->insert(
[ $masklines[$startCol], $masklines[$endCol] ],
$masklines[$startCol],
$masklines[$endCol]
);