line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
############################################################################### |
2
|
|
|
|
|
|
|
# # |
3
|
|
|
|
|
|
|
# Copyright © 2012-2013 -- IRB/INSERM # |
4
|
|
|
|
|
|
|
# (Institut de Recherche en Biothérapie / # |
5
|
|
|
|
|
|
|
# Institut National de la Santé et de la # |
6
|
|
|
|
|
|
|
# Recherche Médicale) # |
7
|
|
|
|
|
|
|
# # |
8
|
|
|
|
|
|
|
# Auteurs/Authors: Jerôme AUDOUX # |
9
|
|
|
|
|
|
|
# Nicolas PHILIPPE # |
10
|
|
|
|
|
|
|
# # |
11
|
|
|
|
|
|
|
# ------------------------------------------------------------------------- # |
12
|
|
|
|
|
|
|
# # |
13
|
|
|
|
|
|
|
# Ce fichier fait partie de la suite CracTools qui contient plusieurs pipeline# |
14
|
|
|
|
|
|
|
# intégrés permettant de traiter les évênements biologiques présents dans du # |
15
|
|
|
|
|
|
|
# RNA-Seq. Les CracTools travaillent à partir d'un fichier SAM de CRAC et d'un# |
16
|
|
|
|
|
|
|
# fichier d'annotation au format GFF3. # |
17
|
|
|
|
|
|
|
# # |
18
|
|
|
|
|
|
|
# Ce logiciel est régi par la licence CeCILL soumise au droit français et # |
19
|
|
|
|
|
|
|
# respectant les principes de diffusion des logiciels libres. Vous pouvez # |
20
|
|
|
|
|
|
|
# utiliser, modifier et/ou redistribuer ce programme sous les conditions de # |
21
|
|
|
|
|
|
|
# la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA sur # |
22
|
|
|
|
|
|
|
# le site "http://www.cecill.info". # |
23
|
|
|
|
|
|
|
# # |
24
|
|
|
|
|
|
|
# En contrepartie de l'accessibilité au code source et des droits de copie, # |
25
|
|
|
|
|
|
|
# de modification et de redistribution accordés par cette licence, il n'est # |
26
|
|
|
|
|
|
|
# offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, # |
27
|
|
|
|
|
|
|
# seule une responsabilité restreinte pèse sur l'auteur du programme, le # |
28
|
|
|
|
|
|
|
# titulaire des droits patrimoniaux et les concédants successifs. # |
29
|
|
|
|
|
|
|
# # |
30
|
|
|
|
|
|
|
# À cet égard l'attention de l'utilisateur est attirée sur les risques # |
31
|
|
|
|
|
|
|
# associés au chargement, à l'utilisation, à la modification et/ou au # |
32
|
|
|
|
|
|
|
# développement et à la reproduction du logiciel par l'utilisateur étant # |
33
|
|
|
|
|
|
|
# donné sa spécificité de logiciel libre, qui peut le rendre complexe à # |
34
|
|
|
|
|
|
|
# manipuler et qui le réserve donc à des développeurs et des professionnels # |
35
|
|
|
|
|
|
|
# avertis possédant des connaissances informatiques approfondies. Les # |
36
|
|
|
|
|
|
|
# utilisateurs sont donc invités à charger et tester l'adéquation du # |
37
|
|
|
|
|
|
|
# logiciel à leurs besoins dans des conditions permettant d'assurer la # |
38
|
|
|
|
|
|
|
# sécurité de leurs systêmes et ou de leurs données et, plus généralement, # |
39
|
|
|
|
|
|
|
# à l'utiliser et l'exploiter dans les mêmes conditions de sécurité. # |
40
|
|
|
|
|
|
|
# # |
41
|
|
|
|
|
|
|
# Le fait que vous puissiez accéder à cet en-tête signifie que vous avez # |
42
|
|
|
|
|
|
|
# pris connaissance de la licence CeCILL, et que vous en avez accepté les # |
43
|
|
|
|
|
|
|
# termes. # |
44
|
|
|
|
|
|
|
# # |
45
|
|
|
|
|
|
|
# ------------------------------------------------------------------------- # |
46
|
|
|
|
|
|
|
# # |
47
|
|
|
|
|
|
|
# This file is part of the CracTools which provide several integrated # |
48
|
|
|
|
|
|
|
# pipeline to analyze biological events present in RNA-Seq data. CracTools # |
49
|
|
|
|
|
|
|
# work on a SAM file generated by CRAC and an annotation file in GFF3 format.# |
50
|
|
|
|
|
|
|
# # |
51
|
|
|
|
|
|
|
# This software is governed by the CeCILL license under French law and # |
52
|
|
|
|
|
|
|
# abiding by the rules of distribution of free software. You can use, # |
53
|
|
|
|
|
|
|
# modify and/ or redistribute the software under the terms of the CeCILL # |
54
|
|
|
|
|
|
|
# license as circulated by CEA, CNRS and INRIA at the following URL # |
55
|
|
|
|
|
|
|
# "http://www.cecill.info". # |
56
|
|
|
|
|
|
|
# # |
57
|
|
|
|
|
|
|
# As a counterpart to the access to the source code and rights to copy, # |
58
|
|
|
|
|
|
|
# modify and redistribute granted by the license, users are provided only # |
59
|
|
|
|
|
|
|
# with a limited warranty and the software's author, the holder of the # |
60
|
|
|
|
|
|
|
# economic rights, and the successive licensors have only limited # |
61
|
|
|
|
|
|
|
# liability. # |
62
|
|
|
|
|
|
|
# # |
63
|
|
|
|
|
|
|
# In this respect, the user's attention is drawn to the risks associated # |
64
|
|
|
|
|
|
|
# with loading, using, modifying and/or developing or reproducing the # |
65
|
|
|
|
|
|
|
# software by the user in light of its specific status of free software, # |
66
|
|
|
|
|
|
|
# that may mean that it is complicated to manipulate, and that also # |
67
|
|
|
|
|
|
|
# therefore means that it is reserved for developers and experienced # |
68
|
|
|
|
|
|
|
# professionals having in-depth computer knowledge. Users are therefore # |
69
|
|
|
|
|
|
|
# encouraged to load and test the software's suitability as regards their # |
70
|
|
|
|
|
|
|
# requirements in conditions enabling the security of their systems and/or # |
71
|
|
|
|
|
|
|
# data to be ensured and, more generally, to use and operate it in the same # |
72
|
|
|
|
|
|
|
# conditions as regards security. # |
73
|
|
|
|
|
|
|
# # |
74
|
|
|
|
|
|
|
# The fact that you are presently reading this means that you have had # |
75
|
|
|
|
|
|
|
# knowledge of the CeCILL license and that you accept its terms. # |
76
|
|
|
|
|
|
|
# # |
77
|
|
|
|
|
|
|
############################################################################### |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 NAME |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
CracTools::Utils - A set of useful functions |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
package CracTools::Utils; |
86
|
|
|
|
|
|
|
|
87
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
71
|
|
88
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
210
|
|
89
|
|
|
|
|
|
|
|
90
|
2
|
|
|
2
|
|
9
|
use Carp; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
601
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 reverseComplement |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Arg [1] : String - a DNA sequence |
95
|
|
|
|
|
|
|
Example : $reverse = reverseComplement('ATGC'); |
96
|
|
|
|
|
|
|
Description : Reverse complemente the sequence in argument. |
97
|
|
|
|
|
|
|
For example : reverse_comptement('ATGC') returns : 'GCAT'. |
98
|
|
|
|
|
|
|
ReturnType : String |
99
|
|
|
|
|
|
|
Exceptions : none |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub reverseComplement($) { |
104
|
0
|
|
|
0
|
1
|
|
my $dna = shift; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
# reverse the DNA sequence |
107
|
0
|
|
|
|
|
|
my $revcomp = reverse $dna; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
# complement the reversed DNA sequence |
110
|
0
|
|
|
|
|
|
$revcomp =~ tr/ACGTacgt/TGCAtgca/; |
111
|
0
|
|
|
|
|
|
return $revcomp; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 reverse_tab |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Arg [1] : String - a string with values separated with coma. |
117
|
|
|
|
|
|
|
Example : $reverse = reverse_tab('2,1,1,1,0,0,1'); |
118
|
|
|
|
|
|
|
Description : Reverse the values of the string in argument. |
119
|
|
|
|
|
|
|
For example : reverse_tab('1,2,0,1') returns : '1,0,2,1'. |
120
|
|
|
|
|
|
|
ReturnType : String |
121
|
|
|
|
|
|
|
Exceptions : none |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=cut |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub reverse_tab($) { |
126
|
0
|
|
|
0
|
1
|
|
my $string = shift; |
127
|
0
|
|
|
|
|
|
my @tab = split(/,/,$string); |
128
|
0
|
|
|
|
|
|
my $newString; |
129
|
0
|
0
|
|
|
|
|
if(@tab > 0) { |
130
|
0
|
|
|
|
|
|
for (my $i=$#tab ; $i > 0 ; $i--){ |
131
|
0
|
|
|
|
|
|
$newString .= $tab[$i]; |
132
|
0
|
|
|
|
|
|
$newString .= ","; |
133
|
|
|
|
|
|
|
} |
134
|
0
|
|
|
|
|
|
$newString .= $tab[0]; |
135
|
|
|
|
|
|
|
} |
136
|
0
|
|
|
|
|
|
return $newString; |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
1; |