forked from kentnf/RSQuantification
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsplit_get_exp_raw.pl
executable file
·56 lines (39 loc) · 1006 Bytes
/
split_get_exp_raw.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
#!/usr/bin/perl
my $usage = qq'
USAGE: perl $0 list position_file
';
my $list = shift || die $usage;
my $position = shift || die $usage;
my $s = "SS";
my $position_line = 40000;
my $line = `wc -l $position`; chomp $line;
my $cycle = int( $line / $position_line ) + 1;
print "position line:$line\tcycle: $cycle\n";
for(my $i=1; $i<=$cycle; $i++)
{
my $pos = $position.$i;
generate_pos($position, $i, $position_line, $pos);
my $out = "exp$i";
my $cmd = "get_exp_raw.pl -i $list -s $s -a $pos -o $out";
print $cmd."\n";
system($cmd) && die "Error in command $cmd \n";
unlink($pos);
}
sub generate_pos
{
my ($position, $i, $position_line, $pos) = @_;
my $n = 0;
my $end = $i * $position_line;
my $start = $end - $position_line + 1;
open(OUT, ">".$pos) || die $!;
open(FH, $position) || die $!;
while(<FH>)
{
chomp;
$n++;
if ($n>=$start && $n <= $end) { print OUT $_."\n"; }
}
close(FH);
close(OUT);
}
#Perl get_exp_raw.pl -i read_list -s SS -a tomato_gene_position