0
|
1 #!/usr/bin/perl
|
|
2
|
|
3 use strict;
|
1
|
4 use File::Basename;
|
|
5 my $dirname = dirname(__FILE__);
|
0
|
6
|
|
7 my $scaffolds= $ARGV[0];
|
|
8 my $reference = $ARGV[1];
|
|
9 my $output = $ARGV[2];
|
|
10 my $output2 = $ARGV[3];
|
|
11
|
|
12 my $tmpdir = "tmpdir$$";
|
|
13
|
|
14 mkdir($tmpdir);
|
|
15
|
|
16
|
|
17 my ($sc) = split(",",$scaffolds);
|
|
18 $scaffolds = $sc;
|
|
19
|
|
20 system("cp -rf $scaffolds $tmpdir/scaffolds.fa");
|
|
21 system("cp -rf $reference $tmpdir/reference.fa");
|
|
22 chdir($tmpdir);
|
3
|
23 system("$dirname/ragoo.py scaffolds.fa reference.fa >>$output 2>&1");
|
0
|
24
|
|
25
|
|
26 my %hash;
|
|
27 my $id;
|
|
28 open(F,"ragoo_output/ragoo.fasta");
|
|
29 while(<F>){
|
|
30 if (/>(.*)/){$id = $1;}
|
|
31 else{
|
|
32 $hash{$id}.= $_;
|
|
33 }
|
|
34 }
|
|
35 close(F);
|
|
36
|
3
|
37 open(O,">>$output");
|
0
|
38 foreach my $id(keys(%hash)){
|
|
39 print O ">$id\n";
|
|
40 my $seq = $hash{$id};
|
|
41 for (my $i =0; $i <= length($seq); $i =$i+80){
|
|
42 my $subseq = substr($seq,$i,80);
|
|
43 print O "$subseq\n";
|
|
44 }
|
|
45 }
|
|
46 close(O);
|
|
47
|
|
48 open(O,">$output2");
|
|
49 foreach my $id(keys(%hash)){
|
|
50 if ($id =~/Chr0_RaGOO/){
|
|
51 next;
|
|
52 }
|
|
53 print O ">$id\n";
|
|
54 my $seq = $hash{$id};
|
|
55 for (my $i =0; $i <= length($seq); $i =$i+80){
|
|
56 my $subseq = substr($seq,$i,80);
|
|
57 print O "$subseq\n";
|
|
58 }
|
|
59 }
|
|
60 close(O);
|