annotate lib/hmdb.pm @ 14:625fa968d99a draft

Master branch Updating - - Fxx
author fgiacomoni
date Thu, 10 Jan 2019 09:10:14 -0500
parents c32280662103
children beb9619263b0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1 package lib::hmdb ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
2
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
3 use strict;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
4 use warnings ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
5 use Exporter ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
6 use Carp ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
7
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
8 use LWP::Simple;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
9 use LWP::UserAgent;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
10 use URI::URL;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
11 use SOAP::Lite;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
12 use Encode;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
13 use HTML::Template ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
14 use XML::Twig ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
15 use Text::CSV ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
16
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
17 use Data::Dumper ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
18
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
19 use vars qw($VERSION @ISA @EXPORT %EXPORT_TAGS);
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
20
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
21 our $VERSION = "1.0";
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
22 our @ISA = qw(Exporter);
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
23 our @EXPORT = qw( map_suppl_data_on_hmdb_results get_unik_ids_from_results get_hmdb_metabocard_from_id extract_sub_mz_lists test_matches_from_hmdb_ua prepare_multi_masses_query get_matches_from_hmdb_ua parse_hmdb_csv_results set_html_tbody_object add_mz_to_tbody_object add_entries_to_tbody_object write_html_skel set_lm_matrix_object set_hmdb_matrix_object_with_ids add_lm_matrix_to_input_matrix write_csv_skel write_csv_one_mass );
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
24 our %EXPORT_TAGS = ( ALL => [qw( map_suppl_data_on_hmdb_results get_unik_ids_from_results get_hmdb_metabocard_from_id extract_sub_mz_lists test_matches_from_hmdb_ua prepare_multi_masses_query get_matches_from_hmdb_ua parse_hmdb_csv_results set_html_tbody_object add_mz_to_tbody_object add_entries_to_tbody_object write_html_skel set_lm_matrix_object set_hmdb_matrix_object_with_ids add_lm_matrix_to_input_matrix write_csv_skel write_csv_one_mass )] );
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
25
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
26 =head1 NAME
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
27
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
28 My::Module - An example module
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
29
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
30 =head1 SYNOPSIS
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
31
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
32 use My::Module;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
33 my $object = My::Module->new();
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
34 print $object->as_string;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
35
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
36 =head1 DESCRIPTION
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
37
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
38 This module does not really exist, it
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
39 was made for the sole purpose of
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
40 demonstrating how POD works.
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
41
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
42 =head1 METHODS
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
43
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
44 Methods are :
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
45
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
46 =head2 METHOD new
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
47
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
48 ## Description : new
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
49 ## Input : $self
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
50 ## Ouput : bless $self ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
51 ## Usage : new() ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
52
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
53 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
54
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
55 sub new {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
56 ## Variables
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
57 my $self={};
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
58 bless($self) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
59 return $self ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
60 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
61 ### END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
62
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
63
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
64 =head2 METHOD extract_sub_mz_lists
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
65
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
66 ## Description : extract a couples of sublist from a long mz list (more than $HMDB_LIMITS)
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
67 ## Input : $HMDB_LIMITS, $masses
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
68 ## Output : $sublists
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
69 ## Usage : my ( $sublists ) = extract_sub_mz_lists( $HMDB_LIMITS, $masses ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
70
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
71 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
72 ## START of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
73 sub extract_sub_mz_lists {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
74 ## Retrieve Values
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
75 my $self = shift ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
76 my ( $masses, $HMDB_LIMITS ) = @_ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
77
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
78 my ( @sublists, @sublist ) = ( (), () ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
79 my $nb_mz = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
80 my $nb_total_mzs = scalar(@{$masses}) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
81
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
82 if ($nb_total_mzs == 0) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
83 die "The provided mzs list is empty" ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
84 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
85
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
86 for ( my $current_pos = 0 ; $current_pos < $nb_total_mzs ; $current_pos++ ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
87
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
88 if ( $nb_mz < $HMDB_LIMITS ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
89 if ( $masses->[$current_pos] ) { push (@sublist, $masses->[$current_pos]) ; $nb_mz++ ; } # build sub list
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
90 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
91 elsif ( $nb_mz == $HMDB_LIMITS ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
92 my @tmp = @sublist ; push (@sublists, \@tmp) ; @sublist = () ; $nb_mz = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
93 $current_pos-- ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
94 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
95 if ($current_pos == $nb_total_mzs-1) { my @tmp = @sublist ; push (@sublists, \@tmp) ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
96 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
97 return(\@sublists) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
98 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
99 ## END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
100
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
101 =head2 METHOD prepare_multi_masses_query
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
102
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
103 ## Description : Generate the adapted format of the mz list for HMDB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
104 ## Input : $masses
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
105 ## Output : $hmdb_masses
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
106 ## Usage : my ( $hmdb_masses ) = prepare_multi_masses_query( $masses ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
107
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
108 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
109 ## START of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
110 sub prepare_multi_masses_query {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
111 ## Retrieve Values
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
112 my $self = shift ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
113 my ( $masses ) = @_ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
114
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
115 my $hmdb_masses = undef ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
116 my $sep = '%0D%0A' ; ## retour chariot encode
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
117 my ($nb_masses, $i) = (0, 0) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
118
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
119 if ( defined $masses ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
120 my @masses = @{$masses} ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
121 my $nb_masses = scalar ( @masses ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
122 if ( $nb_masses == 0 ) { croak "The input method parameter mass list is empty" ; }
6
7ed37640fe2a planemo upload commit 4c72059b94b27eda2c0ee89bfc5f9bf4e3425dc5
fgiacomoni
parents: 4
diff changeset
123 elsif ( $nb_masses >= 700 ) { croak "Your mass list is too long : HMDB allows maximum 700 query masses per request \n" ; } ## Del it --- temporary patch
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
124
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
125 foreach my $mass (@masses) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
126
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
127 if ($i < $nb_masses) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
128 $hmdb_masses .= $mass.$sep ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
129 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
130 elsif ( $i == $nb_masses ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
131 $hmdb_masses .= $mass ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
132 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
133 else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
134 last ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
135 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
136 $i ++ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
137 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
138 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
139 else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
140 croak "No mass list found \n" ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
141 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
142 return($hmdb_masses, $nb_masses) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
143 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
144 ## END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
145
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
146 =head2 METHOD test_matches_from_hmdb_ua
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
147
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
148 ## Description : test a single query with tests parameters on hmdb - get the status of the complete server infra.
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
149 ## Input : none
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
150 ## Output : $status_line
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
151 ## Usage : my ( $status_line ) = test_matches_from_hmdb_ua( ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
152
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
153 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
154 ## START of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
155 sub test_matches_from_hmdb_ua {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
156 ## Retrieve Values
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
157 my $self = shift ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
158
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
159 my @page = () ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
160
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
161 my $ua = new LWP::UserAgent;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
162 $ua->agent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36");
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
163
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
164 my $req = HTTP::Request->new(
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
165 POST => 'http://specdb.wishartlab.com/ms/search.csv');
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
166
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
167 $req->content_type('application/x-www-form-urlencoded');
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
168 $req->content('utf8=TRUE&mode=positive&query_masses=420.159317&tolerance=0.000001&database=HMDB&commit=Download Results As CSV');
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
169
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
170 my $res = $ua->request($req);
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
171 # print $res->as_string;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
172 my $status_line = $res->status_line ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
173 ($status_line) = ($status_line =~ /(\d+)/);
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
174
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
175
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
176 return (\$status_line) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
177 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
178 ## END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
179
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
180 =head2 METHOD check_state_from_hmdb_ua
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
181
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
182 ## Description : check the thhp status of hmdb and kill correctly the script if necessary.
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
183 ## Input : $status
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
184 ## Output : none
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
185 ## Usage : check_state_from_hmdb_ua($status) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
186
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
187 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
188 ## START of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
189 sub check_state_from_hmdb_ua {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
190 ## Retrieve Values
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
191 my $self = shift ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
192 my ($status) = @_ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
193
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
194 if (!defined $$status) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
195 croak "No http status is defined for the distant server" ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
196 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
197 else {
14
625fa968d99a Master branch Updating - - Fxx
fgiacomoni
parents: 9
diff changeset
198 unless ( $$status == 200 ) {
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
199 if ( $$status == 504 ) { croak "Gateway Timeout: The HMDB server was acting as a gateway or proxy and did not receive a timely response from the upstream server" ; }
14
625fa968d99a Master branch Updating - - Fxx
fgiacomoni
parents: 9
diff changeset
200 if ( $$status == 500 ) { croak "Internal Server Error: The HMDB server returns an unexpected internal server error" ; }
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
201 else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
202 ## None supported http code error ##
14
625fa968d99a Master branch Updating - - Fxx
fgiacomoni
parents: 9
diff changeset
203 croak "Internal Server Error $$status..." ;
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
204 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
205 }
14
625fa968d99a Master branch Updating - - Fxx
fgiacomoni
parents: 9
diff changeset
206 if ( $$status == 200 ) { print "The HMDB server returns that your request was fulfilled" ; }
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
207 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
208
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
209 return (1) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
210 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
211 ## END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
212
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
213 =head2 METHOD get_matches_from_hmdb_ua
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
214
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
215 ## Description : HMDB querying via an user agent with parameters : mz, delta and molecular species (neutral, pos, neg)
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
216 ## Input : $mass, $delta, $mode
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
217 ## Output : $results
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
218 ## Usage : my ( $results ) = get_matches_from_hmdb( $mass, $delta, $mode ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
219
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
220 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
221 ## START of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
222 sub get_matches_from_hmdb_ua {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
223 ## Retrieve Values
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
224 my $self = shift ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
225 my ( $masses, $delta, $mode ) = @_ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
226
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
227 my @page = () ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
228
8
97788e4bf3fc planemo upload commit d1a5cd8f1baf00879ffa44649883f91c64f43392-dirty
fgiacomoni
parents: 6
diff changeset
229 my $ua = LWP::UserAgent->new( keep_alive => 10 );
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
230 $ua->agent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36");
9
c32280662103 Master branch Updating - - Fxx
fgiacomoni
parents: 8
diff changeset
231 $ua->timeout(2400) ;
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
232
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
233 my $req = HTTP::Request->new(
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
234 POST => 'http://specdb.wishartlab.com/ms/search.csv');
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
235
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
236 $req->content_type('application/x-www-form-urlencoded');
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
237 $req->content('utf8=TRUE&mode='.$mode.'&query_masses='.$masses.'&tolerance='.$delta.'&database=HMDB&commit=Download Results As CSV');
14
625fa968d99a Master branch Updating - - Fxx
fgiacomoni
parents: 9
diff changeset
238 # print Dumper $req ;
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
239 my $res = $ua->request($req);
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
240 # print $res->as_string;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
241 if ($res->is_success) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
242 @page = split ( /\n/, $res->decoded_content ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
243 } else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
244 my $status_line = $res->status_line ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
245 ($status_line) = ($status_line =~ /(\d+)/);
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
246 croak "HMDB service none available !! Status of the HMDB server is : $status_line\n" ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
247 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
248
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
249
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
250 return (\@page) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
251 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
252 ## END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
253
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
254 =head2 METHOD parse_hmdb_csv_results
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
255
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
256 ## Description : parse the csv results and get data
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
257 ## Input : $csv
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
258 ## Output : $results
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
259 ## Usage : my ( $results ) = parse_hmdb_csv_results( $csv ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
260
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
261 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
262 ## START of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
263 sub parse_hmdb_csv_results {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
264 ## Retrieve Values
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
265 my $self = shift ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
266 my ( $csv, $masses, $max_query ) = @_ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
267
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
268 my $test = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
269 my ($query_mass,$compound_id,$formula,$compound_mass,$adduct,$adduct_type,$adduct_mass,$delta) = (0, undef, undef, undef, undef, undef, undef, undef) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
270
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
271 my %result_by_entry = () ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
272 my %features = () ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
273
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
274 # print Dumper $csv ;
14
625fa968d99a Master branch Updating - - Fxx
fgiacomoni
parents: 9
diff changeset
275 # print Dumper $masses ;
625fa968d99a Master branch Updating - - Fxx
fgiacomoni
parents: 9
diff changeset
276 # print Dumper $max_query ;
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
277
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
278 foreach my $line (@{$csv}) {
4
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
279 ## NEW HMDB format V4.0 - dec2017
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
280 if ($line !~ /query_mass,compound_id,compound_name,kegg_id,formula,monoisotopic_mass,adduct,adduct_type,adduct_m\/z,delta\(ppm\)/) {
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
281
4
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
282 if ( $line =~ /(\d+\.\d+),(\w+),(.*),([\w|n\/a]+)\s*,(\w+),(\d+\.\d+),(.*),(\+|\-),(\d+\.\d+),(\d+)/ ) {
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
283 my @entry = ("$1","$2","$3","$4","$5","$6","$7","$8","$9","$10") ;
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
284
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
285 if ( !exists $result_by_entry{$entry[0]} ) { $result_by_entry{$entry[0]} = [] ; }
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
286
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
287 $features{ENTRY_ENTRY_ID} = $entry[1] ;
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
288 $features{ENTRY_FORMULA} = $entry[4] ;
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
289 $features{ENTRY_CPD_MZ} = $entry[5] ;
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
290 $features{ENTRY_ADDUCT} = $entry[6] ;
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
291 $features{ENTRY_ADDUCT_TYPE} = $entry[7] ;
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
292 $features{ENTRY_ADDUCT_MZ} = $entry[8] ;
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
293 $features{ENTRY_DELTA} = $entry[9] ;
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
294
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
295 my %temp = %features ;
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
296 push (@{$result_by_entry{$entry[0]} }, \%temp) ;
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
297 }
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
298 else {
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
299 warn "The parsed line ($line) does not match your pattern\n " ;
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
300 }
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
301 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
302 else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
303 next ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
304 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
305 } ## end foreach
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
306
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
307 ## manage per query_mzs (keep query masses order by array)
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
308 my @results = () ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
309 foreach (@{$masses}) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
310 if ($result_by_entry{$_}) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
311
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
312 ## cut all entries > $max_query
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
313 my @temp_entries = @{$result_by_entry{$_}} ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
314 my @temp_cut = () ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
315 my $current_query = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
316 foreach (@temp_entries) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
317 $current_query ++ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
318 if ($current_query > $max_query) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
319 last ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
320 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
321 else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
322 push (@temp_cut, $_) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
323 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
324 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
325 push (@results, \@temp_cut) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
326 # push (@results, $result_by_entry{$_}) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
327 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
328 else {push (@results, [] ) ;} ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
329
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
330 }
14
625fa968d99a Master branch Updating - - Fxx
fgiacomoni
parents: 9
diff changeset
331
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
332 return(\@results) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
333 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
334 ## END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
335
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
336 =head2 METHOD parse_hmdb_page_results
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
337
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
338 ## Description : [DEPRECATED] old HMDB html page parser
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
339 ## Input : $page
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
340 ## Output : $results
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
341 ## Usage : my ( $results ) = parse_hmdb_page_result( $pages ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
342
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
343 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
344 ## START of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
345 sub parse_hmdb_page_results {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
346 ## Retrieve Values
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
347 my $self = shift ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
348 my ( $page ) = @_ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
349
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
350 my @results = () ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
351 my ($catch_table, $catch_name) = (0, 0) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
352 my ($name, $adduct, $adduct_mw, $cpd_mw, $delta) = (undef, undef, undef, undef, undef) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
353
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
354 if ( defined $page ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
355
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
356 my @page = @{$page} ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
357 my $ID = undef ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
358 my @result_by_mz = () ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
359 my %result_by_entry = () ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
360
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
361 foreach my $line (@page) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
362
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
363 #Section de la page contenant les resultat
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
364 if( $line =~/<table>/ ) { $catch_table = 1 ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
365
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
366 ## Si il existe un resultat :
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
367 if($catch_table == 1) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
368
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
369 #Id de la molecule, et creation du lien
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
370 if( $line =~ /<a href=\"\/metabolites\/(\w+)\" (.*)>/ ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
371 $ID = $1 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
372 $catch_name = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
373 next ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
374 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
375 #Nom de la molecule ONLY!!
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
376 if ( $catch_name == 0 ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
377
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
378 if( $line =~ /<td>(.+)<\/td>/ ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
379
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
380 if ( !defined $name ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
381 $name = $1 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
382 $result_by_entry{'ENTRY_ENTRY_ID'} = $ID ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
383 $result_by_entry{'ENTRY_NAME'} = $name ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
384 next ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
385 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
386 if ( !defined $adduct ) { $adduct = $1 ; $result_by_entry{'ENTRY_ADDUCT'} = $adduct ; next ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
387 if ( !defined $adduct_mw ) { $adduct_mw = $1 ; $result_by_entry{'ENTRY_ADDUCT_MZ'} = $adduct_mw ; next ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
388 if ( !defined $cpd_mw ) { $cpd_mw = $1 ; $result_by_entry{'ENTRY_CPD_MZ'} = $cpd_mw ; next ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
389 if ( !defined $delta ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
390 $delta = $1 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
391 $result_by_entry{'ENTRY_DELTA'} = $delta ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
392 $catch_name = 1 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
393 my %tmp = %result_by_entry ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
394 push (@result_by_mz, \%tmp) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
395 %result_by_entry = () ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
396 ( $name, $cpd_mw, $delta, $adduct, $adduct_mw ) = ( undef, undef, undef, undef, undef ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
397 next ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
398 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
399 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
400 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
401 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
402 #Fin de la section contenant les resultats
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
403 if( $line =~ /<\/table>/ ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
404 $catch_table = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
405 my @Tmp = @result_by_mz ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
406 push(@results, \@Tmp) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
407 @result_by_mz = () ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
408 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
409 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
410 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
411 return(\@results) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
412 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
413 ## END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
414
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
415
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
416 =head2 METHOD get_unik_ids_from_results
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
417
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
418 ## Description : get all unik ids from the hmdb result object
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
419 ## Input : $results
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
420 ## Output : $ids
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
421 ## Usage : my ( $ids ) = get_unik_ids_from_results ( $results ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
422
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
423 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
424 ## START of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
425 sub get_unik_ids_from_results {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
426 ## Retrieve Values
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
427 my $self = shift ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
428 my ( $results ) = @_;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
429 my ( %ids ) = ( () ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
430
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
431 foreach my $result (@{$results}) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
432
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
433 foreach my $entries (@{$result}) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
434
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
435 if ( ($entries->{'ENTRY_ENTRY_ID'}) and ($entries->{'ENTRY_ENTRY_ID'} ne '' ) ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
436 $ids{$entries->{'ENTRY_ENTRY_ID'}} = 1 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
437 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
438 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
439 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
440
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
441 return (\%ids) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
442 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
443 ### END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
444
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
445
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
446
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
447 =head2 METHOD get_hmdb_metabocard_from_id
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
448
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
449 ## Description : get a metabocard (xml format from an ID on HMDB)
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
450 ## Input : $ids
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
451 ## Output : $metabocard_features
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
452 ## Usage : my ( $metabocard_features ) = get_hmdb_metabocard_from_id ( $ids ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
453
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
454 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
455 ## START of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
456 sub get_hmdb_metabocard_from_id {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
457 ## Retrieve Values
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
458 my $self = shift ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
459 my ( $ids, $hmdb_url ) = @_;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
460 my ( %metabocard_features ) = ( () ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
461 my $query = undef ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
462
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
463 ## structure %metabocard_features
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
464 # metabolite_id = (
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
465 # 'metabolite_name' => '__name__',
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
466 # 'metabolite_inchi' => '__inchi__',
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
467 # 'metabolite_logp' => '__logp-ALOGPS__',
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
468 #
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
469 # )
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
470
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
471
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
472 if( (defined $ids) and ($ids > 0 ) ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
473
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
474 foreach my $id (keys %{$ids}) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
475
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
476 # print "\n============== > $id **********************\n " ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
477 my $twig = undef ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
478
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
479 if (defined $hmdb_url) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
480 $query = $hmdb_url.$id.'.xml' ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
481
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
482 ## test the header if exists
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
483 my $response = head($query) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
484
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
485 if (!defined $response) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
486 $metabocard_features{$id}{'metabolite_name'} = undef ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
487 $metabocard_features{$id}{'metabolite_inchi'} = undef ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
488 $metabocard_features{$id}{'metabolite_logp'} = undef ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
489 ## Need to be improve to manage http 404 or other response diff than 200
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
490 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
491 elsif ($response->is_success) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
492
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
493 $twig = XML::Twig->nparse_ppe(
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
494
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
495 twig_handlers => {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
496 # metabolite name
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
497 'metabolite/name' => sub { $metabocard_features{$id}{'metabolite_name'} = $_ -> text_only ; } ,
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
498 # metabolite inchi
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
499 'metabolite/inchi' => sub { $metabocard_features{$id}{'metabolite_inchi'} = $_ -> text_only ; } ,
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
500 ## metabolite logP
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
501 'metabolite/predicted_properties/property' => sub {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
502
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
503 my ($kind, $source, $value ) = ( undef, undef, undef ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
504
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
505 if (defined $_->children ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
506 foreach my $field ($_->children) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
507 if ( $field->name eq 'kind') { $kind = $field->text ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
508 elsif ( $field->name eq 'source') { $source = $field->text ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
509 elsif ( $field->name eq 'value') { $value = $field->text ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
510
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
511 if (defined $source ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
512 if ( ( $kind eq 'logp' ) and ( $source eq 'ALOGPS' ) ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
513 $metabocard_features{$id}{'metabolite_logp'} = $value ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
514 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
515 ($kind, $source, $value ) = ( undef, undef, undef ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
516 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
517 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
518 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
519 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
520 },
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
521 pretty_print => 'indented',
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
522 error_context => 1, $query
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
523 );
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
524
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
525 # $twig->print;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
526 $twig->purge ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
527
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
528 if (!$@) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
529
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
530 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
531 else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
532 warn $@ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
533 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
534 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
535 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
536 else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
537 warn "The hmdb metabocard url is not defined\n" ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
538 last;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
539 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
540 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
541 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
542 else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
543 warn "The HMDB ids list from HMDB is empty - No metabocard found\n" ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
544 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
545
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
546 # print Dumper %metabocard_features ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
547 return (\%metabocard_features) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
548 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
549 ### END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
550
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
551
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
552 =head2 METHOD map_suppl_data_on_hmdb_results
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
553
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
554 ## Description : map supplementary data with already collected results with hmdb search
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
555 ## Input : $results, $features
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
556 ## Output : $results
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
557 ## Usage : my ( $results ) = map_suppl_data_on_hmdb_results ( $results, $features ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
558
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
559 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
560 ## START of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
561 sub map_suppl_data_on_hmdb_results {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
562 ## Retrieve Values
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
563 my $self = shift ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
564 my ( $results, $features ) = @_;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
565 my ( @more_results ) = ( () ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
566
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
567 @more_results = @{$results} ; ## Dump array ref to map
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
568
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
569 foreach my $result (@more_results) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
570
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
571 foreach my $entries (@{$result}) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
572
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
573 if ( ($entries->{'ENTRY_ENTRY_ID'}) and ($entries->{'ENTRY_ENTRY_ID'} ne '' ) ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
574 ## check that we have a ID for mapping
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
575 my $current_id = $entries->{'ENTRY_ENTRY_ID'} ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
576 if ($features->{"$current_id"}) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
577 ## Metabolite NAME
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
578 if (defined $features->{"$current_id"}{'metabolite_name'} ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
579 $entries->{'ENTRY_ENTRY_NAME'} = $features->{"$current_id"}{'metabolite_name'}
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
580 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
581 else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
582 $entries->{'ENTRY_ENTRY_NAME'} = 'UNKNOWN' ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
583 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
584 ## Metabolite INCHI
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
585 if (defined $features->{"$current_id"}{'metabolite_inchi'} ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
586 $entries->{'ENTRY_ENTRY_INCHI'} = $features->{"$current_id"}{'metabolite_inchi'}
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
587 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
588 else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
589 $entries->{'ENTRY_ENTRY_INCHI'} = 'NA' ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
590 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
591 ## Metabolite LOGP
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
592 if (defined $features->{"$current_id"}{'metabolite_logp'} ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
593 $entries->{'ENTRY_ENTRY_LOGP'} = $features->{"$current_id"}{'metabolite_logp'}
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
594 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
595 else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
596 $entries->{'ENTRY_ENTRY_LOGP'} = 'NA' ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
597 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
598 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
599 else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
600 warn "This HMDB id doesn't match any collected ids\n" ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
601 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
602 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
603 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
604 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
605
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
606 return (\@more_results) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
607 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
608 ### END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
609
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
610
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
611 =head2 METHOD set_html_tbody_object
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
612
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
613 ## Description : initializes and build the tbody object (perl array) needed to html template
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
614 ## Input : $nb_pages, $nb_items_per_page
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
615 ## Output : $tbody_object
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
616 ## Usage : my ( $tbody_object ) = set_html_tbody_object($nb_pages, $nb_items_per_page) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
617
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
618 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
619 ## START of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
620 sub set_html_tbody_object {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
621 my $self = shift ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
622 my ( $nb_pages, $nb_items_per_page ) = @_ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
623
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
624 my ( @tbody_object ) = ( ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
625
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
626 for ( my $i = 1 ; $i <= $nb_pages ; $i++ ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
627
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
628 my %pages = (
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
629 # tbody feature
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
630 PAGE_NB => $i,
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
631 MASSES => [], ## end MASSES
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
632 ) ; ## end TBODY N
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
633 push (@tbody_object, \%pages) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
634 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
635 return(\@tbody_object) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
636 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
637 ## END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
638
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
639 =head2 METHOD add_mz_to_tbody_object
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
640
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
641 ## Description : initializes and build the mz object (perl array) needed to html template
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
642 ## Input : $tbody_object, $nb_items_per_page, $mz_list
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
643 ## Output : $tbody_object
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
644 ## Usage : my ( $tbody_object ) = add_mz_to_tbody_object( $tbody_object, $nb_items_per_page, $mz_list ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
645
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
646 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
647 ## START of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
648 sub add_mz_to_tbody_object {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
649 my $self = shift ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
650 my ( $tbody_object, $nb_items_per_page, $mz_list, $ids_list ) = @_ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
651
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
652 my ( $current_page, $mz_index ) = ( 0, 0 ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
653
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
654 foreach my $page ( @{$tbody_object} ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
655
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
656 my @colors = ('white', 'green') ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
657 my ( $current_index, , $icolor ) = ( 0, 0 ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
658
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
659 for ( my $i = 1 ; $i <= $nb_items_per_page ; $i++ ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
660 #
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
661 if ( $current_index > $nb_items_per_page ) { ## manage exact mz per html page
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
662 $current_index = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
663 last ; ##
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
664 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
665 else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
666 $current_index++ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
667 if ( $icolor > 1 ) { $icolor = 0 ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
668
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
669 if ( exists $mz_list->[$mz_index] ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
670
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
671 my %mz = (
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
672 # mass feature
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
673 MASSES_ID_QUERY => $ids_list->[$mz_index],
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
674 MASSES_MZ_QUERY => $mz_list->[$mz_index],
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
675 MZ_COLOR => $colors[$icolor],
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
676 MASSES_NB => $mz_index+1,
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
677 ENTRIES => [] ,
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
678 ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
679 push ( @{ $tbody_object->[$current_page]{MASSES} }, \%mz ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
680 # Html attr for mass
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
681 $icolor++ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
682 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
683 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
684 $mz_index++ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
685 } ## foreach mz
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
686
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
687 $current_page++ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
688 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
689 return($tbody_object) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
690 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
691 ## END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
692
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
693 =head2 METHOD add_entries_to_tbody_object
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
694
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
695 ## Description : initializes and build the entries object (perl array) needed to html template
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
696 ## Input : $tbody_object, $nb_items_per_page, $mz_list, $entries
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
697 ## Output : $tbody_object
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
698 ## Usage : my ( $tbody_object ) = add_entries_to_tbody_object( $tbody_object, $nb_items_per_page, $mz_list, $entries ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
699
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
700 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
701 ## START of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
702 sub add_entries_to_tbody_object {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
703 ## Retrieve Values
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
704 my $self = shift ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
705 my ( $tbody_object, $nb_items_per_page, $mz_list, $entries ) = @_ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
706
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
707 my $index_page = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
708 my $index_mz_continous = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
709
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
710 foreach my $page (@{$tbody_object}) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
711
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
712 my $index_mz = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
713
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
714 foreach my $mz (@{ $tbody_object->[$index_page]{MASSES} }) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
715
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
716 my $index_entry = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
717
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
718 my @anti_redondant = ('N/A') ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
719 my $check_rebond = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
720 my $check_noentry = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
721
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
722 foreach my $entry (@{ $entries->[$index_mz_continous] }) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
723 $check_noentry ++ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
724 ## dispo anti doublons des entries
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
725 foreach my $rebond (@anti_redondant) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
726 if ( $rebond eq $entries->[$index_mz_continous][$index_entry]{ENTRY_ENTRY_ID} ) { $check_rebond = 1 ; last ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
727 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
728
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
729 if ( $check_rebond == 0 ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
730
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
731 push ( @anti_redondant, $entries->[$index_mz_continous][$index_entry]{ENTRY_ENTRY_ID} ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
732
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
733 my %entry = (
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
734 ENTRY_COLOR => $tbody_object->[$index_page]{MASSES}[$index_mz]{MZ_COLOR},
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
735 ENTRY_ENTRY_NAME => $entries->[$index_mz_continous][$index_entry]{ENTRY_ENTRY_NAME},
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
736 ENTRY_ENTRY_ID => $entries->[$index_mz_continous][$index_entry]{ENTRY_ENTRY_ID},
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
737 ENTRY_ENTRY_ID2 => $entries->[$index_mz_continous][$index_entry]{ENTRY_ENTRY_ID},
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
738 ENTRY_FORMULA => $entries->[$index_mz_continous][$index_entry]{ENTRY_FORMULA},
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
739 ENTRY_CPD_MZ => $entries->[$index_mz_continous][$index_entry]{ENTRY_CPD_MZ},
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
740 ENTRY_ADDUCT => $entries->[$index_mz_continous][$index_entry]{ENTRY_ADDUCT},
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
741 ENTRY_ADDUCT_TYPE => $entries->[$index_mz_continous][$index_entry]{ENTRY_ADDUCT_TYPE},
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
742 ENTRY_ADDUCT_MZ => $entries->[$index_mz_continous][$index_entry]{ENTRY_ADDUCT_MZ},
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
743 ENTRY_DELTA => $entries->[$index_mz_continous][$index_entry]{ENTRY_DELTA},
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
744 ENTRY_ENTRY_INCHI => $entries->[$index_mz_continous][$index_entry]{ENTRY_ENTRY_INCHI},
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
745 ENTRY_ENTRY_LOGP => $entries->[$index_mz_continous][$index_entry]{ENTRY_ENTRY_LOGP},
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
746 ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
747
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
748 push ( @{ $tbody_object->[$index_page]{MASSES}[$index_mz]{ENTRIES} }, \%entry) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
749 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
750 $check_rebond = 0 ; ## reinit double control
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
751 $index_entry++ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
752 } ## end foreach
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
753 if ($check_noentry == 0 ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
754 my %entry = (
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
755 ENTRY_COLOR => $tbody_object->[$index_page]{MASSES}[$index_mz]{MZ_COLOR},
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
756 ENTRY_ENTRY_NAME => 'UNKNOWN',
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
757 ENTRY_ENTRY_ID => 'NONE',
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
758 ENTRY_ENTRY_ID2 => '',
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
759 ENTRY_FORMULA => 'n/a',
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
760 ENTRY_CPD_MZ => 'n/a',
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
761 ENTRY_ADDUCT => 'n/a',
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
762 ENTRY_ADDUCT_TYPE => 'n/a',
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
763 ENTRY_ADDUCT_MZ => 'n/a',
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
764 ENTRY_DELTA => 0,
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
765 ENTRY_ENTRY_INCHI => 'n/a',
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
766 ENTRY_ENTRY_LOGP => 'n/a',
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
767 ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
768 push ( @{ $tbody_object->[$index_page]{MASSES}[$index_mz]{ENTRIES} }, \%entry) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
769 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
770 $index_mz ++ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
771 $index_mz_continous ++ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
772 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
773 $index_page++ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
774 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
775 return($tbody_object) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
776 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
777 ## END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
778
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
779 =head2 METHOD write_html_skel
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
780
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
781 ## Description : prepare and write the html output file
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
782 ## Input : $html_file_name, $html_object, $html_template
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
783 ## Output : $html_file_name
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
784 ## Usage : my ( $html_file_name ) = write_html_skel( $html_file_name, $html_object ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
785
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
786 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
787 ## START of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
788 sub write_html_skel {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
789 ## Retrieve Values
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
790 my $self = shift ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
791 my ( $html_file_name, $html_object, $pages , $search_condition, $html_template, $js_path, $css_path ) = @_ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
792
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
793 my $html_file = $$html_file_name ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
794
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
795 if ( defined $html_file ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
796 open ( HTML, ">$html_file" ) or die "Can't create the output file $html_file " ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
797
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
798 if (-e $html_template) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
799 my $ohtml = HTML::Template->new(filename => $html_template);
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
800 $ohtml->param( JS_GALAXY_PATH => $js_path, CSS_GALAXY_PATH => $css_path ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
801 $ohtml->param( CONDITIONS => $search_condition ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
802 $ohtml->param( PAGES_NB => $pages ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
803 $ohtml->param( PAGES => $html_object ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
804 print HTML $ohtml->output ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
805 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
806 else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
807 croak "Can't fill any html output : No template available ($html_template)\n" ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
808 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
809
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
810 close (HTML) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
811 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
812 else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
813 croak "No output file name available to write HTML file\n" ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
814 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
815 return(\$html_file) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
816 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
817 ## END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
818
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
819 =head2 METHOD set_lm_matrix_object
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
820
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
821 ## Description : build the hmdb_row under its ref form
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
822 ## Input : $header, $init_mzs, $entries
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
823 ## Output : $hmdb_matrix
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
824 ## Usage : my ( $hmdb_matrix ) = set_lm_matrix_object( $header, $init_mzs, $entries ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
825
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
826 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
827 ## START of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
828 sub set_lm_matrix_object {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
829 ## Retrieve Values
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
830 my $self = shift ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
831 my ( $header, $init_mzs, $entries ) = @_ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
832
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
833 my @hmdb_matrix = () ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
834
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
835 if ( defined $header ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
836 my @headers = () ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
837 push @headers, $header ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
838 push @hmdb_matrix, \@headers ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
839 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
840
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
841 my $index_mz = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
842
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
843 foreach my $mz ( @{$init_mzs} ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
844
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
845 my $index_entries = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
846 my @clusters = () ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
847 my $cluster_col = undef ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
848
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
849 my @anti_redondant = ('N/A') ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
850 my $check_rebond = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
851
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
852 my $nb_entries = scalar (@{ $entries->[$index_mz] }) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
853
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
854 foreach my $entry (@{ $entries->[$index_mz] }) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
855
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
856 ## dispo anti doublons des entries
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
857 foreach my $rebond (@anti_redondant) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
858 if ( $rebond eq $entries->[$index_mz][$index_entries]{ENTRY_ENTRY_ID} ) { $check_rebond = 1 ; last ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
859 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
860
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
861 if ( $check_rebond == 0 ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
862
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
863 push ( @anti_redondant, $entries->[$index_mz][$index_entries]{ENTRY_ENTRY_ID} ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
864
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
865 my $delta = $entries->[$index_mz][$index_entries]{ENTRY_DELTA} ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
866 my $formula = $entries->[$index_mz][$index_entries]{ENTRY_FORMULA} ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
867 my $hmdb_id = $entries->[$index_mz][$index_entries]{ENTRY_ENTRY_ID} ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
868
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
869 ## METLIN data display model
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
870 ## entry1=VAR1::VAR2::VAR3::VAR4|entry2=VAR1::VAR2::VAR3::VAR4|...
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
871 # manage final pipe
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
872 if ($index_entries < $nb_entries-1 ) { $cluster_col .= $delta.'::('.$formula.')::'.$hmdb_id.'|' ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
873 else { $cluster_col .= $delta.'::('.$formula.')::'.$hmdb_id ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
874
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
875 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
876 $check_rebond = 0 ; ## reinit double control
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
877 $index_entries++ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
878 } ## end foreach
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
879 if ( !defined $cluster_col ) { $cluster_col = 'NONE' ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
880 push (@clusters, $cluster_col) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
881 push (@hmdb_matrix, \@clusters) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
882 $index_mz++ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
883 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
884 return(\@hmdb_matrix) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
885 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
886 ## END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
887
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
888 =head2 METHOD set_hmdb_matrix_object_with_ids
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
889
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
890 ## Description : build the hmdb_row under its ref form (IDS only)
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
891 ## Input : $header, $init_mzs, $entries
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
892 ## Output : $hmdb_matrix
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
893 ## Usage : my ( $hmdb_matrix ) = set_hmdb_matrix_object_with_ids( $header, $init_mzs, $entries ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
894
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
895 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
896 ## START of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
897 sub set_hmdb_matrix_object_with_ids {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
898 ## Retrieve Values
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
899 my $self = shift ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
900 my ( $header, $init_mzs, $entries ) = @_ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
901
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
902 my @hmdb_matrix = () ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
903
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
904 if ( defined $header ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
905 my @headers = () ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
906
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
907 ## redefined the header hmdb(delta::name::mz::formula::adduct::id)
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
908 $header = 'hmdb(delta::name::mz::formula::adduct::id)' ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
909 push @headers, $header ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
910 push @hmdb_matrix, \@headers ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
911 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
912
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
913 my $index_mz = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
914
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
915 foreach my $mz ( @{$init_mzs} ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
916
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
917 my $index_entries = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
918 my @clusters = () ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
919 my $cluster_col = undef ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
920
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
921 my @anti_redondant = ('N/A') ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
922 my $check_rebond = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
923
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
924 my $nb_entries = scalar (@{ $entries->[$index_mz] }) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
925
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
926 foreach my $entry (@{ $entries->[$index_mz] }) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
927
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
928 ## dispo anti doublons des entries
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
929 foreach my $rebond (@anti_redondant) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
930 if ( $rebond eq $entries->[$index_mz][$index_entries]{ENTRY_ENTRY_ID} ) { $check_rebond = 1 ; last ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
931 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
932
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
933 if ( $check_rebond == 0 ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
934
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
935 push ( @anti_redondant, $entries->[$index_mz][$index_entries]{ENTRY_ENTRY_ID} ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
936 ##
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
937 my $hmdb_name = $entries->[$index_mz][$index_entries]{ENTRY_ENTRY_NAME} ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
938 my $hmdb_id = $entries->[$index_mz][$index_entries]{ENTRY_ENTRY_ID} ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
939 my $hmdb_formula = $entries->[$index_mz][$index_entries]{ENTRY_FORMULA} ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
940 my $hmdb_cpd_mz = $entries->[$index_mz][$index_entries]{ENTRY_CPD_MZ} ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
941 my $hmdb_adduct = $entries->[$index_mz][$index_entries]{ENTRY_ADDUCT} ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
942 my $hmdb_delta = $entries->[$index_mz][$index_entries]{ENTRY_DELTA} ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
943
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
944 ## METLIN data display model
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
945 ## entry1= ENTRY_DELTA::ENTRY_ENTRY_NAME::ENTRY_CPD_MZ::ENTRY_FORMULA::ENTRY_ADDUCT::ENTRY_ENTRY_ID | entry2=VAR1::VAR2::VAR3::VAR4|...
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
946 my $entry = $hmdb_delta.'::['."$hmdb_name".']::'.$hmdb_cpd_mz.'::'.$hmdb_formula.'::['.$hmdb_adduct.']::'.$hmdb_id ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
947
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
948 # manage final pipe
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
949 if ($index_entries < $nb_entries-1 ) { $cluster_col .= $entry.' | ' ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
950 else { $cluster_col .= $entry ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
951
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
952 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
953 $check_rebond = 0 ; ## reinit double control
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
954 $index_entries++ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
955 } ## end foreach
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
956 if ( !defined $cluster_col ) { $cluster_col = 'NONE' ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
957 push (@clusters, $cluster_col) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
958 push (@hmdb_matrix, \@clusters) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
959 $index_mz++ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
960 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
961 return(\@hmdb_matrix) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
962 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
963 ## END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
964
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
965 =head2 METHOD add_lm_matrix_to_input_matrix
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
966
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
967 ## Description : build a full matrix (input + lm column)
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
968 ## Input : $input_matrix_object, $lm_matrix_object, $nb_header
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
969 ## Output : $output_matrix_object
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
970 ## Usage : my ( $output_matrix_object ) = add_lm_matrix_to_input_matrix( $input_matrix_object, $lm_matrix_object, $nb_header ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
971
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
972 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
973 ## START of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
974 sub add_lm_matrix_to_input_matrix {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
975 ## Retrieve Values
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
976 my $self = shift ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
977 my ( $input_matrix_object, $lm_matrix_object, $nb_header ) = @_ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
978
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
979 my @output_matrix_object = () ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
980 my $index_row = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
981 my $line = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
982
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
983 foreach my $row ( @{$input_matrix_object} ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
984 my @init_row = @{$row} ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
985 $line++;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
986
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
987 if ( ( defined $nb_header ) and ( $line <= $nb_header) ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
988 push (@output_matrix_object, \@init_row) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
989 next ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
990 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
991
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
992 if ( $lm_matrix_object->[$index_row] ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
993 my $dim = scalar(@{$lm_matrix_object->[$index_row]}) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
994
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
995 if ($dim > 1) { warn "the add method can't manage more than one column\n" ;}
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
996 my $lm_col = $lm_matrix_object->[$index_row][$dim-1] ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
997
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
998 push (@init_row, $lm_col) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
999 $index_row++ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1000 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1001 push (@output_matrix_object, \@init_row) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1002 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1003 return(\@output_matrix_object) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1004 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1005 ## END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1006
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1007 =head2 METHOD write_csv_skel
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1008
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1009 ## Description : prepare and write csv output file
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1010 ## Input : $csv_file, $rows
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1011 ## Output : $csv_file
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1012 ## Usage : my ( $csv_file ) = write_csv_skel( $csv_file, $rows ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1013
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1014 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1015 ## START of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1016 sub write_csv_skel {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1017 ## Retrieve Values
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1018 my $self = shift ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1019 my ( $csv_file, $rows ) = @_ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1020
14
625fa968d99a Master branch Updating - - Fxx
fgiacomoni
parents: 9
diff changeset
1021 # my $ocsv = lib::csv::new( {is_binary => 1 , quote_binary => 0, quote_char => undef }) ;
625fa968d99a Master branch Updating - - Fxx
fgiacomoni
parents: 9
diff changeset
1022 my $ocsv = lib::csv::new() ;
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1023 my $csv = $ocsv->get_csv_object("\t") ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1024 $ocsv->write_csv_from_arrays($csv, $$csv_file, $rows) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1025
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1026 return($csv_file) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1027 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1028 ## END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1029
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1030 =head2 METHOD write_csv_one_mass
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1031
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1032 ## Description : print a cvs file
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1033 ## Input : $masses, $ids, $results, $file
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1034 ## Output : N/A
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1035 ## Usage : write_csv_one_mass( $ids, $results, $file ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1036
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1037 =cut
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1038 ## START of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1039 sub write_csv_one_mass {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1040 ## Retrieve Values
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1041 my $self = shift ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1042 my ( $masses, $ids, $results, $file, ) = @_ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1043
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1044 open(CSV, '>:utf8', "$file") or die "Cant' create the file $file\n" ;
14
625fa968d99a Master branch Updating - - Fxx
fgiacomoni
parents: 9
diff changeset
1045 print CSV "ID\tQuery(Da)\tDelta(ppm)\tMetabolite_Name\tCpd_MW(Da)\tFormula\tAdduct\tAdduct_MW(Da)\tHMDB_ID\n" ;
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1046
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1047 my $i = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1048
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1049 foreach my $id (@{$ids}) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1050 my $mass = undef ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1051 if ( $masses->[$i] ) { $mass = $masses->[$i] ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1052 else { last ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1053
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1054 if ( $results->[$i] ) { ## an requested id has a result in the list of hashes $results.
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1055
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1056 my @anti_redondant = ('N/A') ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1057 my $check_rebond = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1058 my $check_noentry = 0 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1059
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1060 foreach my $entry (@{$results->[$i]}) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1061 $check_noentry ++ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1062 ## dispo anti doublons des entries
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1063 foreach my $rebond (@anti_redondant) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1064 if ( $rebond eq $entry->{ENTRY_ENTRY_ID} ) { $check_rebond = 1 ; last ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1065 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1066 # print "\n-----------------------" ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1067 # print Dumper $entry->{ENTRY_ENTRY_ID} ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1068 # print "-------------------------$check_rebond\n" ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1069 # print Dumper @anti_redondant ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1070 if ( $check_rebond == 0 ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1071
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1072 push ( @anti_redondant, $entry->{ENTRY_ENTRY_ID} ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1073
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1074 print CSV "$id\t$mass\t" ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1075
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1076 ## print delta
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1077 if ( $entry->{ENTRY_DELTA} ) { print CSV "$entry->{ENTRY_DELTA}\t" ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1078 else { print CSV "0\t" ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1079
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1080 ## print cpd name
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1081 if ( $entry->{ENTRY_ENTRY_NAME} ) { print CSV "[$entry->{ENTRY_ENTRY_NAME}]\t" ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1082 else { print CSV "UNKNOWN\t" ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1083
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1084 ## print cpd mz
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1085 if ( $entry->{ENTRY_CPD_MZ} ) { print CSV "$entry->{ENTRY_CPD_MZ}\t" ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1086 else { print CSV "N/A\t" ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1087
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1088 ## print cpd formula
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1089 if ( $entry->{ENTRY_FORMULA} ) { print CSV "$entry->{ENTRY_FORMULA}\t" ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1090 else { print CSV "N/A\t" ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1091
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1092 ## print adduct
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1093 if ( $entry->{ENTRY_ADDUCT} ) { print CSV "[$entry->{ENTRY_ADDUCT}]\t" ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1094 else { print CSV "N/A\t" ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1095
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1096 ## print adduct mz
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1097 if ( $entry->{ENTRY_ADDUCT_MZ} ) { print CSV "$entry->{ENTRY_ADDUCT_MZ}\t" ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1098 else { print CSV "N/A\t" ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1099
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1100 ## print cpd id
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1101 if ( $entry->{ENTRY_ENTRY_ID} ) { print CSV "$entry->{ENTRY_ENTRY_ID}\n" ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1102 else { print CSV "N/A\n" ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1103 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1104 $check_rebond = 0 ; ## reinit double control
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1105 } ## end foreach
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1106 if ($check_noentry == 0 ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1107 print CSV "$id\t$mass\t0\tUNKNOWN\tN/A\tN/A\tN/A\tN/A\tN/A\n" ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1108 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1109 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1110 $i++ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1111 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1112 close(CSV) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1113 return() ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1114 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1115 ## END of SUB
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1116
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1117 1 ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1118
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1119
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1120 __END__
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1121
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1122 =head1 SUPPORT
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1123
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1124 You can find documentation for this module with the perldoc command.
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1125
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1126 perldoc hmdb.pm
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1127
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1128 =head1 Exports
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1129
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1130 =over 4
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1131
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1132 =item :ALL is ...
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1133
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1134 =back
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1135
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1136 =head1 AUTHOR
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1137
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1138 Franck Giacomoni E<lt>franck.giacomoni@clermont.inra.frE<gt>
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1139
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1140 =head1 LICENSE
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1141
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1142 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1143
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1144 =head1 VERSION
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1145
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1146 version 1 : 06 / 06 / 2013
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1147
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1148 version 2 : 27 / 01 / 2014
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1149
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1150 version 3 : 19 / 11 / 2014
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1151
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1152 version 4 : 28 / 01 / 2016
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1153
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1154 version 5 : 02 / 11 /2016
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1155
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1156 =cut