comparison 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
comparison
equal deleted inserted replaced
0:3f6cdc878f35 1:605bb64c2668
1 use strict; 1 use strict;
2 use warnings; 2 use warnings;
3 use Getopt::Long;
3 4
4 my $miranda=shift; 5 my $miranda;
6 my $mature;
7
8 GetOptions ("miranda=s" => \$miranda,
9 "mature=s" => \$mature);
10
11
12 open MAT, $mature or die "failed to open $mature\n";
13 open OUT_MIR, ">mirna.asko.tsv" or die "failed to open mirna.asko.tsv";
14 my $mirna="";
15 my $mirna_seq="";
16 my $start=1;
17 print OUT_MIR "mirna\tseq\n";
18 while (<MAT>) {
19 chomp;
20 if (/^>(\S+)/) {
21 unless ($start==1) {
22 print OUT_MIR $mirna, "\t", $mirna_seq, "\n";
23 }
24 $start=0;
25 $mirna=$1;
26 $mirna_seq="";
27 next;
28 }
29 $mirna_seq.=$_;
30 }
31 print OUT_MIR $mirna, "\t", $mirna_seq, "\n";
32
33
5 open MIRANDA, $miranda or die "failed to open $miranda\n"; 34 open MIRANDA, $miranda or die "failed to open $miranda\n";
6 35 open TARGET, ">target.asko.tsv" or die "failed to open target.asko.tsv\n";
7 print "mirna\ttargets\@mRNA\tscore\tenergy\talignment length\tglobal coverage\tseed coverage\n"; 36 print TARGET "target\ttargets\@mirna\ttargets\@mRNA\tscore\tenergy\talignment length\tglobal coverage\tseed coverage\n";
8 37
9 while (<MIRANDA>) { 38 while (<MIRANDA>) {
10 chomp; 39 chomp;
11 my ($mirna, $target, $score, $energy,$pos1, $pos2,$alnlength, $glcov, $seedcov)=split "\t"; 40 my ($mirna, $target, $score, $energy,$pos1, $pos2,$alnlength, $glcov, $seedcov)=split "\t";
12 $mirna=~ s/^>//; 41 $mirna=~ s/^>//;
13 $target=~s/_UTR3$//; 42 $target=~s/_UTR3$//;
14 $glcov=~ s/\%$//; 43 $glcov=~ s/\%$//;
15 $seedcov=~ s/\%$//; 44 $seedcov=~ s/\%$//;
16 print join ("\t", $mirna, $target, $score, $energy,$alnlength, $glcov, $seedcov), "\n"; 45 print TARGET join ("\t", $mirna.'.'.$target, $mirna, $target, $score, $energy,$alnlength, $glcov, $seedcov), "\n";
17 } 46 }