changeset 1:e2cbcf6fa22e draft

master branch Updating with tag :CI_COMMIT_TAG - - Fxx
author fgiacomoni
date Sun, 11 Dec 2022 17:16:43 +0000
parents 86296c048e46
children 23970530a518
files Dockerfile HR2.xml README.txt conf_hr2.cfg hr2_manager.pl hr_out.tmpl lib/HR2_v1.04.cpp 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 test-data/out3.tabular
diffstat 7 files changed, 98 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Dockerfile	Sun Dec 11 17:16:43 2022 +0000
@@ -0,0 +1,41 @@
+#FROM pfem/perlfull
+FROM python:3.8-buster
+
+# set author
+LABEL maintainer="franck.giacomoni@inrae.fr"
+
+ENV PLANEMO_VENV_LOCATION /planemo-venv
+ENV CONDA /tmp/conda
+
+
+RUN apt-get update &&\
+    apt-get upgrade -y &&\
+    apt-get install --no-install-recommends --yes build-essential \
+    	git \
+        libgl1-mesa-glx \
+        libegl1-mesa \
+        libxrandr2 \
+        libxss1 \
+        libxcursor1 \
+        libxcomposite1 \
+        libasound2 \
+        libxi6 \
+        libxtst6 \
+#        python3 \
+#        python3-pip \
+        python-virtualenv && \
+    pip install virtualenv && \
+    python3 -m virtualenv "$PLANEMO_VENV_LOCATION" && \
+    . "$PLANEMO_VENV_LOCATION"/bin/activate && \
+    pip install --upgrade pip setuptools && \
+    pip install planemo numpy && \
+    pip install -U planemo && \
+    #planemo conda_init --conda_prefix "$CONDA" && \
+    apt-get autoremove -y && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists/*  && \
+    rm -rf /tmp/*  && \
+    rm -rf /var/tmp/*  && \
+    rm -rf /usr/bin/X11 ;
+    
+CMD []
\ No newline at end of file
--- a/HR2.xml	Wed Jun 05 09:40:20 2019 -0400
+++ b/HR2.xml	Sun Dec 11 17:16:43 2022 +0000
@@ -1,4 +1,4 @@
-<tool id="hr2" name="HR2 formula" version="1.1.1.7">
+<tool id="hr2" name="HR2 formula" version="1.1.2">
   <description>
         find a chemical formula from a accurate mass
   </description>
@@ -33,7 +33,7 @@
         -charge "${mode_condition.qtCharge}"
     #end if
     
-    -regleOr "$regleOr" -atomes "$atomes_basic" -atomessup "$atomes_sup"
+    -regleOr "$regleOr" -atomes_basic "$atomes_basic" -atomes_sup "$atomes_sup"
     -output1 "$variableMetadata" -outputView "$hr2ResView"
     -verbose "$verbose"
   ]]></command>
@@ -124,8 +124,7 @@
   		<param name="atomes_basic" value="C,O,N,H"/>
   		<param name="regleOr" value="NO"/>
   		<param name="verbose" value="3"/>
-  		<output name="variableMetadata" file="out_test01.tabular"/>
-  		<output name="hr2ResView" file="out_test01.html"/>
+  		<output name="variableMetadata" file="out1.tabular"/>
     </test>
     <test>
   		<param name="choice" value="NO"/>
@@ -136,8 +135,19 @@
   		<param name="atomes_basic" value="C,O,H"/>
   		<param name="regleOr" value="NO"/>
   		<param name="verbose" value="3"/>
-  		<output name="variableMetadata" file="out_test02.tabular"/>
-  		<output name="hr2ResView" file="out_test02.html"/>
+  		<output name="variableMetadata" file="out2.tabular"/>
+    </test>
+    <test>
+  		<param name="choice" value="NO"/>
+  		<param name="masse" value="427.019898895"/>
+  		<param name="tolerance" value="1.0"/>
+  		<param name="mode" value="neutral"/>
+  		<param name="qtCharge" value="1"/>
+  		<param name="atomes_basic" value="C,O,N,H,P"/>
+  		<param name="atomes_sup" value="S"/>
+  		<param name="regleOr" value="NO"/>
+  		<param name="verbose" value="3"/>
+  		<output name="variableMetadata" file="out3.tabular"/>
     </test>
   </tests>
   
--- a/hr2_manager.pl	Wed Jun 05 09:40:20 2019 -0400
+++ b/hr2_manager.pl	Sun Dec 11 17:16:43 2022 +0000
@@ -3,6 +3,7 @@
 ## script  : hr2_manager.pl
 ## VERSIONS :
 #	- 01/03/2019 : Fix P issue, permit more flexible atom settings and add requirements for conda auto managing.
+#	- 09/12/2022 : Fix "Additional atomes not taken into account" - Ticket issue #7 
 
 #=============================================================================
 #                              Included modules and versions
@@ -47,8 +48,8 @@
 				"mode:s"		=>	\$mode,
 				"charge:i"		=>	\$charge,
 				"regleOr:s"		=>	\$has_golden_rules,
-				"atomes:s"		=>	\$atomes_basic, # [basic atoms like CNOHP]
-				"atomessup:s"	=>	\$atomes,
+				"atomes_basic:s"=>	\$atomes_basic, # [basic atoms like CNOHP]
+				"atomes_sup:s"	=>	\$atomes,
 				"output1:s"		=>	\$output_csv,
 				"outputView:s"	=>	\$output_html,
 				"verbose:i"		=> 	\$verbose,
@@ -190,6 +191,9 @@
 	my ($tbody_object) = $oHtml->set_html_tbody_object( $nb_pages_for_html_out, $CONF->{HTML_ENTRIES_PER_PAGE} ) ;
 	($tbody_object) = $oHtml->add_mz_to_tbody_object($tbody_object, $CONF->{HTML_ENTRIES_PER_PAGE}, $masses, $ids, $parsed_results ) ;
 	($tbody_object) = $oHtml->add_entries_to_tbody_object($tbody_object, $parsed_results) ;
+	
+	print Dumper $tbody_object ;
+	
 	my $html_file = $binPath.'/'.$CONF->{'HTML_TEMPLATE'} ;
 	my $output = $oHtml->write_html_skel(\$output_html, $tbody_object, $nb_pages_for_html_out, $search_condition, $html_file, $CONF->{'JS_GALAXY_PATH'}, $CONF->{'CSS_GALAXY_PATH'}) ;
 	
@@ -270,15 +274,15 @@
 
 # hr2_manager is a script to elucide chemical formula by their accurate masses. The HiRes program is integrate in this package
 # Input : a accurate mass or a file of masses
-# Author : Franck Giacomoni and Marion Landi
-# Email : fgiacomoni\@clermont.inra.fr or mlandi\@clermont.inra.fr
-# Version : 1.1
+# Authors : Lain Pavot, Marion Landi and Franck Giacomoni
+# Email : franck.giacomoni\@inrae.fr
+# Version : 1.1.2
 # Created : 01/12/2011
-# Last Update : 09032014
+# Last Update : 06/12/2022
 USAGE :		 
 		hr2_manager.pl -h or
 		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]
-		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]
+		hr2_manager.pl -masse [double] -tolerance [float] -mode [positive, neutral or negative] -charge [int] -regleOr [yes or no] -atomes_basic [C, N, O, P, H ] -atomes_sup [S, F, Cl, K, B, A, 1 ] -output1 [csv file] -outputView [html file]
 	" ;
 	exit(1);
 }
@@ -294,8 +298,8 @@
 =head1 USAGE
 
  hr2_manager.pl -h or
- 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]
- 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]
+ 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] -atomes_basic [C, N, O, P, H ] -atomes_sup [S, F, Cl, K, B, A, 1 ] -output1 [csv file] -outputView [html file]
+ hr2_manager.pl -masse [double] -tolerance [float] -mode [positive, neutral or negative] -charge [int] -regleOr [yes or no] -atomes_basic [C, N, O, P, H ] -atomes_sup [S, F, Cl, K, B, A, 1 ] -output1 [csv file] -outputView [html file]
 
 =head1 SYNOPSIS
 
@@ -315,8 +319,9 @@
 
 =head1 AUTHOR
 
-Franck Giacomoni E<lt>franck.giacomoni@clermont.inra.frE<gt>
-Marion Landi E<lt>marion.landi@clermont.inra.frE<gt>
+Franck Giacomoni E<lt>franck.giacomoni@inrae.frE<gt>
+Marion Landi E<lt>marion.landi@inrae.frE<gt>
+Lain Pavot E<lt>lain.pavot@inrae.frE<gt>
 
 =head1 LICENSE
 
@@ -332,4 +337,6 @@
 
 version 4 : 01/03/2019
 
+version 5 : 09/12/2022
+
 =cut
\ No newline at end of file
--- a/lib/hr.pm	Wed Jun 05 09:40:20 2019 -0400
+++ b/lib/hr.pm	Sun Dec 11 17:16:43 2022 +0000
@@ -72,12 +72,15 @@
     # basic atoms case:
     foreach my $atom ( (split(",", $atombasic )) ) {
     	if ( exists $CONF->{$atom} ) 	{ $atomsconfig->{$atom}{'max'} = $CONF->{$atom} ; }
+    	else {  print "*** $atom not recognized***\n" ; }
     }
     
     # suppl. atoms case
     foreach my $atom ( (split(",", $atomsupp )) ) {
     	print "*** $atom***\n" ;
-    	if ( exists $atomsconfig->{$atom} ) 	{ $atomsconfig->{$atom} = $CONF->{'DEFAULT_MAX'} ; }
+    	if ( exists $atomsconfig->{$atom} ) 	{ $atomsconfig->{$atom}{'max'} = $CONF->{'DEFAULT_MAX'} ; }
+    	else {  print "*** $atom not recognized***\n" ; }
+    	
     }
     
     # Create atoms and range parameters:    
--- a/test-data/out1.html	Wed Jun 05 09:40:20 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?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 &copy; 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
--- a/test-data/out2.html	Wed Jun 05 09:40:20 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?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 &copy; 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/out3.tabular	Sun Dec 11 17:16:43 2022 +0000
@@ -0,0 +1,19 @@
+ID	MASS_SUBMIT	CPD_FORMULA	CPD_MW	DELTA
+mass_01	427.019898895	C18H10N3O8P1	427.0205509	-0.65
+mass_01	427.019898895	C13H7N11O3P2	427.0208564	-0.96
+mass_01	427.019898895	C12H11N7O7P2	427.0195190	0.38
+mass_01	427.019898895	C22H12N3O1P3	427.0193219	0.58
+mass_01	427.019898895	C13H5N11O5S1	427.0195830	0.32
+mass_01	427.019898895	C10H14N5O10P1S1	427.0198990	-0.00
+mass_01	427.019898895	C20H15N1O4P2S1	427.0197019	0.20
+mass_01	427.019898895	C21H9N5O2S2	427.0197659	0.13
+mass_01	427.019898895	C13H15N7O2P2S2	427.0203874	-0.49
+mass_01	427.019898895	C12H19N3O6P2S2	427.0190500	0.85
+mass_01	427.019898895	C10H24N1O7P3S2	427.0207034	-0.80
+mass_01	427.019898895	C14H9N11S3	427.0204514	-0.55
+mass_01	427.019898895	C13H13N7O4S3	427.0191140	0.78
+mass_01	427.019898895	C11H18N5O5P1S3	427.0207674	-0.87
+mass_01	427.019898895	C10H22N1O9P1S3	427.0194300	0.47
+mass_01	427.019898895	C21H17N1O1S4	427.0192969	0.60
+mass_01	427.019898895	C13H23N3O1P2S4	427.0199184	-0.02
+mass_01	427.019898895	C11H26N1O4P1S5	427.0202984	-0.40