diff ragoo.pl @ 0:90611c479c08 draft

Uploaded
author dereeper
date Mon, 21 Jun 2021 21:10:57 +0000
parents
children 6a1c9991b723
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ragoo.pl	Mon Jun 21 21:10:57 2021 +0000
@@ -0,0 +1,58 @@
+#!/usr/bin/perl
+
+use strict;
+
+my $scaffolds= $ARGV[0];
+my $reference = $ARGV[1];
+my $output = $ARGV[2];
+my $output2 = $ARGV[3];
+
+my $tmpdir = "tmpdir$$";
+
+mkdir($tmpdir);
+
+
+my ($sc) = split(",",$scaffolds);
+$scaffolds = $sc;
+
+system("cp -rf $scaffolds $tmpdir/scaffolds.fa");
+system("cp -rf $reference $tmpdir/reference.fa");
+chdir($tmpdir);
+system("ragoo.py scaffolds.fa reference.fa");
+
+
+my %hash;
+my $id;
+open(F,"ragoo_output/ragoo.fasta");
+while(<F>){
+	if (/>(.*)/){$id = $1;}
+	else{
+		$hash{$id}.= $_;
+	}
+}
+close(F);
+
+open(O,">$output");
+foreach my $id(keys(%hash)){
+	print O ">$id\n";
+	my $seq = $hash{$id};
+	for (my $i =0; $i <= length($seq); $i =$i+80){
+		my $subseq = substr($seq,$i,80);
+		print O "$subseq\n";
+	}
+}
+close(O);
+
+open(O,">$output2");
+foreach my $id(keys(%hash)){
+        if ($id =~/Chr0_RaGOO/){
+                next;
+        }
+        print O ">$id\n";
+        my $seq = $hash{$id};
+        for (my $i =0; $i <= length($seq); $i =$i+80){
+                my $subseq = substr($seq,$i,80);
+                print O "$subseq\n";
+        }
+}
+close(O);