annotate t/lib/hmdbTest.pm @ 29:29195cb5d378 draft default tip

master branch Updating with tag :CI_COMMIT_TAG - - Fxx
author fgiacomoni
date Tue, 04 Jun 2024 09:42:17 +0000
parents 2d8a310e86ce
children
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::hmdbTest ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
2
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
3 use diagnostics; # this gives you more debugging information
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
4 use warnings; # this warns you of bad practices
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
5 use strict; # this prevents silly errors
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
6 use Exporter ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
7 use Carp ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
8
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
9 our $VERSION = "1.0";
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
10 our @ISA = qw(Exporter);
23
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
11 our @EXPORT = qw( testMatchesFromHmdb5WithUATest parseHmdb5CSVResultsTest getMatchesFromHmdb5WithUATest parse_hmdb_csv_resultsTest check_state_from_hmdb_uaTest test_matches_from_hmdb_uaTest extract_sub_mz_listsTest prepare_multi_masses_queryTest get_matches_from_hmdb_uaTest);
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
12 our %EXPORT_TAGS = ( ALL => [qw( testMatchesFromHmdb5WithUATest parseHmdb5CSVResultsTest getMatchesFromHmdb5WithUATest parse_hmdb_csv_resultsTest check_state_from_hmdb_uaTest test_matches_from_hmdb_uaTest extract_sub_mz_listsTest prepare_multi_masses_queryTest get_matches_from_hmdb_uaTest)] );
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
13
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
14 use lib '/Users/fgiacomoni/Inra/labs/perl/galaxy_tools/hmdb' ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
15 use lib::hmdb qw( :ALL ) ;
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 ## sub
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
20 sub extract_sub_mz_listsTest {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
21
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
22 my ($masses, $hmdb_limits, ) = @_ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
23
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
24 my $oHmdb = lib::hmdb->new() ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
25 my $submasses = $oHmdb->extract_sub_mz_lists($masses, $hmdb_limits ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
26
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
27 return ($submasses) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
28 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
29
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
30 ## sub
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
31 sub prepare_multi_masses_queryTest {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
32
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
33 my ($mzs ) = @_ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
34
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
35 my $oHmdb = lib::hmdb->new() ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
36 my ( $hmdb_masses, $nb_masses_to_submit ) = $oHmdb->prepare_multi_masses_query($mzs) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
37
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
38 return ($hmdb_masses) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
39 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
40
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
41 ## sub
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
42 sub get_matches_from_hmdb_uaTest {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
43
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
44 my ( $hmdb_masses, $delta, $molecular_species ) = @_ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
45
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
46 my $oHmdb = lib::hmdb->new() ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
47 my $hmdb_pages = $oHmdb->get_matches_from_hmdb_ua($hmdb_masses, $delta, $molecular_species) ;
10
4eb2de7c24d1 Master branch Updating - - Fxx
fgiacomoni
parents: 9
diff changeset
48 print Dumper $hmdb_pages ;
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
49 return ($hmdb_pages) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
50 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
51
23
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
52 ## sub
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
53 sub getMatchesFromHmdb5WithUATest {
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
54
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
55 my ( $hmdb_masses, $delta, $molecular_species ) = @_ ;
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
56
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
57 my $oHmdb = lib::hmdb->new() ;
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
58 my ($hmdb_pages, $status) = $oHmdb->getMatchesFromHmdb5WithUA($hmdb_masses, $delta, $molecular_species) ;
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
59 print Dumper $hmdb_pages ;
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
60 return ($hmdb_pages) ;
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
61 }
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
62
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
63
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
64 ## sub
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
65 sub test_matches_from_hmdb_uaTest {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
66
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
67 my $oHmdb = lib::hmdb->new() ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
68 my $status = $oHmdb->test_matches_from_hmdb_ua() ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
69 return ($status) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
70 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
71
23
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
72 ## sub
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
73 sub testMatchesFromHmdb5WithUATest {
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
74
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
75 my $oHmdb = lib::hmdb->new() ;
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
76 my $status = $oHmdb->testMatchesFromHmdb5WithUA() ;
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
77 return ($status) ;
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
78 }
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
79
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
80 ## sub
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
81 sub check_state_from_hmdb_uaTest {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
82 my ($status ) = @_ ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
83
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
84 my $oHmdb = lib::hmdb->new() ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
85 my $res = $oHmdb->check_state_from_hmdb_ua($status) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
86 return($res) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
87 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
88
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
89
23
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
90 ## sub
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
91 sub parseHmdb5CSVResultsTest {
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
92 my ($hmdb_pages, $mzs, $max ) = @_ ;
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
93
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
94 my $oHmdb = lib::hmdb->new() ;
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
95 my $result = $oHmdb->parseHmdb5CSVResults($hmdb_pages, $mzs, $max) ; ## hash format result
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
96 #print Dumper $result ;
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
97 return($result) ;
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 10
diff changeset
98 }
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
99
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
100 ## sub
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
101 sub parse_hmdb_csv_resultsTest {
4
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
102 my ($hmdb_pages, $mzs, $max ) = @_ ;
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
103
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
104 my $oHmdb = lib::hmdb->new() ;
4
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
105 my $result = $oHmdb->parse_hmdb_csv_results($hmdb_pages, $mzs, $max) ; ## hash format result
9
c32280662103 Master branch Updating - - Fxx
fgiacomoni
parents: 4
diff changeset
106 print Dumper $result ;
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
107 return($result) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
108 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
109
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
110
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
111 1 ;