Mercurial > repos > fgiacomoni > lipidmaps_textsearch
annotate lib/lipidmaps.pm @ 1:adf9ae010b1c draft
planemo upload for repository https://github.com/workflow4metabolomics/tool-bank-lipidmaps.git commit 7028ace57a9bbcefccb40cf4c841ef8a92646e06
author | fgiacomoni |
---|---|
date | Tue, 11 Apr 2017 04:09:58 -0400 |
parents | e8bd49794291 |
children |
rev | line source |
---|---|
0
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
1 package lib::lipidmaps ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
2 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
3 use strict; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
4 use warnings; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
5 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
6 use Data::Dumper; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
7 use Carp ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
8 use LWP::UserAgent ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
9 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
10 use Exporter; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
11 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
12 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
13 $VERSION = "1.0"; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
14 @ISA = qw(Exporter); |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
15 @EXPORT = (); |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
16 @EXPORT_OK = qw(set_total_carbons get_elts_from_lm_common_name); |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
17 %EXPORT_TAGS = ( ALL => [qw(set_total_carbons get_elts_from_lm_common_name)] ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
18 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
19 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
20 =head1 NAME |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
21 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
22 My::operations - An example module |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
23 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
24 =head1 SYNOPSIS |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
25 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
26 use My::operations; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
27 my $object = My::Module->new(); |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
28 print $object->as_string; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
29 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
30 =head1 DESCRIPTION |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
31 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
32 This module clusters several more used maths functions like factorial... |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
33 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
34 =head1 METHODS |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
35 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
36 Methods are : |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
37 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
38 =head2 METHOD new |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
39 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
40 ## Description : new |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
41 ## Input : $self |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
42 ## Ouput : bless $self ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
43 ## Usage : new() ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
44 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
45 =cut |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
46 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
47 sub new { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
48 ## Variables |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
49 my $self={}; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
50 bless($self) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
51 return $self ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
52 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
53 ### END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
54 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
55 =head2 METHOD build_lm_mass_query |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
56 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
57 ## Description : set the query from the lipdmaps WS |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
58 ## Input : $url, $delta, $cat, $cl, $subcl |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
59 ## Output : $query |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
60 ## Usage : my ( $query ) = build_lm_mass_query( $url, $delta, $cat, $cl, $subcl ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
61 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
62 =cut |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
63 ## START of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
64 sub build_lm_mass_query { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
65 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
66 my $self = shift ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
67 my ( $url, $delta, $cat, $cl, $subcl ) = @_ ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
68 my $query = undef ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
69 ## build the REST query like : |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
70 #'http://www.lipidmaps.org/data/structure/LMSDSearch.php? |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
71 #Mode=ProcessTextSearch&OutputMode=File&OutputType=TSV&CoreClass=3&MainClass=303&SubClass=30301&ExactMass=1000.05&ExactMassOffSet=0.5' |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
72 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
73 if ( defined $url ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
74 $query = $$url ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
75 if ( defined $$cat ) { $query.= '&CoreClass='.$$cat ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
76 if ( defined $$cl ) { $query .= '&MainClass='.$$cl ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
77 if ( defined $$subcl ) { $query .= '&SubClass='.$$subcl ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
78 if ( defined $delta ) { $query .= '&ExactMassOffSet='.$$delta ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
79 ## and prepare the mass param : |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
80 $query .= '&ExactMass=' ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
81 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
82 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
83 croak "Can't find any url to buil your query\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
84 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
85 return(\$query) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
86 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
87 ## END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
88 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
89 =head2 METHOD get_lm_mass_query |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
90 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
91 ## Description : get the builded query on LM WS |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
92 ## Input : $query, $mass |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
93 ## Output : $result |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
94 ## Usage : my ( $result ) = get_lm_mass_query( $query, $mass ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
95 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
96 =cut |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
97 ## START of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
98 sub get_lm_mass_query { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
99 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
100 my $self = shift ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
101 my ( $query, $mass ) = @_ ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
102 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
103 my $result = undef ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
104 my $rest_query = $$query.$$mass ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
105 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
106 # print "QUERY_".$rest_query."_STOP\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
107 my $browser = LWP::UserAgent->new; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
108 $result = $browser->get($rest_query) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
109 die "Can't GET the folowing mz query: $rest_query!" if ( ! defined $rest_query ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
110 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
111 if ($result->is_error) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
112 croak "$result->status_line \n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
113 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
114 # else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
115 # print Dumper $result->content ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
116 # } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
117 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
118 return(\$result->content, \$rest_query) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
119 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
120 ## END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
121 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
122 =head2 METHOD get_lm_entry_object |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
123 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
124 ## Description : build a list of lm_entry_objects from a raw result |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
125 ## Input : $result |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
126 ## Output : $entry_objects |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
127 ## Usage : my ( $entry_objects ) = get_lm_entry_object( $result ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
128 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
129 =cut |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
130 ## START of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
131 sub get_lm_entry_object { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
132 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
133 my $self = shift ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
134 my ( $result, $q_mass ) = @_ ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
135 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
136 my @entry_objects = () ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
137 my @sorted = () ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
138 my $nb_entries = 0 ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
139 my $qmass = $$q_mass ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
140 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
141 if ( defined $result ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
142 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
143 # print "RESULTS: $$result\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
144 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
145 my @tmp = split (/\n|\r/, $$result) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
146 my @entries = sort { $a cmp $b } @tmp; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
147 $nb_entries = scalar(@entries) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
148 foreach my $entry (@entries) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
149 my %entry = ( ID => undef, COMMON_NAME => undef, SYST_NAME => undef, FORMULA => undef, MASS => undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
150 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
151 $entry{ID} = $self->get_lm_id(\$entry) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
152 $entry{COMMON_NAME} = $self->get_lm_common_name(\$entry) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
153 $entry{SYST_NAME} = $self->get_lm_systematic_name(\$entry) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
154 $entry{FORMULA} = $self->get_lm_formula(\$entry) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
155 $entry{MASS} = $self->get_lm_mass(\$entry) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
156 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
157 ## delta |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
158 $entry{QMASS} = $qmass ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
159 $entry{DELTA} = $self->delta_mass(\$qmass, $entry{MASS} ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
160 push (@entry_objects, \%entry) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
161 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
162 } ## END IF |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
163 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
164 croak "Can't manage a an empty result and produce a entry object\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
165 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
166 # print Dumper @entry_objects ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
167 ## Sort By ID |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
168 if (scalar (@entry_objects) > 1 ) { ## for |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
169 @sorted = sort { $a->{ID} cmp $b->{ID} } @entry_objects ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
170 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
171 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
172 @sorted = @entry_objects; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
173 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
174 # print Dumper @sorted ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
175 return(\@sorted, \$nb_entries) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
176 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
177 ## END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
178 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
179 =head2 METHOD get_cluster_object |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
180 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
181 ## Description : build a list of clusters objects from a entry_object (list of hash) using a list oh parsing rules decrived in CONF file |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
182 ## Input : $entries_result, $RULES |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
183 ## Output : $clusters_object |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
184 ## Usage : my ( $clusters_object ) = get_cluster_object( $entries_result, $RULES ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
185 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
186 =cut |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
187 ## START of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
188 sub get_cluster_object { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
189 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
190 my $self = shift ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
191 my ( $entries_result, $RULES, $RECIPES ) = @_ ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
192 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
193 my (@pre_clustering) = ( () ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
194 my $clusters_object = undef ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
195 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
196 if ( ( defined $entries_result ) and ( defined $RULES )) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
197 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
198 foreach my $entry (@$entries_result) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
199 my %cluster = ( CLUSTER_DELTA => undef, CLUSTER_NAME => undef, FORMULA => undef, ISOTOPIC_RATIO => undef, NB_ENTRIES_FOR_CLUSTER => 0, ENTRY_IDS => undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
200 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
201 ## get features |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
202 my ($g1,$g2,$g3,$c1,$i1,$c2,$i2,$c3,$i3,$ox,$post) = $self->parse_lm_common_name($entry->{COMMON_NAME}, $RULES, $RECIPES) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
203 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
204 my ( $total_c ) = $self->set_total_carbons($c1, $c2, $c3) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
205 my ( $total_i ) = $self->set_total_insaturations($i1, $i2, $i3) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
206 my ( $group ) = $self->set_group($g1, $g2, $g3) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
207 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
208 ## set cluster object |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
209 $cluster{CLUSTER_NAME} = $self->set_cluster_name($group, $total_c, $total_i, \$ox, \$post, $entry->{COMMON_NAME} ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
210 $entry->{CLUSTER_NAME} = $cluster{CLUSTER_NAME} ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
211 $cluster{CLUSTER_DELTA} = $entry->{DELTA} ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
212 $cluster{FORMULA} = $entry->{FORMULA} ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
213 $cluster{ISOTOPIC_RATIO} = 'N/A' ; ## compute isotopic ratio |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
214 $cluster{NB_ENTRIES_FOR_CLUSTER} = 1 ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
215 $cluster{ENTRY_IDS} = $entry->{ID} ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
216 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
217 push (@pre_clustering, \%cluster) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
218 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
219 ## Pool cluster objects by cluster name |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
220 $clusters_object = $self->pool_cluster_objects(\@pre_clustering) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
221 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
222 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
223 croak "Can't manage a an empty entries result and produce a cluster object\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
224 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
225 return($clusters_object) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
226 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
227 ## END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
228 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
229 =head2 METHOD get_lm_id |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
230 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
231 ## Description : retrieve the following param in the formatted output |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
232 ## Input : $content |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
233 ## Output : $LM_id |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
234 ## Usage : my ( $LM_id ) = get_lm_id( $separator, $content ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
235 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
236 =cut |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
237 ## START of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
238 sub get_lm_id { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
239 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
240 my $self = shift ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
241 my ( $content ) = @_ ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
242 my $LM_id = undef ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
243 my $entry = ${$content} ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
244 if ( $entry =~ /^LM[A-Z](.*)/ ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
245 ##$1=LM_ID $2=COMMON_NAME $3=SYSTEMATIC_NAME $4=FORMULA $5=MASS $6=CATEGORY $7=MAIN_CLASS $8=SUB_CLASS |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
246 if ( $entry =~ /^(\w+)\t(.*)/ ) { $LM_id = $1 ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
247 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
248 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
249 carp "The submitted entry is not at the right format : $entry\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
250 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
251 return(\$LM_id) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
252 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
253 ## END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
254 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
255 =head2 METHOD get_lm_common_name |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
256 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
257 ## Description : retrieve the following param in the formatted output |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
258 ## Input : $content |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
259 ## Output : $common_name |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
260 ## Usage : my ( $common_name ) = get_lm_common_name( $separator, $content ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
261 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
262 =cut |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
263 ## START of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
264 sub get_lm_common_name { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
265 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
266 my $self = shift ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
267 my ( $content ) = @_ ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
268 my $common_name = undef ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
269 my $entry = ${$content} ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
270 if ( $entry =~ /^LM[A-Z](.*)/ ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
271 ##$1=LM_ID $2=COMMON_NAME $3=SYSTEMATIC_NAME $4=FORMULA $5=MASS $6=CATEGORY $7=MAIN_CLASS $8=SUB_CLASS |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
272 if ( $entry =~ /^(\w+)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)/ ) { $common_name = $2 ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
273 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
274 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
275 carp "The submitted entry is not at the right format : $entry\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
276 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
277 return(\$common_name) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
278 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
279 ## END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
280 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
281 =head2 METHOD get_lm_systematic_name |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
282 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
283 ## Description : retrieve the following param in the formatted output |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
284 ## Input : $separator, $content |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
285 ## Output : $common_name |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
286 ## Usage : my ( $common_name ) = get_lm_systematic_name( $separator, $content ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
287 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
288 =cut |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
289 ## START of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
290 sub get_lm_systematic_name { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
291 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
292 my $self = shift ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
293 my ( $content ) = @_ ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
294 my $systematic_name = undef ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
295 my $entry = ${$content} ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
296 if ( $entry =~ /^LM[A-Z](.*)/ ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
297 ##$1=LM_ID $2=COMMON_NAME $3=SYSTEMATIC_NAME $4=FORMULA $5=MASS $6=CATEGORY $7=MAIN_CLASS $8=SUB_CLASS |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
298 if ( $entry =~ /^(\w+)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)/ ) { $systematic_name = $3 ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
299 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
300 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
301 carp "The submitted entry is not at the right format : $entry\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
302 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
303 return(\$systematic_name) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
304 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
305 ## END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
306 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
307 =head2 METHOD get_lm_formula |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
308 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
309 ## Description : retrieve the following param $formula in the formatted output |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
310 ## Input : $content |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
311 ## Output : $formula |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
312 ## Usage : my ( $formula ) = get_lm_systematic_name( $separator, $content ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
313 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
314 =cut |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
315 ## START of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
316 sub get_lm_formula { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
317 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
318 my $self = shift ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
319 my ( $content ) = @_ ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
320 my $formula = undef ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
321 my $entry = ${$content} ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
322 if ( $entry =~ /^LM[A-Z](.*)/ ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
323 ##$1=LM_ID $2=COMMON_NAME $3=SYSTEMATIC_NAME $4=FORMULA $5=MASS $6=CATEGORY $7=MAIN_CLASS $8=SUB_CLASS |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
324 if ( $entry =~ /^(\w+)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)/ ) { $formula = $4 ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
325 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
326 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
327 carp "The submitted entry is not at the right format : $entry\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
328 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
329 return(\$formula) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
330 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
331 ## END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
332 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
333 =head2 METHOD get_lm_mass |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
334 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
335 ## Description : retrieve the following param $mass in the formatted output |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
336 ## Input : $content |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
337 ## Output : $mass |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
338 ## Usage : my ( $mass ) = get_lm_mass( $separator, $content ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
339 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
340 =cut |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
341 ## START of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
342 sub get_lm_mass { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
343 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
344 my $self = shift ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
345 my ( $content ) = @_ ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
346 my $mass = undef ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
347 my $entry = ${$content} ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
348 if ( $entry =~ /^LM[A-Z](.*)/ ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
349 ##$1=LM_ID $2=COMMON_NAME $3=SYSTEMATIC_NAME $4=FORMULA $5=MASS $6=CATEGORY $7=MAIN_CLASS $8=SUB_CLASS |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
350 if ( $entry =~ /^(\w+)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)/ ) { $mass = $5 ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
351 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
352 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
353 carp "The submitted entry is not at the right format : $entry\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
354 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
355 return(\$mass) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
356 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
357 ## END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
358 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
359 =head2 METHOD delta_mass |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
360 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
361 ## Description : compute a delta between the query mass and cpd mass |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
362 ## Input : $q_mass, $cpd_mass |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
363 ## Output : $delta_mass |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
364 ## Usage : my ( $delta_mass ) = delta_mass( $q_mass, $cpd_mass ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
365 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
366 =cut |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
367 ## START of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
368 sub delta_mass { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
369 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
370 my $self = shift ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
371 my ( $q_mass, $cpd_mass ) = @_ ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
372 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
373 my $delta_mass = 0 ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
374 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
375 if ( ( defined $$q_mass ) and ( defined $$cpd_mass ) and ( $$q_mass > 0 ) and ( $$cpd_mass > 0 ) ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
376 my $delta = $$cpd_mass - $$q_mass; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
377 $delta_mass = sprintf("%.2f", $delta ); |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
378 } ## END IF |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
379 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
380 croak "Provided masses are not defined or equal to zero\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
381 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
382 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
383 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
384 return(\$delta_mass) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
385 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
386 ## END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
387 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
388 =head2 METHOD get_elts_from_lm_common_name |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
389 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
390 ## Description : get group, numbers of carbons, insaturation and oxydations in LM common name and return a 'cluster' name. |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
391 ## Input : $lm_common_name, $RULES, $RECIPES |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
392 ## Output : $Gp1, $Gp2, $Gp3, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ch3_C, $Ch3_i, $Ox, $Post |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
393 ## Usage : my ( $Gp1, $Gp2, $Gp3, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ch3_C, $Ch3_i, $Ox, $Post ) = get_elts_from_lm_common_name( $lm_common_name, $RULES, $RECIPES ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
394 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
395 =cut |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
396 ## START of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
397 sub parse_lm_common_name { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
398 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
399 my $self = shift ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
400 my ( $lm_common_name, $RULES, $RECIPES ) = @_ ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
401 my ( $Gp1, $Gp2, $Gp3, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ch3_C, $Ch3_i, $Ox, $Post ) = ( undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
402 my $rule_nb = 0 ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
403 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
404 my $common_name = $$lm_common_name ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
405 if (defined $common_name) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
406 if( $common_name =~ /\s/ ) { $common_name =~ s/ //g ; } ## del all spaces |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
407 my @matches = (undef) ; # init first position at undef to manage undef regex |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
408 my %matching_res = () ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
409 ## Goals : |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
410 ## - use each parsing rule on the common name |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
411 ## - extrat the 9 values containing in the common name (value can be undef) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
412 ## - translate initialized $Gp1, $Gp2, $Gp3, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ch3_C, $Ch3_i, $Ox, $Post values by real ones (ex; 0 => PE, or 0-1-4 => PS-O-P) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
413 # print "\n\nCOMMON_NAME=".$common_name."\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
414 foreach my $rule (keys %{$RULES} ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
415 $rule =~ m/^RULE(\d+)/ ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
416 $rule_nb = $1 ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
417 push ( @matches, ($common_name =~ m/$RULES->{$rule}/g) ) ; # catch all matches in the regex |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
418 # print "\nUsing - RULE -> $rule_nb\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
419 # print Dumper @matches ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
420 # print "\n- - - - - - - - - - - - - \n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
421 my ($v1, $v2, $v3, $v4, $v5, $v6, $v7, $v8, $v9, $v10, $v11 ) = split(/,/, $RECIPES->{'RECIPE'.$rule_nb}) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
422 # print "($v1, $v2, $v3, $v4, $v5, $v6, $v7, $v8, $v9, $v10, $v11 )\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
423 ( $Gp1, $Gp2, $Gp3 ) = ( $matches[$v1], $matches[$v2], $matches[$v3] ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
424 ( $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ch3_C, $Ch3_i ) = ( $matches[$v4], $matches[$v5], $matches[$v6], $matches[$v7], $matches[$v8], $matches[$v9] ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
425 ( $Ox, $Post ) = ( $matches[$v10], $matches[$v11] ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
426 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
427 # if (scalar (@matches) > 1) { last ; } # get out of the loop |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
428 ## Add a method to manage several rules matching |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
429 $matching_res{$rule} = [$Gp1, $Gp2, $Gp3, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ch3_C, $Ch3_i, $Ox, $Post] ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
430 ( $Gp1, $Gp2, $Gp3, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ch3_C, $Ch3_i, $Ox, $Post ) = ( undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
431 ($v1, $v2, $v3, $v4, $v5, $v6, $v7, $v8, $v9, $v10, $v11 ) = ( undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
432 @matches = (undef) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
433 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
434 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
435 ## foreach parsed rules - get the best |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
436 my $best_rule_is = undef ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
437 my ( $current_nb, $best_nb) = ( 0, 0 ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
438 foreach my $rule_nb (keys %matching_res) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
439 $current_nb = scalar grep { defined $_ } @{$matching_res{$rule_nb}}; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
440 if ( $current_nb > $best_nb ) { $best_nb = $current_nb ; $best_rule_is = $rule_nb ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
441 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
442 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
443 if ( defined $best_rule_is ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
444 # print "The best rule is : $best_rule_is\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
445 my @tmp = @{$matching_res{$best_rule_is}} ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
446 # print Dumper @tmp ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
447 ( $Gp1, $Gp2, $Gp3, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ch3_C, $Ch3_i, $Ox, $Post ) = ( $tmp[0], $tmp[1], $tmp[2], $tmp[3], $tmp[4], $tmp[5], $tmp[6], $tmp[7], $tmp[8], $tmp[9], $tmp[10] ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
448 # print "$Gp1, $Gp2, $Gp3, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ch3_C, $Ch3_i, $Ox, $Post\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
449 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
450 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
451 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
452 croak "No Common name to get in method get_elts_from_lm_common_name!\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
453 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
454 return( $Gp1, $Gp2, $Gp3, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ch3_C, $Ch3_i, $Ox, $Post) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
455 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
456 ## END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
457 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
458 =head2 METHOD set_total_carbons |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
459 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
460 ## Description : compute total number of carbons found in entry |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
461 ## Input : $Ch1_C, $Ch2_C, $Ch3_C |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
462 ## Output : $total_C |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
463 ## Usage : my ( $total_C ) = set_total_carbons( $Ch1_C, $Ch2_C, $Ch3_C ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
464 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
465 =cut |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
466 ## START of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
467 sub set_total_carbons { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
468 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
469 my $self = shift ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
470 my ( $Ch1_C, $Ch2_C, $Ch3_C ) = @_ ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
471 my $total_C = undef ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
472 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
473 if ( ( defined $Ch1_C ) and ( defined $Ch2_C ) and ( defined $Ch3_C ) ) { $total_C = ( $Ch1_C + $Ch2_C + $Ch3_C ) ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
474 elsif ( ( defined $Ch1_C ) and ( defined $Ch2_C ) ) { $total_C = ( $Ch1_C + $Ch2_C ) ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
475 elsif ( ( defined $Ch1_C ) ) { $total_C = ( $Ch1_C ) ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
476 else { ( $total_C ) = ( undef ) ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
477 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
478 return(\$total_C) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
479 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
480 ## END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
481 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
482 =head2 METHOD set_total_insaturations |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
483 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
484 ## Description : compute total number of insaturations found in entry |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
485 ## Input : $Ch1_i, $Ch2_i, $Ch3_i |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
486 ## Output : $total_i |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
487 ## Usage : my ( $total_i ) = set_total_insaturations( $Ch1_i, $Ch2_i, $Ch3_i ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
488 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
489 =cut |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
490 ## START of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
491 sub set_total_insaturations { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
492 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
493 my $self = shift ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
494 my ( $Ch1_i, $Ch2_i, $Ch3_i ) = @_ ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
495 my $total_i = undef ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
496 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
497 if ( ( defined $Ch1_i ) and ( defined $Ch2_i ) and ( defined $Ch3_i ) ) { $total_i = ( $Ch1_i + $Ch2_i + $Ch3_i ) ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
498 elsif ( ( defined $Ch1_i ) and ( defined $Ch2_i ) ) { $total_i = ( $Ch1_i + $Ch2_i ) ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
499 elsif ( ( defined $Ch1_i ) ) { $total_i = ( $Ch1_i ) ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
500 else { ( $total_i ) = ( undef ) ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
501 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
502 return(\$total_i) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
503 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
504 ## END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
505 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
506 =head2 METHOD set_group |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
507 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
508 ## Description : set a complete group when multiple |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
509 ## Input : $Gp1, $Gp2, $Gp3 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
510 ## Output : $group |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
511 ## Usage : my ( $group ) = set_group( $Gp1, $Gp2, $Gp3 ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
512 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
513 =cut |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
514 ## START of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
515 sub set_group { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
516 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
517 my $self = shift ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
518 my ( $Gp1, $Gp2, $Gp3 ) = @_ ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
519 my $group = undef ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
520 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
521 if ( ( defined $Gp1 ) and ( defined $Gp2 ) and ( defined $Gp3 ) ) { $group = $Gp1.'-'.$Gp2.'-'.$Gp3 ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
522 elsif ( ( defined $Gp1 ) and ( defined $Gp2 ) ) { $group = $Gp1.'-'.$Gp2 ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
523 elsif ( ( defined $Gp1 ) ) { $group = $Gp1 ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
524 else { $group = undef ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
525 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
526 return(\$group) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
527 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
528 ## END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
529 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
530 =head2 METHOD set_cluster_name |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
531 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
532 ## Description : set the cluster name by concat $group / $total_c / $total_i / $ox / $post or use $common_name if no elt exist. |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
533 ## Input : $group, $total_c, $total_i, $ox, $post, $common_name |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
534 ## Output : $cluster_name |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
535 ## Usage : my ( $cluster_name ) = set_cluster_name( $group, $total_c, $total_i, $ox, $post ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
536 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
537 =cut |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
538 ## START of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
539 sub set_cluster_name { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
540 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
541 my $self = shift ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
542 my ( $group, $total_c, $total_i, $ox, $post, $common_name ) = @_ ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
543 my $cluster_name = undef ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
544 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
545 if ( ( defined $$total_c ) and ( defined $$total_i ) and ( defined $$group ) ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
546 $cluster_name = $$group.'_'.$$total_c.':'.$$total_i ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
547 ## OXIDATION AND REST |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
548 if ( defined $$ox ) { $cluster_name = $cluster_name.'('.$$ox.')' ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
549 if ( defined $$post ) { $cluster_name = $cluster_name.$$post ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
550 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
551 elsif ( ( defined $$group ) ) { $cluster_name = $$group ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
552 else { $cluster_name = $$common_name ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
553 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
554 return(\$cluster_name) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
555 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
556 ## END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
557 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
558 =head2 METHOD pool_cluster_objects |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
559 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
560 ## Description : pool all cluster objects in a same group by their cluster name (and formula) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
561 ## Input : $cluster_objects |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
562 ## Output : $pool_objects |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
563 ## Usage : my ( $pool_objects ) = pool_cluster_objects( $cluster_objects ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
564 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
565 =cut |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
566 ## START of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
567 sub pool_cluster_objects { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
568 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
569 my $self = shift ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
570 my ( $cluster_objects ) = @_ ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
571 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
572 my @pools = () ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
573 my %sort = () ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
574 my @deltas = () ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
575 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
576 # prerequis for the first iteration |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
577 my $ref_common_name = 'NONE' ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
578 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
579 # sort entries by cluster with a key hash system |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
580 foreach my $object (@{$cluster_objects}) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
581 my %current = %{$object} ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
582 my $q_name = $current{CLUSTER_NAME} ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
583 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
584 ## prepare data |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
585 if ( !defined $sort{$$q_name}{ENTRY_IDS} ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
586 $sort{$$q_name}{ENTRY_IDS} = [] ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
587 $sort{$$q_name}{ENTRY_DELTAS} = [] ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
588 $sort{$$q_name}{NB_ENTRIES_FOR_CLUSTER} = 1 ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
589 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
590 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
591 $sort{$$q_name}{NB_ENTRIES_FOR_CLUSTER} = ($sort{$$q_name}{NB_ENTRIES_FOR_CLUSTER}) + 1 ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
592 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
593 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
594 ## pool |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
595 if ( $$q_name ne $ref_common_name ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
596 $sort{$$q_name}{CLUSTER_NAME} = $q_name ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
597 push ( @{ $sort{$$q_name}{ENTRY_IDS} }, $current{ENTRY_IDS} ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
598 push ( @{ $sort{$$q_name}{ENTRY_DELTAS} }, $current{CLUSTER_DELTA} ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
599 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
600 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
601 push ( @{ $sort{$$q_name}{ENTRY_IDS} }, $current{ENTRY_IDS} ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
602 push ( @{ $sort{$$q_name}{ENTRY_DELTAS} }, $current{CLUSTER_DELTA} ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
603 next ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
604 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
605 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
606 ## set rest of features |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
607 $sort{$$q_name}{FORMULA} = $current{FORMULA} ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
608 $sort{$$q_name}{ISOTOPIC_RATIO} = $current{ISOTOPIC_RATIO} ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
609 # $sort{$$q_name}{CLUSTER_DELTA} = $current{CLUSTER_DELTA} ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
610 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
611 $ref_common_name = $$q_name ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
612 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
613 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
614 # and pool them |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
615 foreach ( keys %sort ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
616 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
617 ## sort IDS |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
618 my @tmp = @{ $sort{$_}{ENTRY_IDS} } ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
619 my @tmp_unref = () ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
620 my @sort_unref = () ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
621 my @sort_ref = () ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
622 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
623 foreach (@tmp) { my $id = $$_ ; push (@tmp_unref, $id) ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
624 @sort_unref = sort { $a cmp $b } @tmp_unref ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
625 foreach (@sort_unref) { my $id = $_ ; push (@sort_ref, \$id) ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
626 $sort{$_}{ENTRY_IDS} = \@sort_ref ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
627 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
628 ## sort delta and init the smallest for the cluster |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
629 my @tmp_deltas = @{ $sort{$_}{ENTRY_DELTAS} } ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
630 my @tmp_delta_sorted = () ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
631 @tmp_delta_sorted = sort { $a <=> $b } @tmp_deltas ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
632 $sort{$_}{CLUSTER_DELTA} = $tmp_delta_sorted[0] ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
633 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
634 ## get all |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
635 push (@pools, $sort{$_}) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
636 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
637 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
638 ## sort by nb of entries in the cluster |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
639 my @pool_sorted = sort { $b->{NB_ENTRIES_FOR_CLUSTER} <=> $a->{NB_ENTRIES_FOR_CLUSTER} } @pools ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
640 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
641 return(\@pool_sorted) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
642 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
643 ## END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
644 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
645 ## Fonction : permet de retourner une somme de features pour un common name |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
646 ## Input : $CommonName de type LM |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
647 ## Ouput : $SimpleName |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
648 sub getSimpleNameFromCommonName { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
649 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
650 my ( $CommonName ) = @_; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
651 my $SimpleName = undef ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
652 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
653 if (defined $CommonName) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
654 ## virer les espaces : |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
655 if($CommonName =~ /\s/) { $CommonName =~ s/ //g ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
656 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
657 ## Initialize all |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
658 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
659 my ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ch3_C, $Ch3_i, $Ox, $Post ) = ( undef, undef, undef, undef, undef, undef, undef, undef, undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
660 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
661 if ( $CommonName =~/^\-$/) { ## RULE des '-' only |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
662 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox ) = ( 'UnNamed_IN_LM', undef, undef, undef, undef, undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
663 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
664 ## *** *** PG *** *** ## |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
665 elsif ($CommonName =~/^([A-Z|a-z|0-9|\-]*)$/) { ## RULE des XX-xx only -- Ex: PE-NMe2 ou PC |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
666 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox ) = ( $1, undef, undef, undef, undef, undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
667 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
668 elsif ( $CommonName =~/^([A-Z|a-z]{2,4})\((\d+):(\d+)\/(\d+):(\d+)\)$/) { ## RULE des XX(16:1/16:1) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
669 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox ) = ( $1, $2, $3, $4, $5, undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
670 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
671 elsif ( $CommonName =~/^([A-Z|a-z]{2,4})\((\d+):(\d+)\/(\d+):(\d+)\(([OHC]*)\)\)$/) { ## RULE des XX(16:1/16:1(OHC)) OXYDES!! |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
672 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox ) = ( $1, $2, $3, $4, $5, $6 ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
673 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
674 elsif ( $CommonName =~/^([A-Z|a-z]{2,4})\((\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\/(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\(([OHCKe0-9]*)\)\)$/) { ## RULE des XX(16:1(1Z,..)/16:1(1Z,..)(OHC)) OXYDES!! -- Ex: PE(16:0/22:6(54Z,7Z,10Z,12E,16Z,19Z)(14OH)) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
675 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox ) = ( $1, $2, $3, $4, $5, $6 ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
676 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
677 elsif ( $CommonName =~/^([A-Z|a-z]{2,4})\((\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\/(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\)$/) { ## RULE des XX(16:1(1Z,..)/16:1(1Z,..)) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
678 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox ) = ( $1, $2, $3, $4, $5, undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
679 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
680 elsif ( $CommonName =~/^([A-Z|a-z]{2,5})\((\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\)$/) { ## RULE des XX(16:1(1Z,...)) ou XX(16:1) ONLY |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
681 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox ) = ( $1, $2, $3, undef, undef, undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
682 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
683 elsif ( $CommonName =~/^([A-Z|a-z]{2,4})\(([A-Z]{1})-(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\/(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\)$/) { ## RULE des XX(X-16:1(1Z,..)/16:1(1Z,..)) avec (1Z,...) en option |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
684 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox ) = ( $1.'-'.$2, $3, $4, $5, $6, undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
685 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
686 elsif ( $CommonName =~/^([A-Z|a-z]{2,4})\((\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\/([A-Z]{1})-(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\)$/) { ## RULE des XX(16:1(1Z,..)/X-16:1(1Z,..)) avec (1Z,...) en option |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
687 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox ) = ( $1.'-'.$4, $2, $3, $5, $6, undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
688 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
689 elsif ( $CommonName =~/^([A-Z|a-z]{2,4})\(([A-Z]{1})-(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\/([A-Z]{1})-(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\)$/) { ## RULE des XX(X-16:1(1Z,..)/X-16:1(1Z,..)) avec (1Z,...) en option |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
690 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox ) = ( $1.'-'.$2.'-'.$5, $3, $4, $6, $7, undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
691 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
692 elsif ( $CommonName =~/^([A-Z|a-z]*-[A-Z|a-z|0-9]*)\((\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\/(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\)$/) { ## RULE des XX-xx(16:1(1Z,..)/16:1(1Z,..)) -- Ex: PE-NMe(16:0/16:0) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
693 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox ) = ( $1, $2, $3, $4, $5, undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
694 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
695 elsif ( $CommonName =~/^([A-Z|a-z]*-[A-Z|a-z|0-9]*)\(([A-Z]{1})-(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\/([A-Z]{1})-(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\)$/) { ## RULE des XX-xx(X-16:1(1Z,..)/X-16:1(1Z,..)) -- Ex: PE-NMe(O-16:0/O-16:0) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
696 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox ) = ( $1.'-'.$2.'-'.$5, $3, $4, $6, $7, undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
697 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
698 elsif ( $CommonName =~/^([a-z|A-Z|\-]*)\((\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\/(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\/(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\)$/) { ## RULE des XX-xx(16:1(1Z,)/16:1(1Z,)/16:1(1Z,...)) -- Ex: PS-NAc(18:0/18:1(9Z)/16:0) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
699 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ch3_C, $Ch3_i, $Ox ) = ( $1, $2, $3, $4, $5, $6, $7, undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
700 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
701 elsif ( $CommonName =~/^([A-Z|a-z]{2,4})\((\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\/(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\)(\[[A-Z|a-z|0-9]*\])$/) { ## RULE des XX(16:1(1Z,..)/16:1(1Z,..))[Xx] -- Ex : PC(18:1(9Z)/0:0)[rac] |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
702 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox, $Post ) = ( $1, $2, $3, $4, $5, undef, $6 ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
703 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
704 elsif ( $CommonName =~/^([A-Z|a-z]{2,4})\((\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\/(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\)\(([A-Z|a-z|0-9|\[\]]*)\)\)$/) { ## RULE des XX(16:1(1Z,..)/16:1(1Z,..))(OHC[S]) -- Ex: PE(16:0/20:4(5Z,8Z,10E,14Z)(12OH[S])) OXYDES!! |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
705 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox ) = ( $1, $2, $3, $4, $5, $6 ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
706 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
707 elsif ( $CommonName =~/^([A-Z|a-z]{2,4})\(([A-Z]{1})-(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\/(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\)\(([A-Z|a-z|0-9|\[\]]*)\)\)$/) { ## RULE des XX(X-16:1(1Z,..)/16:1(1Z,..))(OHC[S]) -- Ex: PE(P-18:0/20:4(6E,8Z,11Z,14Z)(5OH[S])) OXYDES!! |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
708 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox ) = ( $1.'-'.$2, $3, $4, $5, $6, $7 ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
709 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
710 elsif ( $CommonName =~/^([A-Z|a-z|0-9|\[\]|',]*)\((\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\/(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\)$/) { ## RULE des XX[3',5'](16:1(1Z,..)/16:1(1Z,..)) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
711 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox ) = ( $1, $2, $3, $4, $5, undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
712 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
713 ## *** *** *** *** SM *** *** *** *** ## |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
714 elsif ( $CommonName =~ /^([A-Za-z0-9\-]*)\([a-z](\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\/(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\(([COH0-9\-]*)\)\)$/ ) { ## RULE des xx-XX(16:1(1z..)/16:0(1z..)(OH)) -- Ex: PE-Cer(d16:2(4E,6E)/24:1(15Z)(2OH)) OXYDES !! |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
715 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox ) = ( $1, $2, $3, $4, $5, $6 ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
716 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
717 elsif ( $CommonName =~ /^([A-Za-z0-9\-]*)\([a-z]{0,1}(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\/[a-z]{0,1}(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\)$/ ) { ## RULE des xx-XX(16:1(1z..)/16:0(1z..)) -- Ex: GlcCer(d14:2(4E,6E)/18:1(9Z)) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
718 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox ) = ( $1, $2, $3, $4, $5, undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
719 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
720 elsif ( $CommonName =~ /^(M\(IP\)2C)\([a-z]{0,1}(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\/[a-z]{0,1}(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\(([COH0-9\-]*)\)\)$/ ) { ## RULE des M(IP)2C(16:1(1z..)/16:0(1z..)) -- Ex: M(IP)2C(d18:0/18:0(2OH)) OXYDES !! |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
721 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox ) = ( $1, $2, $3, $4, $5, $6 ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
722 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
723 elsif ( $CommonName =~ /^(M\(IP\)2C)\([a-z]{0,1}(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\/[a-z]{0,1}(\d+):(\d+)[A-Z|a-z|0-9|,|\(\)]*\)$/ ) { ## RULE des M(IP)2C(16:1(1z..)/16:0(1z..)) -- Ex: M(IP)2C(t18:0/18:0) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
724 ( $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ox ) = ( $1, $2, $3, $4, $5, undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
725 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
726 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
727 print "-->Cpd not parsed: ".$CommonName."\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
728 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
729 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
730 ## Set SimpleName : |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
731 $SimpleName = &setSimpleName($CommonName, $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ch3_C, $Ch3_i, $Ox, $Post) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
732 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
733 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
734 croak "No Common name to get in method getSimpleNameFromCommonName!\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
735 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
736 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
737 return($SimpleName) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
738 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
739 ### END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
740 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
741 ## Fonction : permet de reconstruire un nom simple a partir de donnees |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
742 ## Input : $CommonName, $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ch3_C, $Ch3_i, $Ox, $Post |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
743 ## Ouput : $SimpleName |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
744 sub setSimpleName { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
745 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
746 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
747 my ( $CommonName, $Group, $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i, $Ch3_C, $Ch3_i, $Ox, $Post ) = @_; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
748 my ( $cTotal, $iTotal ) = ( undef, undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
749 my $SimpleName = undef ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
750 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
751 ### COMON NAME TO SIMPLE NAME !! |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
752 if ( defined $Group ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
753 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
754 ## SOMME DES CARBONES ET INSATURATIONS |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
755 if ( ( defined $Ch1_C ) and ( defined $Ch1_i ) and ( defined $Ch2_C ) and ( defined $Ch2_i ) and ( defined $Ch3_C ) and ( defined $Ch3_i ) ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
756 $cTotal = ( $Ch1_C + $Ch2_C + $Ch3_C ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
757 $iTotal = ( $Ch1_i + $Ch2_i + $Ch3_i ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
758 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
759 elsif ( ( defined $Ch1_C ) and ( defined $Ch1_i ) and ( defined $Ch2_C ) and ( defined $Ch2_i ) ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
760 $cTotal = ( $Ch1_C + $Ch2_C ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
761 $iTotal = ( $Ch1_i + $Ch2_i ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
762 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
763 elsif ( ( defined $Ch1_C ) and ( defined $Ch1_i ) ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
764 $cTotal = ( $Ch1_C ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
765 $iTotal = ( $Ch1_i ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
766 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
767 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
768 ( $cTotal, $iTotal ) = ( undef, undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
769 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
770 ## Composition du NOM |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
771 if ( ( defined $cTotal ) and ( defined $iTotal ) ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
772 $SimpleName = $Group.'_'.$cTotal.':'.$iTotal ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
773 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
774 ## OXIDATION AND REST |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
775 if ( defined $Ox ) { $SimpleName = $SimpleName.'('.$Ox.')' ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
776 if ( defined $Post ) { $SimpleName = $SimpleName.$Post ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
777 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
778 else { $SimpleName = $Group ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
779 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
780 else { $SimpleName = $CommonName ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
781 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
782 return($SimpleName) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
783 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
784 ### END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
785 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
786 ## Fonction : permet de retourner une somme de features pour un common name |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
787 ## Input : $CommonName de type LM |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
788 ## Ouput : $Groupe, $Familly, $cTotal, $iTotal |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
789 sub getSimpleCommonName_Old { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
790 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
791 my ( $CommonName ) = @_; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
792 my ($Groupe, $Familly, $cTotal, $iTotal, $Reste, $Ox ) = ( undef, undef, undef, undef, undef, undef, undef ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
793 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
794 if ( $CommonName =~/([A-Za-z|0-9|\-]*)\((.*)\)$/ ) { #" Attention Common name conteint parfois des espaces en debut" |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
795 ## retrieve $Familly and $Reste |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
796 ( $Familly, $Reste, $Groupe) = ( $1, $2, '' ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
797 my ( $Ch1_C, $Ch2_C, $Ch1_i, $Ch2_i ) = ( 0, 0, 0, 0 ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
798 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
799 ## Gestion du "Groupe" et des carbones / insatures |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
800 if ( $Reste =~/^([A-Z|a-z])\-(\d+):(\d+)[A-Z0-9,\(\)]*\/(\d+):(\d+)[A-Z0-9,\(\)]*/ ) { ## rule (X|x-16:1/16:1) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
801 $Groupe = $Familly.'-'.$1 ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
802 ( $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i ) = ( $2, $3, $4, $5 ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
803 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
804 elsif ( $Reste =~/^([A-Z|a-z])\-(\d+):(\d+)[A-Z0-9,\(\)]*\/([A-Z|a-z])\-(\d+):(\d+)[A-Z0-9,\(\)]*/ ) { ## rule (X|x-16:1/X|x-16:1) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
805 $Groupe = $Familly.'-'.$1.$4 ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
806 ( $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i ) = ( $2, $3, $5, $6 ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
807 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
808 elsif ( $Reste =~/^(\d+):(\d+)[A-Z0-9,\(\)]*\/([A-Z|a-z])\-(\d+):(\d+)[A-Z0-9,\(\)]*/ ) { ## rule (16:1/X|x-16:1) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
809 $Groupe = $Familly.'-'.$3 ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
810 ( $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i ) = ( $1, $2, $4, $5 ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
811 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
812 # elsif ( $Reste =~/(\d+):(\d+)[A-Z0-9,\(\)]*\/(\d+):(\d+)\([A-Z0-9,\(\)]*$/ ) { ## rule (16:1/16:1) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
813 elsif ( $Reste =~/(\d+):(\d+)\/(\d+):(\d+)$/ ) { ## rule (16:1/16:1) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
814 $Groupe = $Familly ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
815 ( $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i ) = ( $1, $2, $3, $4 ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
816 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
817 elsif ( $Reste =~/^([A-Z|a-z])(\d+):(\d+)[A-Z0-9,\(\)]*\/(\d+):(\d+)[A-Z0-9,\(\)]*/ ) { ## rule (X|x16:1/16:1) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
818 $Groupe = $Familly.'-'.$1 ; ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
819 ( $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i ) = ( $2, $3, $4, $5 ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
820 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
821 elsif ( $Reste =~/^(\d+):(\d+)[A-Z0-9,\(\)]*\/([A-Z|a-z])(\d+):(\d+)[A-Z0-9,\(\)]*/ ) { ## rule (16:1/X|x16:1) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
822 $Groupe = $Familly.'-'.$3 ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
823 ( $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i ) = ( $1, $2, $4, $5 ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
824 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
825 elsif ( $Reste =~/^([A-Z|a-z])(\d+):(\d+)[A-Z0-9,\(\)]*\/([A-Z|a-z])(\d+):(\d+)[A-Z0-9,\(\)]*/ ) { ## rule (X|x16:1/X|x16:1) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
826 $Groupe = $Familly.'-'.$1.$4 ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
827 ( $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i ) = ( $2, $3, $5, $6 ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
828 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
829 ## Cas des Oxydes ([320]) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
830 elsif ( $Reste =~/^(\d+):(\d+)[A-Z0-9,\(\)]*\/(\d+):(\d+)[A-Z0-9,\(\)]*\(([A-Z|a-z|0-9|\[\]]*)\)/ ) { ## rule (16:1/16:1)(xOH[S]) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
831 $Groupe = $Familly.'-'.$1 ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
832 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
833 $Ox = $5 ; ## for Ox gpt |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
834 print "$Ox\n\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
835 ( $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i ) = ( $1, $2, $3, $4 ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
836 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
837 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
838 carp "This reste ($Reste) is unknown in actual parsing rules\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
839 $Groupe = $CommonName ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
840 ( $Ch1_C, $Ch1_i, $Ch2_C, $Ch2_i ) = ( 0, 0, 0, 0 ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
841 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
842 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
843 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
844 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
845 ## End of parsing "Gestion du "Groupe" et des carbones / insatures" |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
846 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
847 ## Sum Carbones and insaturates |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
848 if ( ( defined $Ch1_C ) and ( defined $Ch1_i ) and ( defined $Ch2_C ) and ( defined $Ch2_i ) ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
849 if ( ( $Ch1_C+$Ch2_C ) < ( $Ch1_i+$Ch2_i ) ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
850 warn "Number of insatured are greater than carbon for $CommonName \n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
851 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
852 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
853 $cTotal = $Ch1_C + $Ch2_C ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
854 $iTotal = $Ch1_i + $Ch2_i ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
855 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
856 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
857 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
858 croak "Carbones or insatures number is not defined \n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
859 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
860 } # End IF |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
861 elsif ( $CommonName =~/^-$/ ) { ## cas du no common name dans la base (-) |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
862 $Groupe = 'UnNAMED_IN_LM' ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
863 $cTotal = 0 ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
864 $iTotal = 0 ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
865 } # End ELSIF |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
866 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
867 print "Not yet parsing rules for this commonName $CommonName\n" ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
868 $Groupe = $CommonName ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
869 $cTotal = 0 ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
870 $iTotal = 0 ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
871 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
872 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
873 return( $Groupe, $Familly, $cTotal, $iTotal, $Ox ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
874 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
875 ### END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
876 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
877 ## Fonction : permet de regrouper les composes ayant le meme commona name simplifie |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
878 ## Input : |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
879 ## Ouput : |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
880 sub clusteringCommonName { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
881 ## Retrieve Values |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
882 my ( $refH_Features ) = @_; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
883 my %Results = %{$refH_Features} ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
884 my %Clusters = () ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
885 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
886 # print Dumper %Results ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
887 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
888 foreach my $id ( keys %Results ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
889 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
890 if ( $id ne 'nbentries' ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
891 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
892 my $oldFormula = '' ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
893 my $Cpd = undef ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
894 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
895 if (defined $Results{$id}{'simplename'}) { $Cpd = $Results{$id}{'simplename'} ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
896 # else { print"+++COCO\n"; $Cpd = 'UNDEF' ; } ## ?? comprends pas l'impact sur la suite ! |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
897 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
898 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
899 if ( !defined $Clusters{$Cpd}{'list'} ) { $Clusters{$Cpd}{'list'} = [] ; } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
900 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
901 my $currentFormula = $Results{$id}{'formula'} ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
902 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
903 if ( $currentFormula ne $oldFormula ) { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
904 $Clusters{$Cpd}{'formula'} = $Results{$id}{'formula'} ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
905 push ( @{$Clusters{$Cpd}{'list'} }, $id ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
906 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
907 else { |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
908 push ( @{$Clusters{$Cpd}{'list'} }, $id ) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
909 next ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
910 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
911 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
912 else { # Gere le cas ou la key du hash courant est le nombre d'entrees... |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
913 next ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
914 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
915 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
916 return(\%Clusters) ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
917 } |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
918 ### END of SUB |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
919 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
920 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
921 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
922 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
923 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
924 1 ; |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
925 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
926 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
927 __END__ |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
928 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
929 =head1 SUPPORT |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
930 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
931 You can find documentation for this module with the perldoc command. |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
932 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
933 perldoc XXX.pm |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
934 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
935 =head1 Exports |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
936 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
937 =over 4 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
938 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
939 =item :ALL is ... |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
940 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
941 =back |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
942 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
943 =head1 AUTHOR |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
944 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
945 Franck Giacomoni E<lt>franck.giacomoni@clermont.inra.frE<gt> |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
946 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
947 =head1 LICENSE |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
948 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
949 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
950 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
951 =head1 VERSION |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
952 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
953 version 1 : xx / xx / 201x |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
954 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
955 version 2 : ?? |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
956 |
e8bd49794291
Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff
changeset
|
957 =cut |