annotate hmdb/t/lib/hmdbTest.pm @ 0:9583f9772198 draft

Init and uploaded
author fgiacomoni
date Thu, 28 Jan 2016 10:52:26 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
1 package lib::hmdbTest ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
2
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
3 use diagnostics; # this gives you more debugging information
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
4 use warnings; # this warns you of bad practices
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
5 use strict; # this prevents silly errors
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
6 use Exporter ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
7 use Carp ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
8
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
9 our $VERSION = "1.0";
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
10 our @ISA = qw(Exporter);
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
11 our @EXPORT = qw( 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);
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
12 our %EXPORT_TAGS = ( ALL => [qw( 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)] );
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
13
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
14 use lib '/Users/fgiacomoni/Inra/labs/perl/galaxy_tools/hmdb' ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
15 use lib::hmdb qw( :ALL ) ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
16
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
17 use Data::Dumper ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
18
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
19 ## sub
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
20 sub extract_sub_mz_listsTest {
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
21
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
22 my ($masses, $hmdb_limits, ) = @_ ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
23
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
24 my $oHmdb = lib::hmdb->new() ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
25 my $submasses = $oHmdb->extract_sub_mz_lists($masses, $hmdb_limits ) ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
26
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
27 return ($submasses) ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
28 }
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
29
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
30 ## sub
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
31 sub prepare_multi_masses_queryTest {
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
32
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
33 my ($mzs ) = @_ ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
34
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
35 my $oHmdb = lib::hmdb->new() ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
36 my ( $hmdb_masses, $nb_masses_to_submit ) = $oHmdb->prepare_multi_masses_query($mzs) ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
37
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
38 return ($hmdb_masses) ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
39 }
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
40
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
41 ## sub
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
42 sub get_matches_from_hmdb_uaTest {
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
43
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
44 my ( $hmdb_masses, $delta, $molecular_species ) = @_ ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
45
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
46 my $oHmdb = lib::hmdb->new() ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
47 my $hmdb_pages = $oHmdb->get_matches_from_hmdb_ua($hmdb_masses, $delta, $molecular_species) ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
48 return ($hmdb_pages) ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
49 }
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
50
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
51
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
52 ## sub
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
53 sub test_matches_from_hmdb_uaTest {
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
54
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
55 my $oHmdb = lib::hmdb->new() ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
56 my $status = $oHmdb->test_matches_from_hmdb_ua() ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
57 return ($status) ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
58 }
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
59
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
60
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
61 ## sub
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
62 sub check_state_from_hmdb_uaTest {
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
63 my ($status ) = @_ ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
64
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
65 my $oHmdb = lib::hmdb->new() ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
66 my $res = $oHmdb->check_state_from_hmdb_ua($status) ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
67 return($res) ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
68 }
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
69
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
70
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
71
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
72 ## sub
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
73 sub parse_hmdb_csv_resultsTest {
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
74 my ($hmdb_pages, $mzs ) = @_ ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
75
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
76 my $oHmdb = lib::hmdb->new() ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
77 my $result = $oHmdb->parse_hmdb_csv_results($hmdb_pages, $mzs) ; ## hash format result
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
78
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
79 return($result) ;
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
80 }
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
81
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
82
9583f9772198 Init and uploaded
fgiacomoni
parents:
diff changeset
83 1 ;