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