diff miranda2asko.pl @ 1:605bb64c2668 draft default tip

planemo upload for repository https://github.com/genouest/galaxy-tools/tree/master/tools/miranda2asko commit dea4b3dfc2393e4f5b9945099cfec37afe471283
author genouest
date Wed, 18 Apr 2018 06:26:33 -0400
parents 3f6cdc878f35
children
line wrap: on
line diff
--- a/miranda2asko.pl	Thu Apr 12 10:53:04 2018 -0400
+++ b/miranda2asko.pl	Wed Apr 18 06:26:33 2018 -0400
@@ -1,10 +1,39 @@
 use strict;
 use warnings;
+use Getopt::Long;
 
-my $miranda=shift;
+my $miranda;
+my $mature;
+
+GetOptions ("miranda=s" => \$miranda,
+           	"mature=s"   => \$mature);
+
+
+open MAT, $mature or die "failed to open $mature\n";
+open OUT_MIR, ">mirna.asko.tsv" or die "failed to open mirna.asko.tsv";
+my $mirna="";
+my $mirna_seq="";
+my $start=1;
+print OUT_MIR "mirna\tseq\n";
+while (<MAT>) {
+  chomp;
+  if (/^>(\S+)/) {
+    unless ($start==1) {
+      print OUT_MIR $mirna, "\t", $mirna_seq, "\n";
+    }
+    $start=0;
+    $mirna=$1;
+    $mirna_seq="";
+    next;
+  }
+  $mirna_seq.=$_;
+}
+print OUT_MIR $mirna, "\t", $mirna_seq, "\n";
+
+
 open MIRANDA, $miranda or die "failed to open $miranda\n";
-
-print "mirna\ttargets\@mRNA\tscore\tenergy\talignment length\tglobal coverage\tseed coverage\n";
+open TARGET, ">target.asko.tsv" or die "failed to open target.asko.tsv\n";
+print TARGET "target\ttargets\@mirna\ttargets\@mRNA\tscore\tenergy\talignment length\tglobal coverage\tseed coverage\n";
 
 while (<MIRANDA>) {
   chomp;
@@ -13,5 +42,5 @@
   $target=~s/_UTR3$//;
   $glcov=~ s/\%$//;
   $seedcov=~ s/\%$//;
-  print join ("\t", $mirna, $target, $score, $energy,$alnlength, $glcov, $seedcov), "\n";
+  print TARGET join ("\t", $mirna.'.'.$target, $mirna, $target, $score, $energy,$alnlength, $glcov, $seedcov), "\n";
 }