Mercurial > repos > bgruening > cmsearch_deoverlap
annotate cmsearch-deoverlap.pl @ 0:571e644de888 draft default tip
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
author | bgruening |
---|---|
date | Sat, 19 Aug 2023 05:25:46 +0000 |
parents | |
children |
rev | line source |
---|---|
0
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
1 #!/usr/bin/env perl |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
2 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
3 # cmsearch-deoverlap.pl: remove lower scoring overlaps from cmsearch |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
4 # --tblout files. |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
5 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
6 # EPN, Mon May 8 08:41:36 2017 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
7 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
8 # The EMG Team took a SNAPSHOT of this script on Thurs July 13 2017 from src: |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
9 # https://raw.githubusercontent.com/nawrockie/cmsearch_tblout_deoverlap/master/cmsearch-deoverlap.pl |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
10 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
11 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
12 # Without --maxkeep this script will exactly reproduce how cmscan removes overlapping hits. |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
13 # With --maxkeep, it won't. Here's an example to explain the difference: |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
14 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
15 ##target name accession query name accession mdl mdl from mdl to seq from seq to strand trunc pass gc bias score E-value inc description of target |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
16 ##------------------- --------- -------------------- --------- --- -------- -------- -------- -------- ------ ----- ---- ---- ----- ------ --------- --- --------------------- |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
17 #1. contig--151565 - LSU_rRNA_eukarya RF02543 hmm 632 2329 410 1883 + - 6 0.48 1.1 726.0 1.1e-216 ! - |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
18 #2. contig--151565 - LSU_rRNA_archaea RF02540 hmm 170 2084 12 1882 + - 6 0.47 3.0 490.0 2.3e-145 ! - |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
19 #3. contig--151565 - LSU_rRNA_bacteria RF02541 hmm 187 2005 10 1883 + - 6 0.47 5.7 331.4 1.8e-97 ! - |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
20 #4. contig--151565 - LSU_rRNA_eukarya RF02543 hmm 29 431 12 366 + - 6 0.41 7.8 100.0 6.3e-28 ! - |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
21 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
22 # hit 1: 410..1883 euk |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
23 # hit 2: 12..1182 arc |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
24 # hit 3: 10..1883 bac |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
25 # hit 4: 12..366 euk |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
26 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
27 # Without --maxkeep (default behavior) hits 2, 3, and 4 will be removed because for all 3, there is a better scoring hit |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
28 # that overlaps. |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
29 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
30 # With --maxkeep only hits 2 and 3 will be removed because only those 2 have |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
31 # higher scoring hits that overlap with them AND are not removed. If we remove only hits 2 and 3 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
32 # hits 1 and 4 no longer overlap. |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
33 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
34 use strict; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
35 use warnings; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
36 use Getopt::Long; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
37 use File::Basename; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
38 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
39 my $in_tblout = ""; # name of input tblout file |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
40 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
41 my $usage; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
42 $usage = "cmsearch-deoverlap.pl [OPTIONS] <tblout file>\n\tOR\n"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
43 $usage .= "cmsearch-deoverlap.pl -l [OPTIONS] <list of tblout files>\n\n"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
44 $usage .= "\tOPTIONS:\n"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
45 $usage .= "\t\t-l : single command line argument is a list of tblout files, not a single tblout file\n"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
46 $usage .= "\t\t-s : sort hits by bit score [default: sort by E-value]\n"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
47 $usage .= "\t\t-d : run in debugging mode (prints extra info)\n"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
48 $usage .= "\t\t--clanin <s> : only remove overlaps within clans, read clan info from file <s> [default: remove all overlaps]\n"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
49 $usage .= "\t\t--maxkeep : keep hits that only overlap with other hits that are not kept [default: remove all hits with higher scoring overlap]\n"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
50 $usage .= "\t\t--dirty : keep intermediate files (sorted tblout files)\n\n"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
51 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
52 my $do_listfile = 0; # set to '1' if -l used |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
53 my $rank_by_score = 0; # set to '1' if -s used, rank by score, not evalues |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
54 my $do_debug = 0; # set to '1' if -d used |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
55 my $in_clanin = undef; # defined if --clanin option used |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
56 my $do_maxkeep = 0; # set to '1' if --maxkeep, only remove hits that have |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
57 # higher scoring overlap that is not removed |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
58 my $do_dirty = 0; # set to '1' if --dirty used, keep intermediate files |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
59 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
60 &GetOptions( "-l" => \$do_listfile, |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
61 "-s" => \$rank_by_score, |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
62 "-d" => \$do_debug, |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
63 "clanin=s" => \$in_clanin, |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
64 "maxkeep" => \$do_maxkeep, |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
65 "keep" => \$do_dirty); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
66 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
67 if(scalar(@ARGV) != 1) { die $usage; } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
68 ($in_tblout) = @ARGV; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
69 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
70 my @tblout_file_A = (); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
71 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
72 if($do_listfile) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
73 # read the list file |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
74 my $list_file = $in_tblout; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
75 open(IN, $list_file) || die "ERROR unable to open $list_file for reading"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
76 while(my $line = <IN>) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
77 if($line =~ m/\w/ && $line !~ m/^\#/) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
78 chomp $line; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
79 if(! -e $line) { die "ERROR file $line read from $list_file does not exist"; } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
80 if(! -s $line) { die "ERROR file $line read from $list_file is empty"; } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
81 push(@tblout_file_A, $line); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
82 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
83 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
84 close(IN); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
85 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
86 else { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
87 $tblout_file_A[0] = $in_tblout; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
88 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
89 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
90 my %clan_H = (); # key: model name, value: clan name |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
91 if(defined $in_clanin) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
92 %clan_H = (); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
93 parse_claninfo($in_clanin, \%clan_H) |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
94 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
95 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
96 my $sort_cmd = undef; # command used to sort the tblout file |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
97 my $sorted_tblout_file = undef; # sorted tblout file to create, temporarily |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
98 my $output_file = undef; # name of output file we create |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
99 my $out_FH = undef; # output file handle |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
100 my $nkept = undef; # number of sequences kept from a file |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
101 my $nremoved = undef; # number of sequences removed from a file |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
102 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
103 foreach my $tblout_file (@tblout_file_A) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
104 if(! -e $tblout_file) { die "ERROR tblout file $tblout_file does not exist"; } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
105 if(! -s $tblout_file) { die "ERROR tblout file $tblout_file is empty"; } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
106 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
107 # sort tblout file by target sequence name |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
108 $sorted_tblout_file = $tblout_file . ".sort"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
109 $sort_cmd = ((defined $rank_by_score) && ($rank_by_score == 1)) ? |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
110 "grep -v ^\# $tblout_file | sort -k 1,1 -k 15,15rn -k 16,16g > $sorted_tblout_file" : |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
111 "grep -v ^\# $tblout_file | sort -k 1,1 -k 16,16g -k 15,15rn > $sorted_tblout_file"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
112 run_command($sort_cmd, $do_debug); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
113 $output_file = basename($tblout_file) . ".deoverlapped"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
114 $out_FH = undef; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
115 open($out_FH, ">", $output_file) || die "ERROR unable to open $output_file for writing"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
116 ($nkept, $nremoved) = parse_sorted_tblout_file($sorted_tblout_file, (defined $in_clanin) ? \%clan_H : undef, $rank_by_score, $do_maxkeep, $do_debug, $out_FH); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
117 close $out_FH; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
118 if(! $do_dirty) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
119 #unlink $sorted_tblout_file; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
120 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
121 printf("Saved %5d hits (%5d removed) to $output_file\n", $nkept, $nremoved) |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
122 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
123 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
124 ################################################################# |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
125 # Subroutine : parse_sorted_tblout_file() |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
126 # Incept: EPN, Mon May 8 08:57:54 2017 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
127 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
128 # Purpose: Parse a sorted tabular output file, and output |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
129 # all hits that do not have a higher scoring overlap. |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
130 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
131 # Arguments: |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
132 # $sorted_tbl_file: file with sorted tabular search results |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
133 # $clan_HR: ref to hash of clan info, key is model, value is clan |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
134 # $rank_by_score: '1' if rank is determined by score, '0' if |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
135 # determined by E-value |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
136 # $do_maxkeep: '1' if --maxkeep option used |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
137 # only remove hits with higher scoring overlaps |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
138 # *THAT ARE NOT THEMSELVES REMOVED* |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
139 # $do_debug; '1' if we should print debugging output |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
140 # $out_FH: file handle to output to |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
141 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
142 # Returns: Two values: |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
143 # $nkept: number of hits saved and output |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
144 # $nremoved: number of hits removed and not output |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
145 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
146 # Dies: If we see a line of input that is an an unexpected |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
147 # format |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
148 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
149 ################################################################# |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
150 sub parse_sorted_tblout_file { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
151 my $nargs_expected = 6; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
152 my $sub_name = "parse_sorted_tblout_file"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
153 if(scalar(@_) != $nargs_expected) { printf STDERR ("ERROR, $sub_name entered with %d != %d input arguments.\n", scalar(@_), $nargs_expected); exit(1); } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
154 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
155 my ($sorted_tbl_file, $clan_HR, $rank_by_score, $do_maxkeep, $do_debug, $out_FH) = @_; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
156 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
157 my $prv_target = undef; # target name of previous line |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
158 my $prv_score = undef; # bit score of previous line |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
159 my $prv_evalue = undef; # E-value of previous line |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
160 my $clan = undef; # clan of current model |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
161 my $nkept = 0; # number of hits kept and output |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
162 my $nremoved = 0; # number of hits removed and not output |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
163 my $do_clans = (defined $clan_HR) ? 1 : 0; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
164 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
165 open(IN, $sorted_tbl_file) || die "ERROR unable to open sorted tabular file $sorted_tbl_file for reading"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
166 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
167 my ($target, $model, $domain, $mdlfrom, $mdlto, $seqfrom, $seqto, $strand, $score, $evalue) = |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
168 (undef, undef, undef, undef, undef, undef, undef, undef, undef, undef); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
169 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
170 my @line_A = (); # array of output lines for kept hits for current sequence |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
171 my @seqfrom_A = (); # array of seqfroms for kept hits for current sequence |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
172 my @seqto_A = (); # array of seqtos for kept hits for current sequence |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
173 my @strand_A = (); # array of strands for kept hits for current sequence |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
174 my @clan_A = (); # array of clans for kept hits for current sequence |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
175 my @keepme_A = (); # array of '1' and '0', '1' if we should keep this hit, '0' if it had a higher scoring overlap |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
176 my $nhits = 0; # number of hits for current sequence (size of all arrays) |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
177 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
178 my %already_seen_H = (); # hash, key is sequence name, value is '1' if we have output info for this sequence |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
179 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
180 $prv_evalue = 0.; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
181 while(my $line = <IN>) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
182 ###################################################### |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
183 # Parse the data on this line, this differs depending |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
184 # on our annotation method |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
185 chomp $line; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
186 $line =~ s/^\s+//; # remove leading whitespace |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
187 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
188 if($line =~ m/^\#/) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
189 die "ERROR, found line that begins with #, input should have these lines removed and be sorted by the first column:$line."; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
190 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
191 my @el_A = split(/\s+/, $line); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
192 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
193 ##target name accession query name accession mdl mdl from mdl to seq from seq to strand trunc pass gc bias score E-value inc description of target |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
194 ##----------------------- --------- -------------------- --------- --- -------- -------- -------- -------- ------ ----- ---- ---- ----- ------ --------- --- --------------------- |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
195 #lcl|dna_BP444_24.8k:251 - SSU_rRNA_archaea RF01959 hmm 3 1443 2 1436 + - 6 0.53 6.0 1078.9 0 ! - |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
196 if(scalar(@el_A) < 18) { die "ERROR found less than 18 columns in cmsearch tabular output at line: $line"; } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
197 # ($target, $model, $mdlfrom, $mdlto, $seqfrom, $seqto, $strand, $score, $evalue) = |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
198 ($target, $model, $seqfrom, $seqto, $strand, $score, $evalue) = |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
199 ($el_A[0], $el_A[2], $el_A[7], $el_A[8], $el_A[9], $el_A[14], $el_A[15]); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
200 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
201 $clan = undef; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
202 if(defined $clan_HR) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
203 if(exists $clan_HR->{$model}) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
204 $clan = $clan_HR->{$model}; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
205 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
206 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
207 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
208 # make sure we didn't output information for this sequence already |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
209 if(exists $already_seen_H{$target}) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
210 die "ERROR found line with target $target previously output, did you sort by sequence name?"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
211 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
212 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
213 ############################################################## |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
214 # Are we now finished with the previous sequence? |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
215 # Yes, if target sequence we just read is different from it |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
216 # If yes, output info for it, and re-initialize data structures |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
217 # for new sequence just read |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
218 if((defined $prv_target) && ($prv_target ne $target)) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
219 output_one_target($out_FH, \@line_A, \@keepme_A); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
220 $already_seen_H{$prv_target} = 1; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
221 @line_A = (); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
222 @seqfrom_A = (); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
223 @seqto_A = (); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
224 @strand_A = (); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
225 @clan_A = (); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
226 @keepme_A = (); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
227 $nhits = 0; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
228 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
229 else { # this is not a new sequence |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
230 # make sure that our current score or E-value is less than previous |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
231 if($rank_by_score && ($score > $prv_score)) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
232 die "ERROR found lines with same target [$target] incorrectly sorted by score, did you sort by sequence name and score?"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
233 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
234 elsif((! $rank_by_score) && ($evalue < $prv_evalue)) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
235 die "ERROR found lines with same target [$target] incorrectly sorted by E-value, did you sort by sequence name and E-value?"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
236 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
237 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
238 ############################################################## |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
239 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
240 # look through all other hits $i on the same strand and see if any of them overlap with this one |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
241 # if (! $do_maxkeep) we look at all hits |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
242 # if ( $do_maxkeep) we only look at hits that haven't been removed yet |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
243 my $keep_me = 1; # set to '0' below if we find a better scoring hit |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
244 my $overlap_idx = -1; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
245 for(my $i = 0; $i < $nhits; $i++) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
246 if(($strand_A[$i] eq $strand) && # same strand |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
247 (determine_if_clans_match($do_clans, $clan, $clan_A[$i])) && # clans match, or --clanin not used |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
248 ((! $do_maxkeep) || ($keepme_A[$i] == 1))) { # either --maxkeep not enabled, or this hit is a keepter |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
249 if(($strand eq "+") && (get_overlap($seqfrom, $seqto, $seqfrom_A[$i], $seqto_A[$i]) > 0)) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
250 $keep_me = 0; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
251 $overlap_idx = $i; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
252 $i = $nhits; # breaks for loop |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
253 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
254 elsif(($strand eq "-") && (get_overlap($seqto, $seqfrom, $seqto_A[$i], $seqfrom_A[$i]) > 0)) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
255 $keep_me = 0; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
256 $overlap_idx = $i; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
257 $i = $nhits; # breaks for loop |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
258 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
259 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
260 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
261 # add hit to list of hits we have for this sequence |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
262 $line_A[$nhits] = $line . "\n"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
263 $seqfrom_A[$nhits] = $seqfrom; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
264 $seqto_A[$nhits] = $seqto; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
265 $strand_A[$nhits] = $strand; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
266 $clan_A[$nhits] = $clan; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
267 if($keep_me) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
268 $nkept++; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
269 $keepme_A[$nhits] = 1; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
270 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
271 else { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
272 $nremoved++; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
273 $keepme_A[$nhits] = 0; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
274 if($do_debug) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
275 printf("Removing $seqfrom..$seqto, it overlapped with $seqfrom_A[$overlap_idx]..$seqto_A[$overlap_idx]\n"); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
276 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
277 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
278 $nhits++; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
279 $prv_target = $target; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
280 $prv_score = $score; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
281 $prv_evalue = $evalue; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
282 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
283 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
284 # output data for final sequence |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
285 output_one_target($out_FH, \@line_A, \@keepme_A); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
286 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
287 # close file handle |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
288 close(IN); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
289 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
290 return ($nkept, $nremoved); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
291 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
292 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
293 ################################################################# |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
294 # Subroutine : output_one_target() |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
295 # Incept: EPN, Mon May 8 10:20:40 2017 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
296 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
297 # Purpose: Output all hits for a target. Overlapping hits |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
298 # are not included, they've been skipped. |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
299 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
300 # Arguments: |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
301 # $out_FH: file handle to output short output to (can be undef to not output short output) |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
302 # $line_AR: array of lines to output |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
303 # $keepme_AR: array of '1', '0', $keepme_AR->[$i]==1 indicates we should output $line_AR->[$i] |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
304 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
305 # Returns: Nothing. |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
306 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
307 # Dies: Never. |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
308 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
309 ################################################################# |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
310 sub output_one_target { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
311 my $nargs_expected = 3; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
312 my $sub_name = "output_one_target"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
313 if(scalar(@_) != $nargs_expected) { printf STDERR ("ERROR, $sub_name entered with %d != %d input arguments.\n", scalar(@_), $nargs_expected); exit(1); } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
314 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
315 my ($out_FH, $line_AR, $keepme_AR) = @_; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
316 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
317 for(my $i = 0; $i < scalar(@{$line_AR}); $i++) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
318 if($keepme_AR->[$i]) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
319 print $out_FH $line_AR->[$i]; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
320 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
321 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
322 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
323 return; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
324 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
325 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
326 ################################################################# |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
327 # Subroutine : determine_if_clans_match() |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
328 # Incept: EPN, Mon May 8 10:28:41 2017 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
329 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
330 # Purpose: Given two clan values return true if they |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
331 # either match or if the --clanin option is |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
332 # not used. |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
333 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
334 # Arguments: |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
335 # $do_clans: '1' if the --clanin option was used |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
336 # $clan1: clan 1, can be undef |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
337 # $clan2: clan 2, can be undef |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
338 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
339 # Returns: '1' if the clans match or if $do_clans is FALSE |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
340 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
341 # Dies: Never. |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
342 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
343 ################################################################# |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
344 sub determine_if_clans_match { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
345 my $nargs_expected = 3; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
346 my $sub_name = "determine_if_clans_match"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
347 if(scalar(@_) != $nargs_expected) { printf STDERR ("ERROR, $sub_name entered with %d != %d input arguments.\n", scalar(@_), $nargs_expected); exit(1); } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
348 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
349 my ($do_clans, $clan1, $clan2) = @_; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
350 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
351 if(! $do_clans) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
352 return 1; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
353 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
354 elsif((! defined $clan1) || (! defined $clan2)) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
355 # 1 or both of $clan1 and $clan2 are undefined, can't be a match |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
356 return 0; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
357 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
358 elsif($clan1 eq $clan2) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
359 # equal clans |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
360 return 1; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
361 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
362 else { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
363 return 0; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
364 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
365 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
366 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
367 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
368 ################################################################# |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
369 # Subroutine: get_overlap() |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
370 # Incept: EPN, Mon Mar 14 13:47:57 2016 [dnaorg_scripts:dnaorg.pm:getOverlap()] |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
371 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
372 # Purpose: Calculate number of nucleotides of overlap between |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
373 # two regions. |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
374 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
375 # Args: |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
376 # $start1: start position of hit 1 (must be <= $end1) |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
377 # $end1: end position of hit 1 (must be >= $end1) |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
378 # $start2: start position of hit 2 (must be <= $end2) |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
379 # $end2: end position of hit 2 (must be >= $end2) |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
380 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
381 # Returns: $noverlap: Number of nucleotides of overlap between hit1 and hit2, |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
382 # 0 if none |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
383 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
384 # Dies: if $end1 < $start1 or $end2 < $start2. |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
385 sub get_overlap { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
386 my $sub_name = "get_overlap"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
387 my $nargs_exp = 4; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
388 if(scalar(@_) != 4) { die "ERROR $sub_name entered with wrong number of input args"; } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
389 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
390 my ($start1, $end1, $start2, $end2) = @_; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
391 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
392 # printf("in $sub_name $start1..$end1 $start2..$end2\n"); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
393 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
394 if($start1 > $end1) { die "ERROR in $sub_name start1 > end1 ($start1 > $end1)"; } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
395 if($start2 > $end2) { die "ERROR in $sub_name start2 > end2 ($start2 > $end2)"; } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
396 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
397 # Given: $start1 <= $end1 and $start2 <= $end2. |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
398 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
399 # Swap if nec so that $start1 <= $start2. |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
400 if($start1 > $start2) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
401 my $tmp; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
402 $tmp = $start1; $start1 = $start2; $start2 = $tmp; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
403 $tmp = $end1; $end1 = $end2; $end2 = $tmp; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
404 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
405 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
406 # 3 possible cases: |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
407 # Case 1. $start1 <= $end1 < $start2 <= $end2 Overlap is 0 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
408 # Case 2. $start1 <= $start2 <= $end1 < $end2 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
409 # Case 3. $start1 <= $start2 <= $end2 <= $end1 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
410 if($end1 < $start2) { return (0); } # case 1 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
411 if($end1 < $end2) { return ($end1 - $start2 + 1); } # case 2 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
412 if($end2 <= $end1) { return ($end2 - $start2 + 1); } # case 3 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
413 die "ERROR in $sub_name, unforeseen case in $start1..$end1 and $start2..$end2"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
414 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
415 return; # NOT REACHED |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
416 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
417 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
418 ################################################################# |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
419 # Subroutine: run_command() |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
420 # Incept: EPN, Mon Dec 19 10:43:45 2016 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
421 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
422 # Purpose: Runs a command using system() and exits in error |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
423 # if the command fails. If $be_verbose, outputs |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
424 # the command to stdout. |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
425 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
426 # Arguments: |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
427 # $cmd: command to run, with a "system" command; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
428 # $be_verbose: '1' to output command to stdout before we run it, '0' not to |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
429 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
430 # Returns: nothing |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
431 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
432 # Dies: if $cmd fails |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
433 ################################################################# |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
434 sub run_command { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
435 my $sub_name = "run_command()"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
436 my $nargs_expected = 2; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
437 if(scalar(@_) != $nargs_expected) { printf STDERR ("ERROR, $sub_name entered with %d != %d input arguments.\n", scalar(@_), $nargs_expected); exit(1); } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
438 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
439 my ($cmd, $be_verbose) = @_; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
440 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
441 if($be_verbose) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
442 print ("Running cmd: $cmd\n"); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
443 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
444 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
445 system($cmd); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
446 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
447 if($? != 0) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
448 die "ERROR in $sub_name, the following command failed:\n$cmd\n"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
449 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
450 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
451 return; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
452 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
453 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
454 ################################################################# |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
455 # Subroutine: parse_claninfo() |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
456 # Incept: EPN, Wed May 10 15:01:07 2017 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
457 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
458 # Purpose: Parse a claninfo file and fill %{$clan_HR}. |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
459 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
460 # Arguments: |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
461 # $claninfo_file: clan info file |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
462 # $clan_HR: ref to hash of clan info, key: model name, value: clan name |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
463 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
464 # Returns: nothing |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
465 # |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
466 # Dies: if $cmd fails |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
467 ################################################################# |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
468 sub parse_claninfo { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
469 my $sub_name = "parse_claninfo()"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
470 my $nargs_expected = 2; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
471 if(scalar(@_) != $nargs_expected) { printf STDERR ("ERROR, $sub_name entered with %d != %d input arguments.\n", scalar(@_), $nargs_expected); exit(1); } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
472 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
473 my ($claninfo_file, $clan_HR) = @_; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
474 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
475 open(IN, $claninfo_file) || die "ERROR unable to open clan info file"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
476 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
477 %{$clan_HR} = (); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
478 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
479 while(my $line = <IN>) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
480 if($line !~ m/^#/) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
481 chomp $line; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
482 my @el_A = split(/\s+/, $line); |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
483 # first element is clan name, all other elements are model names in that clan |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
484 #CL00111 SSU_rRNA_bacteria SSU_rRNA_archaea SSU_rRNA_eukarya SSU_rRNA_microsporidia SSU_trypano_mito |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
485 for(my $i = 1; $i < scalar(@el_A); $i++) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
486 if(exists $clan_H{$el_A[$i]}) { |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
487 die "ERROR in $sub_name, parsing clan info file $claninfo_file, read model $el_A[$i] more than once"; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
488 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
489 $clan_HR->{$el_A[$i]} = $el_A[0]; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
490 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
491 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
492 } |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
493 |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
494 return; |
571e644de888
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/cmsearch_deoverlap commit 675c458c910bb85bd472e25209fa1df43179efb6
bgruening
parents:
diff
changeset
|
495 } |