5 snp_dist_filter.pl -- filter snp by neigboring distance
13 Author: Fan Wei, fanw@genomics.org.cn
14 Version: 1.0, Date: 2006-12-6
18 snp_dist_filter.pl <*.cns.snp>
19 --distance <int> set the minimum distance between two neighboring SNPs, default=5
20 --verbose output running progress information to screen
21 --help output help information to screen
31 use FindBin
qw($Bin $Script);
32 use File::Basename qw(basename dirname);
34 use File
::Path
; ## function " mkpath" and "rmtree" deal with directory
36 ##get options from command line into variables and set default values
37 my ($Dist_cutoff, $Verbose,$Help);
39 "distance:i"=>\
$Dist_cutoff,
44 die `pod2text $0` if (@ARGV == 0 || $Help);
58 $data{$ref}{$cycle} = \
@t;
65 $head =~ s/Cycle_number 200/Cycle_number 100/;
72 foreach my $ref (sort keys %data) {
73 my $ref_p = $data{$ref};
74 for (my $i=1; $i<=100; $i++) {
75 $outstr .= "$ref\t$i";
76 my $read1_p = $ref_p->{$i};
77 my $read2_p = $ref_p->{$i+100};
78 for (my $j=0; $j<@
$read1_p; $j++) {
79 my $sum = $read1_p->[$j] + $read2_p->[$j];