-
Notifications
You must be signed in to change notification settings - Fork 0
/
RapidRunLTR_finder.pl
50 lines (43 loc) · 1007 Bytes
/
RapidRunLTR_finder.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
#!/usr/bin/perl -w
use strict;
use threads;
my $in0 = $ARGV[0]; #genome file
my %id2seq = ();
open IN0, $in0;
while(<IN0>){
chomp;
if(/^>(\S+)/ && ! exists $id2seq{$1}){
$id2seq{$1} = "";
}
else{
$id2seq{$1} .= $_;
}
}
close IN0;
my @filename = ();
open OUT0, ">scaffold.fa";
for my $key1(sort keys %id2seq){
print $key1, "\n";
if($key1 =~ /scaffold/){ #it depends__
print OUT0 ">$key1","\n", $id2seq{$key1}, "\n";
}
else{
push(@filename, "$key1.fa");
open OUT1, ">$key1.fa";
print OUT1 ">$key1", "\n", $id2seq{$key1}, "\n";
close OUT1;
}
}
close OUT0;
push(@filename, "scaffold.fa");
my @thr = ();
for(my $i = 0; $i <= $#filename; $i+= 1){
$thr[$i] = threads->create(\<R_finder, $filename[$i]);
}
for(my $i = 0; $i <= $#filename; $i+= 1){
$thr[$i]->join;
}
sub LTR_finder{
my($input) = @_;
system("ltr_finder -D 15000 -d 1000 -L 7000 -l 100 -p 20 -C -M 0.9 -s /share/mg6t/caix/src/LTR_FINDER.x86_64-1.0.6/tRNAdb/Athal-tRNAs.fa $input > $input.ltr_finder");
}