Next changeset 1:e2cbcf6fa22e (2022-12-11) |
Commit message:
Init repository for [hr2] |
added:
HR2.xml README.txt conf_hr2.cfg hr2_manager.pl hr_out.tmpl lib/HR2_v1.04.cpp lib/conf.pm lib/csv.pm lib/hr.pm static/images/hr2.png t/hr2_managerTest.t t/lib/hrTest.pm test-data/out1.html test-data/out1.tabular test-data/out2.html test-data/out2.tabular |
b |
diff -r 000000000000 -r 86296c048e46 HR2.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HR2.xml Wed Jun 05 09:40:20 2019 -0400 |
[ |
b'@@ -0,0 +1,303 @@\n+<tool id="hr2" name="HR2 formula" version="1.1.1.7">\r\n+ <description>\r\n+ find a chemical formula from a accurate mass\r\n+ </description>\r\n+ <requirements>\r\n+ <requirement type="package" version="2.161">perl-data-dumper</requirement>\r\n+ <requirement type="package" version="1.97">perl-text-csv</requirement>\r\n+ <requirement type="package" version="2.97">perl-html-template</requirement>\r\n+ <requirement type="package" version="1.04">hr2</requirement>\r\n+ </requirements>\r\n+ <stdio>\r\n+ <exit_code range="1" level="fatal" />\r\n+ </stdio>\r\n+ \r\n+ \r\n+ <command><![CDATA[\r\n+ perl $__tool_directory__/hr2_manager.pl\r\n+ #if str($input_type.choice) == "YES":\r\n+ -input "${input_type.input}"\r\n+ #if str($input_type.header.header_choice) == "yes":\r\n+ -nblineheader "${$input_type.header.nbHeader}"\r\n+ #end if\r\n+ -colId "${input_type.colId}" -colmass "${input_type.colmass}"\r\n+ #else: \r\n+ -masse "${input_type.masse}"\r\n+ #end if\r\n+ \r\n+ -tolerance "$tol"\r\n+ -mode "${mode_condition.mode}"\r\n+ #if str($mode_condition.mode) == "neutral":\r\n+ -charge "0"\r\n+ #else:\r\n+ -charge "${mode_condition.qtCharge}"\r\n+ #end if\r\n+ \r\n+ -regleOr "$regleOr" -atomes "$atomes_basic" -atomessup "$atomes_sup"\r\n+ -output1 "$variableMetadata" -outputView "$hr2ResView"\r\n+ -verbose "$verbose"\r\n+ ]]></command>\r\n+ \r\n+ <inputs>\r\n+ \t<conditional name="input_type">\r\n+ <param name="choice" type="select" display="radio" label="Would you use a file " help="if \'NO\' is selected then one or more mass(es) must be entered manually">\r\n+ <option value="YES">YES</option>\r\n+ <option value="NO">NO</option>\r\n+ </param>\r\n+ <when value="YES">\r\n+ <param name="input" label="File of masses" format="tabular" type="data" />\r\n+ <conditional name="header">\r\n+ <param name="header_choice" type="boolean" checked="true" truevalue="yes" falsevalue="no" label="Do you have a header?" help="if \'YES\' is selected then enter your number of header lines" />\r\n+ <when value="yes">\r\n+ <param name="nbHeader" label="Number of header lines" type="integer" value="1" min="1" size="10" help="number of lines not containing masses"/>\r\n+ </when>\r\n+ <when value="no"/>\r\n+ </conditional>\r\n+ <param name="colId" label="Column of Id" type="data_column" data_ref="input" accept_default="true" />\r\n+ <param name="colmass" label="Column of masses (MZ)" type="data_column" data_ref="input" accept_default="true" />\r\n+ </when>\r\n+ <when value="NO">\r\n+ <param name="masse" size="20" type="text" label="Mass (MZ) to submit" help="For a masses list, writes : m1 m2 m3. Your values \xe2\x80\x8b\xe2\x80\x8bmust be separated by spaces. You should use dot (.) like decimal separator"/>\r\n+ </when>\r\n+ </conditional>\r\n+ \r\n+ <param name="tol" label="Delta of mass (MZ) (in mmu)" type="float" value="1.0" min="0" max="9.0" help="Tolerance should be between 0 and 9.0 mmu. Default value is 1.0 mmu"/>\r\n+ <conditional name="mode_condition">\r\n+ <param name="mode" label="Molecular Species Searched" type="select" display="radio" help="Or ionization type of the molecule list. Use neutral only if only if the masses correspond to molecules and not to ions : query doesn\'t be a [M+H] or [M-H] ion">\r\n+ <option value="positive">positive</option>\r\n+ <option value="negative">negative</option>\r\n+ <option value="neutral" selected="true">neutral</option>\r\n+ </param>\r\n+ <when value="neutral"/>\r\n+ <when value="positive">\r\n+ <param name="qtCharge" label="Molecule initial charge" type="select" help="Use \'neutral\' if the molecule is not charged">\r\n+ <option value="1">1</option>\r\n+ <option value="2">2</option>\r\n+ <option value="3">3</option>\r\n+ </param>\r\n+ </when>\r\n+ <when value="negative">\r\n+ <param name='..b'te\r\n+ | Tobias Kind and Oliver Fiehn. (2007). "Seven Golden Rules for heuristic filtering of molecular formulas obtained by accurate mass spectrometry." BMC Bioinformatics p8:105 http://www.ncbi.nlm.nih.gov/pubmed/17389044\r\n+ | HR2 original program and its documentation are under GNU General Public License ("GPL") : GPL is a"contaminating" license. http://fiehnlab.ucdavis.edu/projects/Seven_Golden_Rules/Software\r\n+\r\n+\r\n+---------------------------------------------------\r\n+\r\n+==============\r\n+HR2 formula\r\n+==============\r\n+\r\n+-----------\r\n+Description\r\n+-----------\r\n+\r\n+ | Find a formula for the masses\r\n+ | only molecules with carbon (C) will be search\r\n+\r\n+\r\n+-----------------\r\n+Workflow position\r\n+-----------------\r\n+\r\n+\r\n+.. image:: ./static/images/metabolomics/hr2.png\r\n+ :width: 800\r\n+\r\n+\r\n+\r\n+\r\n+-----------\r\n+Input files\r\n+-----------\r\n+\r\n++-------------------------+-----------+\r\n+| Parameter : num + label | Format |\r\n++=========================+===========+\r\n+| 1 : variableMetadata | tabular |\r\n++-------------------------+-----------+\r\n+\r\n+File variableMetadata must have at least the 2 following columns : \r\n+ * Id : column to identify masses in the csv/tsv input file\r\n+ * Masses : column with all the masses in the csv/tsv input file\r\n+\r\n+\r\n+----------\r\n+Parameters\r\n+----------\r\n+\r\n+Would you use a file\r\n+ | Choose whether the masses are in a file or entered manually\r\n+ | YES (default) : parameters **File of masses ; Column of Id ; Number of header ; Column of masses** are visible\r\n+ | NO : parameter **Mass of the molecule** is visible\r\n+ |\r\n+\r\n+\r\n+If \'use file\'=\'YES\'\r\n+\r\n+Column of Id\r\n+ | Specify the column number for the id in the csv/tsv input file\r\n+ |\r\n+\r\n+Number of header lines\r\n+ | Number of lines not containing values \r\n+ |\r\n+\r\n+Column of masses\r\n+ | Specify the column number for the mass in the csv/tsv input file\r\n+ |\r\n+\r\n+If \'use file\'=\'NO\'\r\n+\r\n+Mass (MZ) to submit \r\n+ | Specify a list of mass to request\r\n+ | one or more mass(es) entered manually\r\n+ | For a masses list, writes : m1 m2 m3\r\n+ | You must separate yours values with space\r\n+ | dot (.) is for float number\r\n+ |\r\n+\r\n+In all cases :\r\n+\r\n+Delta\r\n+ | Tolerance of the gap in the mass\r\n+ | It should be between 0 and 9.0 mmu\r\n+\r\n+Ionization\r\n+ | Type of ionization of the molecule : *positif, negatif, neutral*\r\n+ | Use neutral if query doesn\'t be a [M+H] or [M-H] ion\r\n+ | HR2 knows only the weight of uncharged molecules\r\n+ | so we made \xe2\x80\x8b\xe2\x80\x8ba correction to the masses of the value of a proton before the search\r\n+ | if the masses are those from a spectrometry in positive or negatif mode.\r\n+ | **neutral** : will do a search on the mass unchanged.\r\n+\r\n+Initial charge\r\n+ | Use 0 if the molecule is not basically charged\r\n+\r\n+Exclude some basic atom(s)\r\n+ List of atoms that can be exclude to the molecule : *C, N, O, H, P*\r\n+\r\n+Golden rules\r\n+ | There are 7 golden rules\r\n+ | Some are too stringent, especially for small molecules\r\n+ | Use \'yes\' if you want more empirical formulas\r\n+\r\n+Add some optionnal atom(s)\r\n+ List of atoms that can be searched in addition to the molecule : *S, F, Cl, K, Br, Na, 13C*\r\n+\r\n+------------\r\n+Output files\r\n+------------\r\n+\r\n+Two types of files\r\n+ | hr2_VIEW.HTML : for viewing result via HTML.\r\n+ | hr2_TSV.tabular : for linking with others modules.\r\n+ | an excel-like output will be available. \r\n+ \r\n+---------------------------------------------------\r\n+\r\n+\r\n+---------------\r\n+Working example\r\n+---------------\r\n+\r\n+\r\n+.. class:: warningmark\r\n+\r\n+Refer to the corresponding "W4M HowTo" in http://workflow4metabolomics.org/howto section\r\n+ | Format Data For Postprocessing\r\n+ | Perform LCMS Annotations\r\n+\r\n+.. class:: warningmark\r\n+\r\n+And their "W4M courses 2018":\r\n+ | Using Galaxy4Metabolomics - W4M table format for Galaxy\r\n+ | Les banques d\'annotation - Annotation\r\n+\r\n+ ]]></help>\r\n+ <citations>\r\n+ <citation type="doi">10.1186/1471-2105-8-105</citation>\r\n+ </citations>\r\n+</tool>\r\n+\r\n' |
b |
diff -r 000000000000 -r 86296c048e46 README.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.txt Wed Jun 05 09:40:20 2019 -0400 |
b |
@@ -0,0 +1,63 @@ +## ****** HR2 environnemnt : ****** ## +# version sept 2014 M Landi / A LIEURADE, Cl LIONNET, P MARIJON, B RADISSON and L VARRAILHON / F Giacomoni + +## --- PERL compilator / libraries : --- ## +$ perl -v +This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi + +# libs CORE PERL : +use strict ; +use warnings ; +use Carp qw (cluck croak carp) ; +use Data::Dumper ; +use Getopt::Long ; +use FindBin ; + +# libs CPAN PERL : +$ perl -e 'use Text::CSV' +$ sudo perl -MCPAN -e shell +cpan> install Text::CSV + +# libs pfem PERL : already include in the package +use lib::conf qw( :ALL ) ; +use lib::csv qw( :ALL ) ; +-- + +## --- R bin and Packages : --- ## +NA +-- + +## --- Binary dependencies --- ## +Install folowing binaries : +* HR2 : +source : HR2_v1.04.cpp available in the tar ball at lib/HR2_v1.04.cpp +lab : http://jhau.maliwi.de/sci/ms.html for initial project and http://fiehnlab.ucdavis.edu/projects/Seven_Golden_Rules/Software/ for fork +install : in /opt/prog/metabolomics/hr2 (you can change this path in conf file : conf_hr2.cfg +compilation : g++ HR2_v1.04.cpp -o HR2-all-res_v1.04.exe + +The project is available on : +http://fiehnlab.ucdavis.edu/projects/Seven_Golden_Rules/Software/seven-golden-rules-supplement-v46.zip (the launch of the download may take some time) +~/seven-golden-rules-supplement-v46.zip/supplement/HR2-formula-generator/HR2.zip/HR2.cpp +OR +http://sourceforge.net/projects/hires/ : This proposed binary is an fork of the HiRes initial project. +-- + +## --- Config : --- ## +Edit the following lines in the config file : conf_hr2.cfg +lancerHR2=/your_hr2_binary_path/HR2-all-res_v1.04.exe +JS_GALAXY_PATH=http://YOUR_GALAXY_HOSTNAME/static/scripts/libs/outputs +CSS_GALAXY_PATH=http://YOUR_GALAXY_HOSTNAME/static/style +-- + +## --- XML HELP PART --- ## +one image : in the static/images dir +hr2.png +-- + +## --- DATASETS --- ## +No data set ! waiting for galaxy pages +-- + +## --- ??? COMMENTS ??? --- ## +In the PFEM version, the HR2 source (HR2_v*.cpp) is modified to correct atom exact masses. +For more information, please contact us. \ No newline at end of file |
b |
diff -r 000000000000 -r 86296c048e46 conf_hr2.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/conf_hr2.cfg Wed Jun 05 09:40:20 2019 -0400 |
b |
@@ -0,0 +1,36 @@ +## Conf file for hr2.pl script +# +## Version -- edited by F.Giacomoni / M Landi +VERSION=1.1.0 +# +## ARGVT +## hr2 binary path +HR2_EXE=HR2.exe +HR2_VERSION=hr version 20050617 +# +##Default parameter values +tolerance=1.0 +mode=positive +charge=0 +DEFAULT_ATOMS=C,H,O,N +# +## Range in hr cmd for each atom +DEFAULT_MIN=0 +DEFAULT_MAX=10 +C=100 +H=200 +O=70 +N=40 +P=10 +# +## MZ value +proton=1.007825 +electron=0.0005486 +# +## Galaxy url for HTML JS and CSS path +JS_GALAXY_PATH=https://cdn.rawgit.com/fgiacomoni/galaxy_utils/master/scripts +CSS_GALAXY_PATH=https://cdn.rawgit.com/fgiacomoni/galaxy_utils/master/style +# +## HTML OUTPUT : +HTML_ENTRIES_PER_PAGE=4 +HTML_TEMPLATE=hr_out.tmpl |
b |
diff -r 000000000000 -r 86296c048e46 hr2_manager.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hr2_manager.pl Wed Jun 05 09:40:20 2019 -0400 |
[ |
b'@@ -0,0 +1,335 @@\n+#!perl\r\n+\r\n+## script : hr2_manager.pl\r\n+## VERSIONS :\r\n+#\t- 01/03/2019 : Fix P issue, permit more flexible atom settings and add requirements for conda auto managing.\r\n+\r\n+#=============================================================================\r\n+# Included modules and versions\r\n+#=============================================================================\r\n+## Perl modules\r\n+use strict ;\r\n+use warnings ;\r\n+use Carp qw (cluck croak carp) ;\r\n+\r\n+use Data::Dumper ;\r\n+use Getopt::Long ;\r\n+use POSIX ;\r\n+use FindBin ; ## Allows you to locate the directory of original perl script\r\n+\r\n+## Dedicate Perl Modules (Home made...)\r\n+use lib $FindBin::Bin ;\r\n+my $binPath = $FindBin::Bin ;\r\n+use lib::hr qw( :ALL ) ;\r\n+## PFEM Perl Modules\r\n+use lib::conf qw( :ALL ) ;\r\n+use lib::csv qw( :ALL ) ;\r\n+\r\n+## Initialized values\r\n+use vars qw(%parametre);\r\n+my $help = undef ; \r\n+my ( $input_file, $line_header, $col_id, $col_mass ) = ( undef, undef, undef, undef ) ; # manage input option file of masses\r\n+my ( $mass ) = ( undef ) ; # manage input option masses list\r\n+my ( $tolerance, $mode, $charge, $has_golden_rules, $atomes, $atomes_basic ) = ( undef, undef, undef, undef, undef, undef ) ; # manage params\r\n+my ( $output_csv, $output_html ) = ( undef, undef) ; # manage ouputs\r\n+my $verbose = 2 ;\r\n+\r\n+#=============================================================================\r\n+# Manage EXCEPTIONS\r\n+#=============================================================================\r\n+&GetOptions ( \t"h" \t\t=> \t\\$help, # HELP\r\n+\t\t\t\t"input:s"\t\t=>\t\\$input_file,\r\n+\t\t\t\t"colId:i"\t\t=>\t\\$col_id,\r\n+\t\t\t\t"nbHeader:i"\t=>\t\\$line_header,\r\n+\t\t\t\t"colmass:i"\t\t=>\t\\$col_mass,\r\n+\t\t\t\t"masse:s"\t\t=>\t\\$mass,\r\n+\t\t\t\t"tolerance:f"\t=>\t\\$tolerance,\r\n+\t\t\t\t"mode:s"\t\t=>\t\\$mode,\r\n+\t\t\t\t"charge:i"\t\t=>\t\\$charge,\r\n+\t\t\t\t"regleOr:s"\t\t=>\t\\$has_golden_rules,\r\n+\t\t\t\t"atomes:s"\t\t=>\t\\$atomes_basic, # [basic atoms like CNOHP]\r\n+\t\t\t\t"atomessup:s"\t=>\t\\$atomes,\r\n+\t\t\t\t"output1:s"\t\t=>\t\\$output_csv,\r\n+\t\t\t\t"outputView:s"\t=>\t\\$output_html,\r\n+\t\t\t\t"verbose:i"\t\t=> \t\\$verbose,\r\n+ ) ;\r\n+ \r\n+#=============================================================================\r\n+# EXCEPTIONS\r\n+#=============================================================================\r\n+$help and &help ;\r\n+\r\n+#=============================================================================\r\n+# MAIN SCRIPT\r\n+#=============================================================================\r\n+my %atomsConf = () ;\r\n+$atomsConf{\'C\'} = {\'min\' => 0, \'max\' => 0} ;\r\n+$atomsConf{\t\'H\'} = {\'min\' => 0, \'max\' => 0} ;\r\n+$atomsConf{\t\'N\'} = {\'min\' => 0, \'max\' => 0} ;\r\n+$atomsConf{\t\'O\'} = {\'min\' => 0, \'max\' => 0} ;\r\n+$atomsConf{\t\'P\'} = {\'min\' => 0, \'max\' => 0} ;\r\n+$atomsConf{\t\'S\'} = {\'min\' => 0, \'max\' => 0} ;\r\n+$atomsConf{\t\'F\'} = {\'min\' => 0, \'max\' => 0} ;\r\n+$atomsConf{\t\'L\'} = {\'min\' => 0, \'max\' => 0} ;\r\n+$atomsConf{\t\'K\'} = {\'min\' => 0, \'max\' => 0} ;\r\n+$atomsConf{\t\'B\'} = {\'min\' => 0, \'max\' => 0} ;\r\n+$atomsConf{\t\'A\'} = {\'min\' => 0, \'max\' => 0} ;\r\n+$atomsConf{\t\'1\'} = {\'min\' => 0, \'max\' => 0} ;\r\n+\r\n+## -------------- Conf file and verbose ------------------------ :\r\n+my ( $CONF ) = ( undef ) ; ## verbose level is 3 for debugg\r\n+my $time_start = time ;\r\n+\r\n+foreach my $conf ( <$binPath/*.cfg> ) {\r\n+\tmy $oConf = lib::conf::new() ;\r\n+\t$CONF = $oConf->as_conf($conf) ;\r\n+}\r\n+## --------------- Global parameters ---------------- :\r\n+my ( $ids, $masses, $hr_cmds, $results, $parsed_results ) = ( undef, undef, undef, undef, undef ) ;\r\n+my $complete_rows = undef ;\r\n+my ($hr_atoms_list, $hr_atoms_and_ranges, $set_tol, ) = (undef, undef, undef, ) ;\r\n+\r\n+## Check and manage params\r\n+my $ohr = lib::hr->new() ;\r\n+\r\n+## set tolerance\r\n+$set_tol = $ohr->manage_tolerance( \\$tolerance, \\$CONF->{\'tolerance\'} ) ;\r\n+\r\n+## check HR exe envt :\r\n+my $hr_check = $ohr->check_hr_exe(\\$CONF->{\'HR2_EXE\'}, \\$CONF-'..b'elsif (defined $mass) {\r\n+\t\t$ocsv->write_csv_one_mass($masses, $ids, $parsed_results, $output_csv) ;\r\n+\t}\r\n+} ## END IF\r\n+else {\r\n+#\tcroak "Can\'t create a tabular output for HR2 : no result found or your output file is not defined\\n" ;\r\n+}\r\n+\r\n+\r\n+\r\n+### VERBOSE OUTPUTs\r\n+if ( $verbose == 3 ) {\r\n+\tprint "-- Conf file contains :\\n" ;\r\n+\tprint Dumper $CONF ;\r\n+\tprint "-- Atoms input list :\\n" ;\r\n+\tprint Dumper $atomes_basic ;\r\n+\tprint "-- Suppl. atoms input list :\\n" ;\r\n+\tprint Dumper $atomes ;\r\n+\tprint "-- HR envt ready :\\n" ;\r\n+\tprint Dumper $hr_check ;\r\n+\tprint "-- Atoms and ranges :\\n" ;\r\n+\tprint Dumper $atomsCurrentConf ;\r\n+\tprint "-- Tolerance :\\n" ;\r\n+\tprint Dumper $set_tol ;\r\n+\tprint "-- Complete input file :\\n" ;\r\n+\tprint Dumper $complete_rows ;\r\n+\tprint "-- Inputs initiales masses :\\n" ;\r\n+\tprint Dumper $masses ;\r\n+\tprint "-- Inputs initiales ids :\\n" ;\r\n+\tprint Dumper $ids ;\r\n+\tprint "-- Hr_Cmds :\\n" ;\r\n+\tprint Dumper $hr_cmds ;\r\n+\tprint "-- Hr_Results :\\n" ;\r\n+#\tprint Dumper $results ;\r\n+\tprint "-- Hr_parsed Results :\\n" ;\r\n+\tprint Dumper $parsed_results ;\r\n+\t\r\n+\tmy $nb_results = scalar (@{$results}) ;\r\n+\tprint "-- Hr_Results return : $nb_results\\n" ;\r\n+}\r\n+\r\n+my $time_end = time ;\r\n+my $seconds = $time_end-$time_start ;\r\n+print "\\n------ Time used in threaded mode by 6 : $seconds seconds --------\\n\\n" ;\r\n+\r\n+\r\n+\r\n+\r\n+\r\n+\r\n+#====================================================================================\r\n+# Help subroutine called with -h option\r\n+# number of arguments : 0\r\n+# Argument(s) :\r\n+# Return : 1\r\n+#====================================================================================\r\n+sub help {\r\n+\tprint STDERR "\r\n+hr2_manager.pl\r\n+\r\n+# hr2_manager is a script to elucide chemical formula by their accurate masses. The HiRes program is integrate in this package\r\n+# Input : a accurate mass or a file of masses\r\n+# Author : Franck Giacomoni and Marion Landi\r\n+# Email : fgiacomoni\\@clermont.inra.fr or mlandi\\@clermont.inra.fr\r\n+# Version : 1.1\r\n+# Created : 01/12/2011\r\n+# Last Update : 09032014\r\n+USAGE :\t\t \r\n+\t\thr2_manager.pl -h or\r\n+\t\thr2_manager.pl -input [cvs file of masses] -colId [int] -colmass [int] -nbHeader [int] -tolerance [float] -mode [positive, neutral or negative] -charge [int] -regleOr [yes or no] -atome [P, S, F, Cl, K, B, A, 1 ] -output1 [csv file] -outputView [html file]\r\n+\t\thr2_manager.pl -masse [double] -tolerance [float] -mode [positive, neutral or negative] -charge [int] -regleOr [yes or no] -atome [P, S, F, Cl, K, B, A, 1 ] -output1 [csv file] -outputView [html file]\r\n+\t" ;\r\n+\texit(1);\r\n+}\r\n+\r\n+## END of script - F Giacomoni \r\n+\r\n+__END__\r\n+\r\n+=head1 NAME\r\n+\r\n+ hr2_manager.pl -- script for launch / manage hr2 binary\r\n+\r\n+=head1 USAGE\r\n+\r\n+ hr2_manager.pl -h or\r\n+ hr2_manager.pl -input [cvs file of masses] -colId [int] -colmass [int] -nbHeader [int] -tolerance [float] -mode [positive, neutral or negative] -charge [int] -regleOr [yes or no] -atome [P, S, F, Cl, K, B, A, 1 ] -output1 [csv file] -outputView [html file]\r\n+ hr2_manager.pl -masse [double] -tolerance [float] -mode [positive, neutral or negative] -charge [int] -regleOr [yes or no] -atome [P, S, F, Cl, K, B, A, 1 ] -output1 [csv file] -outputView [html file]\r\n+\r\n+=head1 SYNOPSIS\r\n+\r\n+This script manages hr2 binary which elucids raw formula with exact masses.\r\n+\r\n+=head1 DESCRIPTION\r\n+\r\n+This main program is a module to elucidate chemical formula with HiRes program. Source is available on Fiehn lab web.\r\n+\r\n+=over 4\r\n+\r\n+=item B<function01>\r\n+\r\n+=item B<function02>\r\n+\r\n+=back\r\n+\r\n+=head1 AUTHOR\r\n+\r\n+Franck Giacomoni E<lt>franck.giacomoni@clermont.inra.frE<gt>\r\n+Marion Landi E<lt>marion.landi@clermont.inra.frE<gt>\r\n+\r\n+=head1 LICENSE\r\n+\r\n+This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.\r\n+\r\n+=head1 VERSION\r\n+\r\n+version 1 : 18/07/2012\r\n+\r\n+version 2 : 02/10/2013\r\n+\r\n+version 3 : 20/02/2014\r\n+\r\n+version 4 : 01/03/2019\r\n+\r\n+=cut\n\\ No newline at end of file\n' |
b |
diff -r 000000000000 -r 86296c048e46 hr_out.tmpl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hr_out.tmpl Wed Jun 05 09:40:20 2019 -0400 |
b |
@@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE html> +<html lang="en"> + <head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="description" content=""><meta name="author" content="INRA de Clermont-Ferrand"><title>Galaxy HR2 queries - All results</title><link rel="stylesheet" href="css.php" media="all"><link rel="stylesheet" href="<TMPL_VAR NAME=CSS_GALAXY_PATH>/simplePagination.css"/><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script><script src="<TMPL_VAR NAME=JS_GALAXY_PATH>/jquery.simplePagination.js"></script><style>body{padding-top:70px} div.lm-table-warning{font-size:1.4em;font-weight:bold;padding-right:25px;color:#21536a;margin-left:3px;}tr.green td{background-color:#eaf2d3;color:black;} tr.blank td{background-color:#9999CC;color:black;} table{font-family:\"Trebuchet MS\", Arial, Helvetica, sans-serif;width:100%;border-collapse:collapse;}table.detail, table.detail tr.parent, table.detail td, table.detail th, table.detail tr.category {border-collapse:collapse;border:1px solid #98bf21;}table.detail th {font-size:1.2em;text-align:center;padding-top:5px;padding-bottom:10px;background-color:#a7c942;color:#ffffff;}td.ca {text-align:center;}footer{margin:50px 0;}</style><script>function test(pageNumber){var page="#page-id-"+pageNumber;$('.select').hide();$(page).show()}</script></head> + <body><div class="container"><div class="lm-table-warning">Results of HR elucidation queries - <TMPL_VAR NAME=CONDITIONS></div><div id="detail_table_source" style="display:none"></div><p><div id="choose"></div><p><div id="ms_search_0" class="ms-search-table"></div><table id="detail_table" class="detail"><col style="width:20px;"><!-- Ids (m/z)--><col style="width:20px;"><!-- Mass (m/z)--><col style="width:20px;"><!-- Formula--><col style="width:60px;"><!-- cpd mw--><col style="width:50px;"><!-- delta--><col style="width:50px;"><!-- total--><thead><th>ID from input</th><th>Mass (m/z)</th><th>Formula</th><th>Compound MW (Da)</th><th>Delta</th><th>Total</th></thead><TMPL_LOOP NAME=PAGES><tbody class="select" id="page-id-<TMPL_VAR NAME=PAGE_NB>"><TMPL_LOOP NAME=MASSES><tr class="<TMPL_VAR NAME=MZ_COLOR>"><td class="ca" ><TMPL_VAR NAME=MASSES_ID_QUERY></td><td id="<TMPL_VAR NAME=MASSES_NB>" class="ca" ><TMPL_VAR NAME=MASSES_MZ_QUERY></td><td class="ca" colspan="3"></td><td class="ca" ><TMPL_VAR NAME=MASSES_TOTAL></td></tr><TMPL_LOOP NAME=ENTRIES><tr class="<TMPL_VAR NAME=ENTRY_COLOR>"><td class="ca" colspan="2"></td><td class="ca"><TMPL_VAR NAME=ENTRY_FORMULA></td><td class="ca"><TMPL_VAR NAME=ENTRY_CPD_MZ></td><td class="ca"><TMPL_VAR NAME=ENTRY_DELTA></td><td class="ca" colspan="1"></td></tr></TMPL_LOOP></TMPL_LOOP></tbody></TMPL_LOOP></table></div><div class="container"><hr><footer><div class="row"><div class="col-lg-12"><p><a href="http://jigsaw.w3.org/css-validator/check/referer" target="_blank"><img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS!" /></a></p><p>Copyright © INRA, N Paulhe, F Giacomoni 2014</a></p></div> </div></footer></div><script language="javascript">$(function() {$('#choose').pagination({items: <TMPL_VAR NAME=PAGES_NB>,itemsOnPage: 1,currentPage: 1,onInit: function () { test(1); },cssStyle: 'light-theme',onPageClick: function(pageNumber){test(pageNumber)}}).pagination('redraw');});</script></body> +</html> \ No newline at end of file |
b |
diff -r 000000000000 -r 86296c048e46 lib/HR2_v1.04.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/HR2_v1.04.cpp Wed Jun 05 09:40:20 2019 -0400 |
[ |
b'@@ -0,0 +1,1018 @@\n+/*\n+\n+ HR2.C\n+ V1.04\n+ (Changes: meb)\n+\n+ A program to calculate elemental compositions for a given mass.\n+ See the file README for details.\n+\n+--------------------------------------------------------------------\n+ Copyright (c) 2001...2005 Joerg Hau <joerg.hau(at)dplanet.ch>.\n+\n+ mail: joerg.hau@dplanet.ch\n+ www: http://www.mysunrise.ch/users/joerg.hau/\n+\n+ *changed version by Tobias Kind (TK), 2006 , Fiehnlab,\n+ *added extended valencies, added implementation of\n+ seven golden rules of molecular formula filtering\n+ \n+\n+ This program is free software; you can redistribute it and/or\n+ modify it under the terms of version 2 of the GNU General Public\n+ License as published by the Free Software Foundation. See the\n+ file LICENSE for details.\n+\n+ This program is distributed in the hope that it will be useful,\n+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n+ GNU General Public License for more details.\n+--------------------------------------------------------------------\n+\n+ Creation:\tsomewhere in 1992 by JHa.\n+ Revision: 2001-04-18, GPL\'d, first public release (JHa)\n+ 2001-04-21, improved help text (JHa)\n+ 2002-06-27, added sodium (JHa)\n+ 2002-10-09, added 15N (JHa)\n+ 2005-02-25, added -v option; license now GPL *v2* (JHa)\n+ 2005-02-27, optimised code in calc loop (JHa)\n+ 2005-02-28, verified and updated atomic masses (JHa)\n+ 2005-06-17, added GPL text when "-h" is used (JHa)\n+\t\t\t2006-01-01, extended version for BMC Bioinformatics publication - HR2 (TK)\n+\t\t\t2006-03-03, added element ratio checks, extended valencies, only even electrons - HR2 (TK)\n+\t\t\t2006-09-09,\t1000x-10000x speedup hand optimized hehe. - HR2 (TK)\n+\t\t\t\t\t\t-->special version for CHNSOP-F-Cl-Br-Si \n+\t\t\t2009-05-28, David Enot introduced the concept of \'Adducts\' (nadd) for MZedDB and corrected \n+\t\t\t\t\t\tsome inaccuracies in April 2008. Manfred Beckmann has now corrected the use of \n+\t\t\t\t\t\t\'nadd\' and \'charge\' by calculating \'nadd\' from \'charge\' using abscharge = abs(charge)\n+\t\t\t\t\t\t(did it manually because I couldn\'t find \'abs\') to correct \'measured_mass\' and limits, \n+\t\t\t\t\t\tbut keeping nadd = 0 for rdb calculation of neutral MW (MB)\n+\t\t\t2014-08-29, Marion Landi corrected the mass of atoms.\n+\n+ This is ANSI C and should compile with any C compiler; use\n+ something along the lines of "gcc -Wall -O3 -o hr hr.c".\n+ "g++ -O2 -o myhr HR2.cpp" on a Mac OS X G5 proc\n+ Optimize for speed, you may gain factor 3!\n+ NOW compiled under Visual C++ Express (faster than GCC) in C++ mode for boolean type.\n+\n+\n+ ---------------------------------------------------------------------\n+ Example arguments:\n+ 1) -m 1 -t 100000 -C 1-100 -H 1-220 -N 0-10 -O 0-10 -P 0-10 -S 0-10 -L 0-10 -B 0-10\n+ 2) -m 500 -t 1 -C 50-100 -H 10-220 -N 0-10 -O 0-10 -P 0-10 -S 0-10 -L 0-10 -B 0-10\n+ 3) hr2-all-res -c "Hexaflumuron_459.982882Da_3ppm" -m 459.982882 -t 1.37995 -C 0-39 -H 0-98 -N 0-34 -O 0-30 -P 0-12 -S 0-12 -F 0-12 -L 0-14 -B 0-7 -I 0-0 \n+\t945 formulas found in 253 seconds. (now 4 seconds, before eternal)\n+ 4) hr2 -m 459.982882 -t 1.37995 -C 10-39 -H 28-98 -N 4-34 -O 0-30 -P 1-12 -S 1-12 -F 0-12 -L 1-14 -B 2-6 -I 0-0\n+\t1 formula in 0 seconds (former eternal time)\n+ */\n+\n+#include <stdio.h>\n+#include <string.h>\n+#include <errno.h>\n+#include <time.h>\n+\n+/* Uncomment this for windows\n+#include <windows.h>\n+#include <process.h> \n+*/\n+#include <math.h>\n+\n+\n+#define VERSION "20050617"\t/* String ! */\n+#define TRUE \t1\n+#define FALSE \t0\n+#define MAXLEN 181 /* max. length of input string */\n+\n+#define _CRT_SECURE_NO_DEPRECATE 1\n+\n+typedef struct \t{\n+\t\tconst char *sym;\t/* symbol */\n+\t\tconst char *symi;\t/* non iso symbol */\n+\t\tconst double mass;\t/* accurate mass */\n+\t\tconst float val;\t/* to calculate unsaturations */\n+\t\tconst int key;\t\t/* used for decoding cmd line */\n+\t\tint min,\t\t/* atom count min */\n+\t\t max,\t\t/* atom '..b' SW [optLetter]* [argLetter space* argument]\n+*\n+* where\n+* - SW is \'-\'\n+* - there is no space before any optLetter or argLetter.\n+* - opt/arg letters are alphabetic, not punctuation characters.\n+* - optLetters, if present, must be matched in optionS.\n+* - argLetters, if present, are found in optionS followed by \':\'.\n+* - argument is any white-space delimited string. Note that it\n+* can include the SW character.\n+* - upper and lower case letters are distinct.\n+*\n+* There may be multiple option clusters on a command line, each\n+* beginning with a SW, but all must appear before any non-option\n+* arguments (arguments not introduced by SW). Opt/arg letters may\n+* be repeated: it is up to the caller to decide if that is an error.\n+*\n+* The character SW appearing alone as the last argument is an error.\n+* The lead-in sequence SWSW ("--") causes itself and all the rest\n+* of the line to be ignored (allowing non-options which begin\n+* with the switch char).\n+*\n+* The string *optionS allows valid opt/arg letters to be recognized.\n+* argLetters are followed with \':\'. Getopt () returns the value of\n+* the option character found, or EOF if no more options are in the\n+* command line. If option is an argLetter then the global optarg is\n+* set to point to the argument string (having skipped any white-space).\n+*\n+* The global optind is initially 1 and is always left as the index\n+* of the next argument of argv[] which getopt has not taken. Note\n+* that if "--" or "//" are used then optind is stepped to the next\n+* argument before getopt() returns EOF.\n+*\n+* If an error occurs, that is an SW char precedes an unknown letter,\n+* then getopt() will return a \'~\' character and normally prints an\n+* error message via perror(). If the global variable opterr is set\n+* to false (zero) before calling getopt() then the error message is\n+* not printed.\n+*\n+* For example, if\n+*\n+* *optionS == "A:F:PuU:wXZ:"\n+*\n+* then \'P\', \'u\', \'w\', and \'X\' are option letters and \'A\', \'F\',\n+* \'U\', \'Z\' are followed by arguments. A valid command line may be:\n+*\n+* aCommand -uPFPi -X -A L someFile\n+*\n+* where:\n+* - \'u\' and \'P\' will be returned as isolated option letters.\n+* - \'F\' will return with "Pi" as its argument string.\n+* - \'X\' is an isolated option.\n+* - \'A\' will return with "L" as its argument.\n+* - "someFile" is not an option, and terminates getOpt. The\n+* caller may collect remaining arguments using argv pointers.\n+***************************************************************************/\n+int getopt(int argc, char *argv[], char *optionS)\n+{\n+static char *letP\t= NULL;\t\t/* remember next option char\'s location */\n+static char SW\t\t= \'-\';\t\t/* switch character */\n+\n+int opterr = 1;\t\t\t\t/* allow error message\t*/\n+unsigned char ch;\n+char *optP;\n+\n+if (argc > optind)\n+\t{\n+\tif (letP == NULL)\n+\t\t{\n+\t\tif ((letP = argv[optind]) == NULL || *(letP++) != SW)\n+\t\t\tgoto gopEOF;\n+\n+\t\tif (*letP == SW)\n+\t\t\t{\n+\t\t\toptind++;\n+\t\t\tgoto gopEOF;\n+\t\t\t}\n+\t\t}\n+\tif (0 == (ch = *(letP++)))\n+\t\t{\n+\t\toptind++;\n+\t\tgoto gopEOF;\n+\t\t}\n+\tif (\':\' == ch || (optP = strchr(optionS, ch)) == NULL)\n+\t\tgoto gopError;\n+\tif (\':\' == *(++optP))\n+\t\t{\n+\t\toptind++;\n+\t\tif (0 == *letP)\n+\t\t\t{\n+\t\t\tif (argc <= optind)\n+\t\t\t\tgoto gopError;\n+\t\t\tletP = argv[optind++];\n+\t\t\t}\n+\t\toptarg = letP;\n+\t\tletP = NULL;\n+\t}\n+\telse\n+\t{\n+\tif (0 == *letP)\n+\t\t{\n+\t\toptind++;\n+\t\tletP = NULL;\n+\t\t}\n+\toptarg = NULL;\n+\t}\n+\treturn ch;\n+}\n+\n+gopEOF:\n+\toptarg = letP = NULL;\n+\treturn EOF;\n+\n+gopError:\n+\toptarg = NULL;\n+\terrno = EINVAL;\n+\tif (opterr)\n+\t\tperror ("Command line option");\n+\treturn (\'~\');\n+}\n+\n+/*\n+List of elements sorted according to mass\n+_______________________\n+INo#\tEl\tMass\n+2\t\tH\t1.007825032\n+3\t\tD\t2.014101778\n+0\t\tC\t12\n+1\t\t13C\t13.00335484\n+4\t\tN\t14.00307401\n+5\t\t15N\t15.0001089\n+6\t\tO\t15.99491462\n+7\t\tF\t18.9984032\n+8\t\tNa\t22.98976967\n+9\t\tSi\t27.97692653\n+10\t\tP\t30.97376151\n+11\t\tS\t31.97207069\n+12\t\tCl\t34.96885271\n+13\t\tBr\t78.9183376\n+------------------------\n+*/\n' |
b |
diff -r 000000000000 -r 86296c048e46 lib/conf.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/conf.pm Wed Jun 05 09:40:20 2019 -0400 |
[ |
@@ -0,0 +1,259 @@ +package lib::conf ; + +use strict; +use warnings ; +use Exporter ; +use Carp ; +use Data::Dumper ; + +use vars qw($VERSION @ISA @EXPORT %EXPORT_TAGS); + +our $VERSION = "1.0" ; +our @ISA = qw(Exporter) ; +our @EXPORT = qw( as_conf get_value_from_conf check_path_and_file ) ; +our %EXPORT_TAGS = ( ALL => [qw( as_conf get_value_from_conf )] ) ; + +=head1 NAME + +conf - A module for manage pfem conf file + +=head1 SYNOPSIS + + use conf ; + my $object = conf->new() ; + +=head1 DESCRIPTION + +This module does manage conf file (extract all or selected fields) + +=head1 METHODS + +Methods are : + +=head2 METHOD new + + ## Description : new + ## Input : $self + ## Ouput : bless $self ; + ## Usage : new() ; + +=cut +## START of SUB +sub new { + ## Variables + my $self={}; + bless($self) ; + return $self ; +} +### END of SUB + +=head2 METHOD as_conf + + ## Description : permet de cr�er l'object conf � partir d'un fichier de conf de type KEY=VALUE + ## Input : $file + ## Ouput : $oConf (a hash) + ## Usage : my ( $oConf ) = as_conf( $file ) ; + +=cut +## START of SUB +sub as_conf { + ## Retrieve Values + my $self = shift ; + my ( $file, $separator ) = @_ ; + +# if (!defined $separator) { $separator = ';' } ## set separator to ; + + if ( !defined $file ) { croak "Can't create object with an none defined file\n" ; } + + my %Conf = () ; ## Hash devant contenir l'ensemble des parametres locaux + + if (-e $file) { + open (CFG, "<$file") or die "Can't open $file\n" ; + while (<CFG>) { + chomp $_ ; + if ( $_ =~ /^#(.*)/) { next ; } + elsif ($_ =~/^(\w+?)=(.*)/) { ## ALPHANUMERIC OR UNDERSCORE ONLY FOR THE KEY AND ANYTHING ELSE FOR VALUE + + my ($key, $value) = ($1, $2) ; + + if (defined $separator) { + if ( $value=~/$separator/ ) { ## is a list to split + my @tmp = split(/$separator/ , $value) ; + $Conf{$key} = \@tmp ; + } + } + else { + $Conf{$key} = $value ; + } + } + } + close(CFG) ; + } + else { + croak "Can't create object with an none existing file\n" ; + } + + return ( \%Conf ) ; +} +## END of SUB + +=head2 METHOD as_conf_list + + ## Description : permet de charger une liste txt en array + ## Input : $file + ## Output : elements + ## Usage : my ( elements ) = as_conf_list( $conf_file ) ; + +=cut +## START of SUB +sub as_conf_list { + ## Retrieve Values + my $self = shift ; + my ( $file ) = @_ ; + + my @elements = () ; + if ( !defined $file ) { croak "Can't create object with an none defined file\n" ; } + + if (-e $file) { + open (CFG, "<$file") or die "Can't open $file\n" ; + while (<CFG>) { + chomp $_ ; + if ( $_ =~ /^#(.*)/) { next ; } + elsif ($_ =~/^(.*)/) { if (defined $1) { push (@elements, $1) ; } } + } + } + else { + croak "Can't create object with an none existing file\n" ; + } + return(\@elements) ; +} +## END of SUB + +=head2 METHOD get_value_from_conf + + ## Description : permet de retourner une valeur du hash de conf � partir d'une key + ## Input : $oConf, $Key + ## Ouput : $Value + ## Usage : my ( $Value ) = get_value_from_conf( $oConf, $Key ) ; + +=cut +## START of SUB +sub get_value_from_conf { + ## Retrieve Values + my $self = shift ; + my ( $oConf, $Key ) = @_ ; + + my $Value = undef ; + + if ( defined $oConf ) { + if ( defined $oConf->{$Key} ) { + $Value = $oConf->{$Key} ; + } + } + else { + croak "Can't manage value with undefined object\n" ; + } + return($Value) ; +} +## END of SUB + +=head2 METHOD get_value_from_conf + + ## Description : permet de retourner une valeur du hash de conf � partir d'une key + ## Input : $oConf, $Key + ## Ouput : $Value + ## Usage : my ( $Value ) = get_value_from_conf( $oConf, $Key ) ; + +=cut +## START of SUB +sub split_value_from_conf { + ## Retrieve Values + my $self = shift ; + my ( $oConf, $Key, $sep ) = @_ ; + + my $value = undef ; + my @values = () ; + + if ( defined $oConf ) { + if ( defined $oConf->{$Key} ) { + $value = $oConf->{$Key} ; + @values = split ( /$sep/, $value) ; + } + } + else { + croak "Can't manage value with undefined object\n" ; + } + return(\@values) ; +} +## END of SUB + + +=head2 METHOD check_path_and_file + + ## Description : permet de v�rifier les path et la pr�sence des exe d�crits dans le file conf. Bloque le script en cas de probleme + ## Input : $oConfs + ## Ouput : NA + ## Usage : &get_value_from_conf( $oConf ) ; + +=cut +## START of SUB +sub check_path_and_file { + + my $self = shift ; + my ( $oConfs ) = @_ ; + + foreach my $conf ( keys %{ $oConfs } ) { + if ( $conf =~ /^FILE/ ) { + if ( -e $oConfs->{$conf} ) { + if ( -s $oConfs->{$conf} ) { next ; } + else { carp "[Warning] : The size of file $oConfs->{$conf} is null\n" ; } + } + else { + carp "[Warning] : The file $oConfs->{$conf} doesn't exist\n" ; + } + } + elsif ( $conf =~ /^PATH/ ) { + if ( -d $oConfs->{$conf} ) { next ; } + else { carp "[Warning] : The dir $oConfs->{$conf} doesn't exist\n" ; } + } + else { next ; } + } + return ; +} +## END of SUB + +1 ; + + +__END__ + +=head1 SUPPORT + +You can find documentation for this module with the perldoc command. + + perldoc conf.pm + + +=head1 Exports + +=over 4 + +=item :ALL is as_conf get_value_from_conf + +=back + +=head1 AUTHOR + +Franck Giacomoni E<lt>franck.giacomoni@clermont.inra.frE<gt> + +=head1 LICENSE + +This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. + +=head1 VERSION + +version 1 : 10 / 02 / 2013 + +version 2 : ?? + +=cut \ No newline at end of file |
b |
diff -r 000000000000 -r 86296c048e46 lib/csv.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/csv.pm Wed Jun 05 09:40:20 2019 -0400 |
[ |
@@ -0,0 +1,282 @@ +package lib::csv ; + +use strict; +use warnings ; +use Exporter ; +use Carp ; + +use Text::CSV ; + +use Data::Dumper ; + +use vars qw($VERSION @ISA @EXPORT %EXPORT_TAGS); + +our $VERSION = "1.0"; +our @ISA = qw(Exporter); +our @EXPORT = qw( get_csv_object get_value_from_csv ); +our %EXPORT_TAGS = ( ALL => [qw( get_csv_object get_value_from_csv )] ); + +=head1 NAME + +My::Module - An example module + +=head1 SYNOPSIS + + use My::Module; + my $object = My::Module->new(); + print $object->as_string; + +=head1 DESCRIPTION + +This module does not really exist, it +was made for the sole purpose of +demonstrating how POD works. + +=head1 METHODS + +Methods are : + +=head2 METHOD new + + ## Description : new + ## Input : $self + ## Ouput : bless $self ; + ## Usage : new() ; + +=cut + +sub new { + ## Variables + my $self={}; + bless($self) ; + return $self ; +} +### END of SUB + +=head2 METHOD get_csv_object + + ## Description : builds a csv object and etablishes format + ## Input : $separator + ## Output : $csv + ## Usage : my ( $csv ) = get_csv_object( $separator ) ; + +=cut +## START of SUB +sub get_csv_object { + ## Retrieve Values + my $self = shift ; + my ( $separator ) = @_ ; + +# my $csv = Text::CSV->new({'sep_char' => "$separator"}); + my $csv = Text::CSV->new ( {'sep_char' => "$separator", binary => 1 } ) # should set binary attribute. + or die "Cannot use CSV: ".Text::CSV->error_diag (); + + return($csv) ; +} +## END of SUB + +=head2 METHOD get_value_from_csv + + ## Description : extract a targeted column in a csv file + ## Input : $csv, $file, $column, $is_header + ## Output : $value + ## Usage : my ( $value ) = get_value_from_csv( $csv, $file, $column, $is_header ) ; + +=cut +## START of SUB +sub get_value_from_csv { + ## Retrieve Values + my $self = shift ; + my ( $csv, $file, $column, $is_header ) = @_ ; + + my @value = () ; + + ## Adapte the number of the colunm : (nb of column to position in array) + $column = $column - 1 ; + + open (CSV, "<", $file) or die $! ; + + my $line = 0 ; + + while (<CSV>) { + $line++ ; + chomp $_ ; + # file has a header + if ( defined $is_header ) { if ($line == 1) { next ; } } + # parsing the targeted column + if ( $csv->parse($_) ) { + my @columns = $csv->fields(); + push ( @value, $columns[$column] ) ; + } + else { + my $err = $csv->error_input; + die "Failed to parse line: $err"; + } + } + close CSV; + return(\@value) ; +} +## END of SUB + +=head2 METHOD get_value_from_csv_multi_header + + ## Description : extract a targeted column in a csv file + ## Input : $csv, $file, $column, $is_header, $nb_header + ## Output : $value + ## Usage : my ( $value ) = get_value_from_csv_multi_header( $csv, $file, $column, $is_header, $nb_header ) ; + +=cut +## START of SUB +sub get_value_from_csv_multi_header { + ## Retrieve Values + my $self = shift ; + my ( $csv, $file, $column, $is_header, $nb_header ) = @_ ; + + my @value = () ; + + ## Adapte the number of the colunm : (nb of column to position in array) + $column = $column - 1 ; + + open (CSV, "<", $file) or die $! ; + + my $line = 0 ; + + while (<CSV>) { + $line++ ; + chomp $_ ; + # file has a header + if ( defined $is_header and $is_header eq 'yes') { if ($line <= $nb_header) { next ; } } + # parsing the targeted column + if ( $csv->parse($_) ) { + my @columns = $csv->fields(); + push ( @value, $columns[$column] ) ; + } + else { + my $err = $csv->error_input; + die "Failed to parse line: $err"; + } + } + close CSV; + return(\@value) ; +} +## END of SUB + +=head2 METHOD parse_csv_object + + ## Description : parse_all csv object and return a array of rows + ## Input : $csv, $file + ## Output : $csv_matrix + ## Usage : my ( $csv_matrix ) = parse_csv_object( $csv, $file ) ; + +=cut +## START of SUB +sub parse_csv_object { + ## Retrieve Values + my $self = shift ; + my ( $csv, $file ) = @_ ; + + my @csv_matrix = () ; + + open my $fh, "<:encoding(utf8)", $$file or die "Can't open csv file $$file: $!"; + + while ( my $row = $csv->getline( $fh ) ) { + push @csv_matrix, $row; + } + $csv->eof or $csv->error_diag(); + close $fh; + + return(\@csv_matrix) ; +} +## END of SUB + +=head2 METHOD parse_allcsv_object + + ## Description : parse_all csv object and return a array of rows with or without header + ## Input : $csv, $file, $keep_header + ## Output : $csv_matrix + ## Usage : my ( $csv_matrix ) = parse_csv_object( $csv, $file, $keep_header ) ; + +=cut +## START of SUB +sub parse_allcsv_object { + ## Retrieve Values + my $self = shift ; + my ( $csv, $file, $keep_header ) = @_ ; + + my @csv_matrix = () ; + my $line = 1 ; + + open my $fh, "<:encoding(utf8)", $$file or die "Can't open csv file $$file: $!"; + + while ( my $row = $csv->getline( $fh ) ) { + if ( ( $keep_header eq 'n' ) and ($line == 1) ) { } + else { push @csv_matrix, $row; } + $line ++ ; + } + my $status = $csv->eof or $csv->error_diag(); + close $fh; + + return(\@csv_matrix, $status) ; +} +## END of SUB + + +=head2 METHOD write_csv_from_arrays + + ## Description : write a csv file from list of rows + ## Input : $csv, $file_name, $rows + ## Output : $csv_file + ## Usage : my ( $csv_file ) = write_csv_from_arrays( $csv, $file_name, $rows ) ; + +=cut +## START of SUB +sub write_csv_from_arrays { + ## Retrieve Values + my $self = shift ; + my ( $csv, $file_name, $rows ) = @_ ; + + my $fh = undef ; + $csv->eol ("\n"); ## end-of-line string to add to rows + open $fh, ">:encoding(utf8)", "$file_name" or die "$file_name: $!"; + + my $status = $csv->print ($fh, $_) for @{$rows}; + close $fh or die "$file_name: $!"; + + return(\$file_name) ; +} +## END of SUB + +1 ; + + +__END__ + +=head1 SUPPORT + +You can find documentation for this module with the perldoc command. + + perldoc csv.pm + +=head1 Exports + +=over 4 + +=item :ALL is get_csv_object, get_value_from_csv + +=back + +=head1 AUTHOR + +Franck Giacomoni E<lt>franck.giacomoni@clermont.inra.frE<gt> + +=head1 LICENSE + +This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. + +=head1 VERSION + +version 1 : 23 / 10 / 2013 + +version 2 : ?? + +=cut \ No newline at end of file |
b |
diff -r 000000000000 -r 86296c048e46 lib/hr.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/hr.pm Wed Jun 05 09:40:20 2019 -0400 |
[ |
b'@@ -0,0 +1,775 @@\n+package lib::hr ;\r\n+\r\n+use strict;\r\n+no strict "refs" ;\r\n+use warnings ;\r\n+use Exporter ;\r\n+use threads ;\r\n+use HTML::Template ;\r\n+use Carp ;\r\n+\r\n+use Data::Dumper ;\r\n+\r\n+use vars qw($VERSION @ISA @EXPORT %EXPORT_TAGS);\r\n+\r\n+our $VERSION = "1.0";\r\n+our @ISA = qw(Exporter);\r\n+our @EXPORT = qw( manage_atoms_and_ranges manage_atoms check_hr_exe manage_atom_and_range manage_tolerance manage_mode config_hr_exe );\r\n+our %EXPORT_TAGS = ( ALL => [qw(manage_atoms_and_ranges manage_atoms check_hr_exe manage_atom_and_range manage_tolerance manage_mode config_hr_exe )] );\r\n+\r\n+=head1 NAME\r\n+\r\n+lib::hr - A module for managing / launching hr binary (structure elucidation c++ progr)\r\n+\r\n+=head1 SYNOPSIS\r\n+\r\n+ use lib::hr;\r\n+ my $object = lib::hr->new();\r\n+ print $object->as_string;\r\n+\r\n+=head1 DESCRIPTION\r\n+\r\n+This module does not really exist, it\r\n+was made for the sole purpose of\r\n+demonstrating how POD works.\r\n+\r\n+=head1 METHODS\r\n+\r\n+Methods are :\r\n+\r\n+=head2 METHOD new\r\n+\r\n+\t## Description : new\r\n+\t## Input : $self\r\n+\t## Ouput : bless $self ;\r\n+\t## Usage : new() ;\r\n+\r\n+=cut\r\n+\r\n+sub new {\r\n+ ## Variables\r\n+ my $self={};\r\n+ bless($self) ;\r\n+ return $self ;\r\n+}\r\n+### END of SUB\r\n+\r\n+=head2 METHOD manage_atoms_and_ranges\r\n+\r\n+\t## Description : allow from an initial config to add or delete atoms and their range\r\n+\t## Input : $atomsconfig, $atombasic, $atomsupp\r\n+\t## Output : $atomcleanconfig\r\n+\t## Usage : my ( $atomcleanconfig ) = manage_atoms_and_ranges ( $atomsconfig, $atombasic, $atomsupp ) ;\r\n+\t\r\n+=cut\r\n+## START of SUB\r\n+sub manage_atoms_and_ranges {\r\n+ ## Retrieve Values\r\n+ my $self = shift ;\r\n+ my ( $atomsconfig, $CONF, $atombasic, $atomsupp ) = @_;\r\n+ my ( $atomcleanconfig ) = ( undef ) ;\r\n+ \r\n+ # basic atoms case:\r\n+ foreach my $atom ( (split(",", $atombasic )) ) {\r\n+ \tif ( exists $CONF->{$atom} ) \t{ $atomsconfig->{$atom}{\'max\'} = $CONF->{$atom} ; }\r\n+ }\r\n+ \r\n+ # suppl. atoms case\r\n+ foreach my $atom ( (split(",", $atomsupp )) ) {\r\n+ \tprint "*** $atom***\\n" ;\r\n+ \tif ( exists $atomsconfig->{$atom} ) \t{ $atomsconfig->{$atom} = $CONF->{\'DEFAULT_MAX\'} ; }\r\n+ }\r\n+ \r\n+ # Create atoms and range parameters: \r\n+ foreach my $selectedAtom ( keys %{$atomsconfig} ) {\r\n+ \t$atomcleanconfig .= \' -\'.$selectedAtom.\' \'.$atomsconfig->{$selectedAtom}{\'min\'}.\'-\'.$atomsconfig->{$selectedAtom}{\'max\'} ;\r\n+ }\r\n+ \r\n+ return ($atomcleanconfig) ;\r\n+}\r\n+### END of SUB\r\n+\r\n+\r\n+ \r\n+=head2 METHOD manage_atoms ### DEPRECATED\r\n+\r\n+\t## Description : controles atoms input list and prepare it like hr binary parameter \r\n+\t## Input : $input_atoms, $conf_atoms\r\n+\t## Output : $hr_atoms_param\r\n+\t## Usage : my ( $hr_atoms_param ) = manage_atoms( $input_atoms, $conf_atoms ) ;\r\n+\t### DEPRECATED\r\n+\t\r\n+=cut\r\n+## START of SUB\r\n+sub manage_atoms { ### DEPRECATED\r\n+\t## Retrieve Values\r\n+ my $self = shift ;\r\n+ my ( $input_atoms, $conf_atoms ) = @_ ;\r\n+ my $hr_atoms_param = undef ;\r\n+ \r\n+ if ( ( defined $$input_atoms ) and ( defined $$conf_atoms ) ) {\r\n+ \tif ( ( $$input_atoms eq \'None\' ) or ( $$input_atoms eq \'\' ) or ( $$input_atoms eq \' \' ) )\t{ $hr_atoms_param = $$conf_atoms ; \t}\r\n+ \telsif ( $$input_atoms =~ /[P|S|F|L|K|B|A|1|,]+/ ) { $hr_atoms_param = $$conf_atoms.\',\'.$$input_atoms ; }\r\n+ \telse \t\t\t\t\t\t\t{ $hr_atoms_param = $$conf_atoms ; \t}\r\n+ } ## END IF\r\n+ elsif ( !defined $$input_atoms ) { \t$hr_atoms_param = $$conf_atoms ; }\r\n+ elsif ( !defined $$conf_atoms ) { \twarn "hr module can\'t manage any atom list (undef values in conf)\\n" ; }\r\n+ else {\t\t\t\t\t\t \twarn "hr module musn\'t manage any atom list\\n" ; }\r\n+ \r\n+ return(\\$hr_atoms_param) ;\r\n+}\r\n+## END of SUB\r\n+\r\n+=head2 METHOD manage_atom_and_range ### DEPRECATED\r\n+\r\n+\t## Description : build atom range with defined value in conf file\r\n+\t## Input : $atom, $min, $max\r\n+\t## Output : $hr_range\r\n+\t## Usage : my ( ) = manage_atom_and_range( $atom, $min, $max ) ;\r\n+\t### DEPREC'..b'ription : build a full matrix (input + lm column)\r\n+\t## Input : $input_matrix_object, $lm_matrix_object\r\n+\t## Output : $output_matrix_object\r\n+\t## Usage : my ( $output_matrix_object ) = add_hr_matrix_to_input_matrix( $input_matrix_object, $hr_matrix_object ) ;\r\n+\t\r\n+=cut\r\n+## START of SUB\r\n+sub add_hr_matrix_to_input_matrix {\r\n+\t## Retrieve Values\r\n+ my $self = shift ;\r\n+ my ( $input_matrix_object, $hr_matrix_object ) = @_ ;\r\n+ \r\n+ my @output_matrix_object = () ;\r\n+ my $index_row = 0 ;\r\n+ \r\n+ foreach my $row ( @{$input_matrix_object} ) {\r\n+ \tmy @init_row = @{$row} ;\r\n+ \t\r\n+ \tif ( $hr_matrix_object->[$index_row] ) {\r\n+ \t\tmy $dim = scalar(@{$hr_matrix_object->[$index_row]}) ;\r\n+ \t\t\r\n+ \t\tif ($dim > 1) { warn "the add method can\'t manage more than one column\\n" ;}\r\n+ \t\tmy $lm_col = $hr_matrix_object->[$index_row][$dim-1] ;\r\n+\r\n+ \t\t \tpush (@init_row, $lm_col) ;\r\n+\t \t$index_row++ ;\r\n+ \t}\r\n+ \tpush (@output_matrix_object, \\@init_row) ;\r\n+ }\r\n+ return(\\@output_matrix_object) ;\r\n+}\r\n+## END of SUB\r\n+\r\n+=head2 METHOD write_csv_skel\r\n+\r\n+\t## Description : prepare and write csv output file\r\n+\t## Input : $csv_file, $rows\r\n+\t## Output : $csv_file\r\n+\t## Usage : my ( $csv_file ) = write_csv_skel( $csv_file, $rows ) ;\r\n+\t\r\n+=cut\r\n+## START of SUB\r\n+sub write_csv_skel {\r\n+\t## Retrieve Values\r\n+ my $self = shift ;\r\n+ my ( $csv_file, $rows ) = @_ ;\r\n+ \r\n+ my $ocsv = lib::csv::new() ;\r\n+\tmy $csv = $ocsv->get_csv_object("\\t") ;\r\n+\t$ocsv->write_csv_from_arrays($csv, $$csv_file, $rows) ;\r\n+ \r\n+ return($csv_file) ;\r\n+}\r\n+## END of SUB\r\n+\r\n+=head2 METHOD set_hr_matrix_object\r\n+\r\n+\t## Description : build the hr_row under its ref form\r\n+\t## Input : $header, $init_mzs, $entries\r\n+\t## Output : $hr_matrix\r\n+\t## Usage : my ( $hmdb_matrix ) = set_hr_matrix_object( $header, $init_mzs, $entries ) ;\r\n+\t\r\n+=cut\r\n+## START of SUB\r\n+sub set_hr_matrix_object {\r\n+\t## Retrieve Values\r\n+ my $self = shift ;\r\n+ my ( $header, $init_mzs, $entries ) = @_ ;\r\n+ \r\n+ my @hr_matrix = () ;\r\n+ \r\n+ if ( defined $header ) {\r\n+ \tmy @headers = () ;\r\n+ \tpush @headers, $header ;\r\n+ \tpush @hr_matrix, \\@headers ;\r\n+ }\r\n+ \r\n+ my $index_mz = 0 ;\r\n+ \r\n+ foreach my $mz ( @{$init_mzs} ) {\r\n+ \t\r\n+ \tmy $index_entries = 0 ;\r\n+ \tmy @clusters = () ;\r\n+ \tmy $cluster_col = undef ;\r\n+ \t\r\n+ \tmy $nb_entries = $entries->[$index_mz]{MASSES_TOTAL} ;\r\n+ \t\r\n+ \tforeach (@{$entries->[$index_mz]{\'ENTRY_FORMULA\'}}) {\r\n+ \t\t\t\t\r\n+ \t\tmy $delta = $entries->[$index_mz]{\'ENTRY_DELTA\'}[$index_entries] ;\r\n+\t \tmy $hr_formula = $entries->[$index_mz]{\'ENTRY_FORMULA\'}[$index_entries] ;\r\n+\t \tmy $hr_mz = $entries->[$index_mz]{\'ENTRY_CPD_MZ\'}[$index_entries] ;\r\n+ \t\t\r\n+\t \t\r\n+\t \t## METLIN data display model \r\n+\t \t\t## entry1=VAR1::VAR2::VAR3::VAR4|entry2=VAR1::VAR2::VAR3::VAR4|...\r\n+\t \t\t# manage final pipe\r\n+\t \t\tif ($index_entries < $$nb_entries-1 ) { \t$cluster_col .= $delta.\'::(\'.$hr_formula.\')::\'.$hr_mz.\'|\' ; }\r\n+\t \t\telse { \t\t\t\t\t\t \t\t\t$cluster_col .= $delta.\'::(\'.$hr_formula.\')::\'.$hr_mz ; \t}\r\n+\t \t\t\r\n+\t \t$index_entries++ ;\r\n+\t } ## end foreach\r\n+\t if ( !defined $cluster_col ) { $cluster_col = \'No_result_found_with HR\' ; }\r\n+ \tpush (@clusters, $cluster_col) ;\r\n+ \tpush (@hr_matrix, \\@clusters) ;\r\n+ \t$index_mz++ ;\r\n+ }\r\n+ return(\\@hr_matrix) ;\r\n+}\r\n+## END of SUB\r\n+\r\n+\r\n+\r\n+1 ;\r\n+\r\n+\r\n+__END__\r\n+\r\n+=head1 SUPPORT\r\n+\r\n+You can find documentation for this module with the perldoc command.\r\n+\r\n+ perldoc hr.pm\r\n+\r\n+=head1 Exports\r\n+\r\n+=over 4\r\n+\r\n+=item :ALL is manage_atoms, check_hr_exe, manage_tolerance\r\n+\r\n+=back\r\n+\r\n+=head1 AUTHOR\r\n+\r\n+Franck Giacomoni E<lt>franck.giacomoni@clermont.inra.frE<gt>\r\n+\r\n+=head1 LICENSE\r\n+\r\n+This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.\r\n+\r\n+=head1 VERSION\r\n+\r\n+version 1 : 02 / 20 / 2014\r\n+\r\n+version 2 : ??\r\n+\r\n+=cut\n\\ No newline at end of file\n' |
b |
diff -r 000000000000 -r 86296c048e46 static/images/hr2.png |
b |
Binary file static/images/hr2.png has changed |
b |
diff -r 000000000000 -r 86296c048e46 t/hr2_managerTest.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/t/hr2_managerTest.t Wed Jun 05 09:40:20 2019 -0400 |
[ |
@@ -0,0 +1,64 @@ +#! perl +use diagnostics; +use warnings; +no warnings qw/void/; +use strict; +no strict "refs" ; +#use Test::More qw( no_plan ); +use Test::More tests => 29 ; +use FindBin ; + +## Specific Modules +use lib $FindBin::Bin ; +my $binPath = $FindBin::Bin ; +use lib::hrTest qw( :ALL ) ; + +## testing manage_atoms +print "\n-- Test manage_atoms lib\n\n" ; +is( manage_atomsTest('', 'C,H,O,N'),'C,H,O,N', 'Works with void argvt' ) ; +is( manage_atomsTest(undef, 'C,H,O,N'), 'C,H,O,N', 'Works with undef argvt in input'); +isnt( manage_atomsTest('C,H,O,N', undef), 'C,H,O,N', 'Doesn\'t work with undef argvt in conf'); +is( manage_atomsTest(' ', 'C,H,O,N'), 'C,H,O,N', 'Works with \'space\' argvt in input' ) ; +is( manage_atomsTest('None', 'C,H,O,N'), 'C,H,O,N', 'Works with \'None\' argvt in input' ) ; +isnt( manage_atomsTest('C,H,O,N', 'C,H,O,N'), 'C,H,O,N', 'Doesn\'t work with same argvt in conf and input' ); +is( manage_atomsTest('P', 'C,H,O,N'), 'C,H,O,N,P', 'Works with P argvt in input'); +is( manage_atomsTest('1', 'C,H,O,N'), 'C,H,O,N,1', 'Works with 13C argvt in input'); +is( manage_atomsTest('P,S', 'C,H,O,N'), 'C,H,O,N,P,S', 'Works with P and S argvt in input'); +is( manage_atomsTest('X', 'C,H,O,N'), 'C,H,O,N', 'Doesn\'t work with other character diff than [P|S|F|L|K|B|A|1|] in input'); +print "\n--\n" ; + +print "\n-- Test check_hr_exe lib\n\n" ; +is ( check_hr_exeTest('J:\\BioInfoTools\\_BINARIES\\HR2-all-res.exe', 'hr version 20050617'), 1, 'Works with WIN path and good version') ; +is ( check_hr_exeTest('J:\\BioInfoTools\\_BINARIES\\HR2-all-res.exe', undef), undef, 'Doesn\'t work with WIN path and bad version') ; +is ( check_hr_exeTest('Z:\\BioInfoTools\\TOTO\\HR2-all-res.exe', 'hr version 20050617'), undef, 'Doesn\'t work with bullshit path and good version') ; +is ( check_hr_exeTest(undef, 'hr version 20050617'), undef, 'Doesn\'t work with undef path and good version') ; +# need to test unix path +print "\n--\n" ; + +print "\n-- Test manage_tolerance lib --\n\n" ; +is ( manage_toleranceTest( '5.0', '1.0' ), '5.0', 'Works with tolerance of 5.0' ) ; +is ( manage_toleranceTest( '5,0', '1.0' ), '5.0', 'Works with tolerance of 5,0 (french number)' ) ; +is ( manage_toleranceTest( undef, '1.0' ), undef, 'Doesn\'t work with undef tolerance' ) ; +is ( manage_toleranceTest( '5.0', undef ), undef, 'Doesn\'t work with undef default tolerance' ) ; +is ( manage_toleranceTest( '20.0', '1.0' ), '1.0', 'Works with hight tolerance (20.0), use default tolerance' ) ; +is ( manage_toleranceTest( '-10.0', '1.0' ), '1.0', 'Works with negative tolerance (-10.0), use default tolerance' ) ; +print "\n--\n" ; + +print "\n-- Test manage_mode lib\n\n" ; +is ( manage_modeTest('positive', '1', '0.0005486', '1.007825', '100.00'), '98.9927236', 'Works and computes right mass (98.9927236) with positive mode and complete conf') ; +is ( manage_modeTest('negative', '1', '0.0005486', '1.007825', '100.00') , '101.0072764', 'Works and computes right mass (101.0072764) with negative mode and complete conf') ; +is ( manage_modeTest('neutral', '1', '0.0005486', '1.007825', '100.00' ), '100.00', 'Works and computes right mass (100.00) with neutral mode and complete conf') ; +is ( manage_modeTest('banane', '1', '0.0005486', '1.007825', '100.00' ), undef, 'Works and warns with unbelievable argt mode') ; +is ( manage_modeTest('positive', '1', '0.0005486', '1.007825', '100,00' ), '98.9927236', 'Works with french mass format in positive mode') ; +is ( manage_modeTest('neutral', '1', undef, undef, '100.00' ), undef, 'Works and warns when missing some conf paramaters (electron, proton, mass)') ; +is ( manage_modeTest('negative', '0', '0.0005486', '1.007825', '100.00') , '101.0072764', 'Works and computes right mass (101.0072764) with negative mode and charge = 0 become 1 ') ; +is ( manage_modeTest('positive', '3', '0.0005486', '1.007825', '100.00'), '298.9938208', 'Works and computes right mass (298.9938208) with positive mode, charge = 3 and complete conf') ; +is ( manage_modeTest('neutral', undef, '0.0005486', '1.007825', '100.00' ), '100.00', 'Works and warns when missing charge') ; +print "\n--\n" ; + + + + + + + |
b |
diff -r 000000000000 -r 86296c048e46 t/lib/hrTest.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/t/lib/hrTest.pm Wed Jun 05 09:40:20 2019 -0400 |
[ |
@@ -0,0 +1,53 @@ +package lib::hrTest ; + +use diagnostics; # this gives you more debugging information +use warnings; # this warns you of bad practices +use strict; # this prevents silly errors +use Exporter ; +use Carp ; + +our $VERSION = "1.0"; +our @ISA = qw(Exporter); +our @EXPORT = qw( manage_atomsTest check_hr_exeTest manage_toleranceTest manage_modeTest ); +our %EXPORT_TAGS = ( ALL => [qw(manage_atomsTest check_hr_exeTest manage_toleranceTest manage_modeTest )] ); + +use lib '/Users/fgiacomoni/Inra/labs/perl/galaxy_tools/hr2' ; +use lib::hr qw( :ALL ) ; + +sub manage_atomsTest { + + my ($input_atoms, $conf_atoms, ) = @_ ; + + my $oAtom = lib::hr->new() ; + my $ref_atoms = $oAtom->manage_atoms(\$input_atoms, \$conf_atoms) ; + my $atoms = $$ref_atoms ; + + return ($atoms) ; +} + +sub check_hr_exeTest { + my ( $hr_path, $hr_version ) = @_ ; + my $oHr = lib::hr->new() ; + my $res = $oHr->check_hr_exe(\$hr_path, \$hr_version) ; + + return ($res) ; +} + +sub manage_toleranceTest { + my ( $tolerance, $default_value ) = @_ ; + my $oHr = lib::hr->new() ; + my $tol = $oHr->manage_tolerance( \$tolerance, \$default_value ) ; + return ($$tol) ; +} + +sub manage_modeTest { + my ( $mode, $charge, $electron, $proton, $mass ) = @_ ; + my $oHr = lib::hr->new() ; + my $exact_mass = $oHr->manage_mode( \$mode, \$charge, \$electron, \$proton, \$mass ) ; + return ($$exact_mass) ; +} + + + + +1 ; \ No newline at end of file |
b |
diff -r 000000000000 -r 86296c048e46 test-data/out1.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/out1.html Wed Jun 05 09:40:20 2019 -0400 |
b |
@@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE html> +<html lang="en"> + <head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="description" content=""><meta name="author" content="INRA de Clermont-Ferrand"><title>Galaxy HR2 queries - All results</title><link rel="stylesheet" href="css.php" media="all"><link rel="stylesheet" href="https://cdn.rawgit.com/fgiacomoni/galaxy_utils/master/style/simplePagination.css"/><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script><script src="https://cdn.rawgit.com/fgiacomoni/galaxy_utils/master/scripts/jquery.simplePagination.js"></script><style>body{padding-top:70px} div.lm-table-warning{font-size:1.4em;font-weight:bold;padding-right:25px;color:#21536a;margin-left:3px;}tr.green td{background-color:#eaf2d3;color:black;} tr.blank td{background-color:#9999CC;color:black;} table{font-family:\"Trebuchet MS\", Arial, Helvetica, sans-serif;width:100%;border-collapse:collapse;}table.detail, table.detail tr.parent, table.detail td, table.detail th, table.detail tr.category {border-collapse:collapse;border:1px solid #98bf21;}table.detail th {font-size:1.2em;text-align:center;padding-top:5px;padding-bottom:10px;background-color:#a7c942;color:#ffffff;}td.ca {text-align:center;}footer{margin:50px 0;}</style><script>function test(pageNumber){var page="#page-id-"+pageNumber;$('.select').hide();$(page).show()}</script></head> + <body><div class="container"><div class="lm-table-warning">Results of HR elucidation queries - Mode used: negative / Charge: +1 / Mass tolerance: 1.0 / Composition: -C 0-100 -A 0-0 -1 0-0 -B 0-0 -K 0-0 -N 0-40 -P 0-0 -S 0-0 -O 0-70 -H 0-200 -F 0-0 -L 0-0</div><div id="detail_table_source" style="display:none"></div><p><div id="choose"></div><p><div id="ms_search_0" class="ms-search-table"></div><table id="detail_table" class="detail"><col style="width:20px;"><!-- Ids (m/z)--><col style="width:20px;"><!-- Mass (m/z)--><col style="width:20px;"><!-- Formula--><col style="width:60px;"><!-- cpd mw--><col style="width:50px;"><!-- delta--><col style="width:50px;"><!-- total--><thead><th>ID from input</th><th>Mass (m/z)</th><th>Formula</th><th>Compound MW (Da)</th><th>Delta</th><th>Total</th></thead><tbody class="select" id="page-id-1"><tr class="white"><td class="ca" >mass_01</td><td id="1" class="ca" >175.125</td><td class="ca" colspan="3"></td><td class="ca" >1</td></tr><tr class="white"><td class="ca" colspan="2"></td><td class="ca">C11H16N2</td><td class="ca">176.1313485</td><td class="ca">0.93</td><td class="ca" colspan="1"></td></tr></tbody></table></div><div class="container"><hr><footer><div class="row"><div class="col-lg-12"><p><a href="http://jigsaw.w3.org/css-validator/check/referer" target="_blank"><img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS!" /></a></p><p>Copyright © INRA, N Paulhe, F Giacomoni 2014</a></p></div> </div></footer></div><script language="javascript">$(function() {$('#choose').pagination({items: 1,itemsOnPage: 1,currentPage: 1,onInit: function () { test(1); },cssStyle: 'light-theme',onPageClick: function(pageNumber){test(pageNumber)}}).pagination('redraw');});</script></body> +</html> \ No newline at end of file |
b |
diff -r 000000000000 -r 86296c048e46 test-data/out1.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/out1.tabular Wed Jun 05 09:40:20 2019 -0400 |
b |
@@ -0,0 +1,2 @@ +ID MASS_SUBMIT CPD_FORMULA CPD_MW DELTA +mass_01 175.125 C11H16N2 176.1313485 0.93 |
b |
diff -r 000000000000 -r 86296c048e46 test-data/out2.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/out2.html Wed Jun 05 09:40:20 2019 -0400 |
b |
@@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE html> +<html lang="en"> + <head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="description" content=""><meta name="author" content="INRA de Clermont-Ferrand"><title>Galaxy HR2 queries - All results</title><link rel="stylesheet" href="css.php" media="all"><link rel="stylesheet" href="https://cdn.rawgit.com/fgiacomoni/galaxy_utils/master/style/simplePagination.css"/><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script><script src="https://cdn.rawgit.com/fgiacomoni/galaxy_utils/master/scripts/jquery.simplePagination.js"></script><style>body{padding-top:70px} div.lm-table-warning{font-size:1.4em;font-weight:bold;padding-right:25px;color:#21536a;margin-left:3px;}tr.green td{background-color:#eaf2d3;color:black;} tr.blank td{background-color:#9999CC;color:black;} table{font-family:\"Trebuchet MS\", Arial, Helvetica, sans-serif;width:100%;border-collapse:collapse;}table.detail, table.detail tr.parent, table.detail td, table.detail th, table.detail tr.category {border-collapse:collapse;border:1px solid #98bf21;}table.detail th {font-size:1.2em;text-align:center;padding-top:5px;padding-bottom:10px;background-color:#a7c942;color:#ffffff;}td.ca {text-align:center;}footer{margin:50px 0;}</style><script>function test(pageNumber){var page="#page-id-"+pageNumber;$('.select').hide();$(page).show()}</script></head> + <body><div class="container"><div class="lm-table-warning">Results of HR elucidation queries - Mode used: neutral / Charge: +1 / Mass tolerance: 1.0 / Composition: -K 0-0 -B 0-0 -F 0-0 -H 0-200 -L 0-0 -P 0-0 -C 0-100 -A 0-0 -1 0-0 -O 0-70 -S 0-0 -N 0-0</div><div id="detail_table_source" style="display:none"></div><p><div id="choose"></div><p><div id="ms_search_0" class="ms-search-table"></div><table id="detail_table" class="detail"><col style="width:20px;"><!-- Ids (m/z)--><col style="width:20px;"><!-- Mass (m/z)--><col style="width:20px;"><!-- Formula--><col style="width:60px;"><!-- cpd mw--><col style="width:50px;"><!-- delta--><col style="width:50px;"><!-- total--><thead><th>ID from input</th><th>Mass (m/z)</th><th>Formula</th><th>Compound MW (Da)</th><th>Delta</th><th>Total</th></thead><tbody class="select" id="page-id-1"><tr class="white"><td class="ca" >mass_01</td><td id="1" class="ca" >88.052</td><td class="ca" colspan="3"></td><td class="ca" >1</td></tr><tr class="white"><td class="ca" colspan="2"></td><td class="ca">C4H8O2</td><td class="ca">88.0524295</td><td class="ca">-0.43</td><td class="ca" colspan="1"></td></tr></tbody></table></div><div class="container"><hr><footer><div class="row"><div class="col-lg-12"><p><a href="http://jigsaw.w3.org/css-validator/check/referer" target="_blank"><img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS!" /></a></p><p>Copyright © INRA, N Paulhe, F Giacomoni 2014</a></p></div> </div></footer></div><script language="javascript">$(function() {$('#choose').pagination({items: 1,itemsOnPage: 1,currentPage: 1,onInit: function () { test(1); },cssStyle: 'light-theme',onPageClick: function(pageNumber){test(pageNumber)}}).pagination('redraw');});</script></body> +</html> \ No newline at end of file |
b |
diff -r 000000000000 -r 86296c048e46 test-data/out2.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/out2.tabular Wed Jun 05 09:40:20 2019 -0400 |
b |
@@ -0,0 +1,2 @@ +ID MASS_SUBMIT CPD_FORMULA CPD_MW DELTA +mass_01 88.052 C4H8O2 88.0524295 -0.43 |