-
Notifications
You must be signed in to change notification settings - Fork 0
/
APA.pl
67 lines (63 loc) · 1.42 KB
/
APA.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/perl -w
###################################
# Author: Xiaoyu Zhou
# Email: xyzh@biomed.au.dk
###################################
use strict;
use Math::Round;
my ($in,$out)=@ARGV;
my ($reads,$value,$choice);
open IN,$in or die $!;
open (OUT,'>',$out);
open (IN,'<',$in) or die "Can't open $in!";
while(<IN>){
chomp;
my @info = (split /\s+/, $_);
my $strand = $info[7];
if ($strand eq "+"){
$reads = $info[9];
}else{
$reads = $info[10];
}
my @position = (split /,/, $reads);
if ($reads eq "."){
$value = 0;
print OUT "NULL\t$value\t@info\t\n";
}else{
my $count += $reads =~ s/,//g;
$value = $count +1;
if ($value > 40){
$choice = int($value/2) - 1;
print OUT "$position[$choice]\t$value\t@info\t\n";
}else{
print OUT "NULLow\t$value\t@info\t\n";
}
}
}
close IN;
close OUT;
exit;
#my @distance;
while(<IN>){
chomp;
my @info = (split /\s+/, $_);
my $count += $_ =~ s/NULL//g;
my @distance = ();
if ($count != 8){
for (my $i = 0; $i < 8; $i = $i + 1){
print $i;
my $tmp += $info[$i] =~ s/NULL//g;
if($tmp == 0){
push @distance, $info[$i];
}
}
@distance = sort @distance;
#print "@sort\t\n";
my $dis = $sort[-1] - $sort[0];
$value = 8 - $count;
print OUT "$distance\t$value\t$info[8]\t$info[9]\t$info[10]\t$info[11]\t$info[12]\n";
}else{
next;
}
}
close IN;