Skip to content

Commit

Permalink
more HTML improvements to table
Browse files Browse the repository at this point in the history
  • Loading branch information
stuchalk committed Jan 29, 2024
1 parent 4a51ff6 commit 4c07316
Showing 1 changed file with 88 additions and 56 deletions.
144 changes: 88 additions & 56 deletions book/usecases/uvvis_metadata.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"source": [
"### 3.2 File hierarchy\n",
"\n",
"<table border=\"1\" style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">\n",
"<table border=\"1\">\n",
" <tr style=\"background-color:gray;\">\n",
" <td colspan=\"4\"><strong>Raw Data</strong></td>\n",
" </tr>\n",
Expand All @@ -83,10 +83,10 @@
" <td><b>Format</b></td>\n",
" </tr>\n",
" <tr>\n",
" <td>Data matrix (with or without column headings)</td>\n",
" <td>Spectrophotometer output as tabular data (absorbance and wavelength)</td>\n",
" <td>Essential</td>\n",
" <td>CSV (.csv)<br/>JCAMP–DX (.jdx)</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Data matrix (with or without column headings)</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Spectrophotometer output as tabular data (absorbance and wavelength)</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Essential</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">CSV (.csv)<br/>JCAMP–DX (.jdx)</td>\n",
" </tr>\n",
" <tr style=\"background-color:gray;\">\n",
" <td colspan=\"4\"><strong> Sample level metadata </strong></td>\n",
Expand All @@ -98,36 +98,36 @@
" <td><b>Format</b></td>\n",
" </tr>\n",
" <tr>\n",
" <td>Sample ID</td>\n",
" <td>Identifier for the sample which is unique within the project</td>\n",
" <td>Essential</td>\n",
" <td rowspan=\"4\">Plain text (.txt)<br/>XML (.xml)<br/>R Markdown (.rmd)<br/>Jupyter Notebook <br/>Markdown (.ipynb)</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Sample ID</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Identifier for the sample which is unique within the project</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Essential</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\" rowspan=\"4\">Plain text (.txt)<br/>XML (.xml)<br/>R Markdown (.rmd)<br/>Jupyter Notebook <br/>Markdown (.ipynb)</td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">Linking sample ID</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">Provenance identifier for the sample in the associated process capture document (digital or paper notebook)</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">Essential</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Linking sample ID</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Provenance identifier for the sample in the associated process capture document (digital or paper notebook)</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Essential</td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">Data labels (if absent from the data matrix)</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">Description and units for the tabular raw data columns</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">Essential</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Data labels (if absent from the data matrix)</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Description and units for the tabular raw data columns</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Essential</td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">Sample concentration, solvent, optical path length, user ID and date/time of collection</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">Experimental parameters</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">Essential</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Sample concentration, solvent, optical path length, user ID and date/time of collection</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Experimental parameters</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Essential</td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\" rowspan=\"2\">Chemical structure</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">Chemical structure identifier in the form of an alphanumeric text string</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">Essential</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">InChI<br/>SMILES</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\" rowspan=\"2\">Chemical structure</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Chemical structure identifier in the form of an alphanumeric text string</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Essential</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">InChI<br/>SMILES</td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">SMILES validation</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">Desirable</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">Toolkit(version) identifier</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">SMILES validation</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Desirable</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Toolkit(version) identifier</td>\n",
" </tr>\n",
" <tr style=\"background-color:gray;\">\n",
" <td colspan=\"4\"><strong> Analysis level metadata </strong></td>\n",
Expand All @@ -139,16 +139,16 @@
" <td><b>Format</b></td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">Processed data matrix</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">Tabular data: absorbance, wavelength, and molar absorptivity (ε); with data labels and units</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">Essential</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">CSV (.csv)</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Processed data matrix</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Tabular data: absorbance, wavelength, and molar absorptivity (ε); with data labels and units</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Essential</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">CSV (.csv)</td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">Data reporting:<b/r><br/>1. Plot of the UV/Vis spectrum<br/>2. <em>&lambda;</em><sub>max</sub> and &epsilon; (Section 4)</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">The two key outputs required for publication.</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">Essential</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;\">R Markdown (.rmd)<br/>Jupyter Notebook<br/>Markdown (.ipynb)</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Data reporting:<b/r><br/>1. Plot of the UV/Vis spectrum<br/>2. <em>&lambda;</em><sub>max</sub> and &epsilon; (Section 4)</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">The two key outputs required for publication.</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">Essential</td>\n",
" <td style=\"word-wrap: break-word; max-width: 400px;vertical-align: top;\">R Markdown (.rmd)<br/>Jupyter Notebook<br/>Markdown (.ipynb)</td>\n",
" </tr>\n",
" <tr style=\"background-color:gray;\">\n",
" <td colspan=\"4\"><strong> Project level metadata </strong></td>\n",
Expand All @@ -160,27 +160,27 @@
" <td><b>Format</b></td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;\">Study ID</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;\">Identifier(s) for the scientific study; funder’s project ID(s)</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;\">Desirable</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;\" rowspan = \"2\">Plain text (.txt)<br/>XML (.xml)<br/>R Markdown (.rmd)<br/>Jupyter Notebook<br/>Markdown (.ipynb)</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;vertical-align: top;\">Study ID</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;vertical-align: top;\">Identifier(s) for the scientific study; funder’s project ID(s)</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;vertical-align: top;\">Desirable</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;vertical-align: top;\" rowspan = \"2\">Plain text (.txt)<br/>XML (.xml)<br/>R Markdown (.rmd)<br/>Jupyter Notebook<br/>Markdown (.ipynb)</td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;\">Instrument ID</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;\">Spectrophotometer vendor and version.</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;\">Desirable</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;vertical-align: top;\">Instrument ID</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;vertical-align: top;\">Spectrophotometer vendor and version.</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;vertical-align: top;\">Desirable</td>\n",
" \n",
" </tr>\n",
" <tr>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;\">Data storage location</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;\">Link to the data storage location</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;\">Essential</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;\" rowspan = \"2\">URL for an open access repository deposition</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;vertical-align: top;\">Data storage location</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;vertical-align: top;\">Link to the data storage location</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;vertical-align: top;\">Essential</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;vertical-align: top;\" rowspan = \"2\">URL for an open access repository deposition</td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;\">Spectrophotometer calibration</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;\">Link to structured calibration data</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;\">Essential</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;vertical-align: top;\">Spectrophotometer calibration</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;vertical-align: top;\">Link to structured calibration data</td>\n",
" <td style=\"word-wrap: break-word; max-width: 200px;vertical-align: top;\">Essential</td>\n",
" </tr> \n",
" </table>\n"
]
Expand Down Expand Up @@ -255,15 +255,28 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"id": "1f3e5d74",
"metadata": {
"ExecuteTime": {
"end_time": "2024-01-29T18:10:51.575720Z",
"start_time": "2024-01-29T18:10:48.136208Z"
"end_time": "2024-01-29T18:32:14.294665Z",
"start_time": "2024-01-29T18:32:11.043267Z"
}
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: jcamp in /Users/n00002621/.local/share/virtualenvs/WFChemCookbook-hyZchOOL/lib/python3.11/site-packages (1.2.2)\r\n",
"Requirement already satisfied: numpy in /Users/n00002621/.local/share/virtualenvs/WFChemCookbook-hyZchOOL/lib/python3.11/site-packages (from jcamp) (1.26.3)\r\n",
"Requirement already satisfied: datetime in /Users/n00002621/.local/share/virtualenvs/WFChemCookbook-hyZchOOL/lib/python3.11/site-packages (from jcamp) (5.4)\r\n",
"Requirement already satisfied: zope.interface in /Users/n00002621/.local/share/virtualenvs/WFChemCookbook-hyZchOOL/lib/python3.11/site-packages (from datetime->jcamp) (6.1)\r\n",
"Requirement already satisfied: pytz in /Users/n00002621/.local/share/virtualenvs/WFChemCookbook-hyZchOOL/lib/python3.11/site-packages (from datetime->jcamp) (2023.3.post1)\r\n",
"Requirement already satisfied: setuptools in /Users/n00002621/.local/share/virtualenvs/WFChemCookbook-hyZchOOL/lib/python3.11/site-packages (from zope.interface->datetime->jcamp) (69.0.3)\r\n"
]
}
],
"source": [
"# noinspection PyProtectedMember\n",
"!pip install jcamp # command to instruct Binder/Colab to install the jcamp package\n",
Expand All @@ -282,9 +295,14 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "4c68c544",
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-01-29T18:32:24.174638Z",
"start_time": "2024-01-29T18:32:24.159895Z"
}
},
"outputs": [],
"source": [
"file_path = '../files/sample_data.jdx' # Replace with your specific file path\n",
Expand All @@ -304,10 +322,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "3a33797c",
"metadata": {},
"outputs": [],
"metadata": {
"ExecuteTime": {
"end_time": "2024-01-29T18:32:29.099337Z",
"start_time": "2024-01-29T18:32:29.097487Z"
}
},
"outputs": [
{
"data": {
"text/plain": "{'title': 'Salicylic Acid',\n 'jcamp-dx': 4.24,\n 'data type': 'UV/VIS SPECTRUM',\n 'origin': 'INSTITUTE OF ENERGY PROBLEMS OF CHEMICAL PHYSICS, RAS',\n 'owner': 'INEP CP RAS, NIST OSRD\\nCollection (C) 2007 copyright by the U.S. Secretary of Commerce\\non behalf of the United States of America. All rights reserved.',\n 'cas registry no': '69-72-7',\n 'molform': 'C7H6O3',\n 'mp': 158,\n 'bp': '211(20)',\n 'source reference': 'RAS UV No. 237',\n '$nist squib': '1963ERN/MEN230-240',\n '$nist source': 'TSGMTE',\n 'spectrometer/data system': 'Unicam SP 500',\n 'xunits': 'Wavelength (nm)',\n 'yunits': 'Logarithm epsilon',\n 'xfactor': 1.0,\n 'yfactor': 1.0,\n 'firstx': 247.1048,\n 'lastx': 340.0658,\n 'firsty': 3.14445,\n 'maxx': 340.066,\n 'minx': 247.105,\n 'maxy': 3.19782,\n 'miny': 1.25709,\n 'npoints': 1449,\n '$ref author': 'Ernst, Z.L.; Menashi, J.',\n '$ref title': 'The spectrophotometric determination of the dissociation constants of some substituted salicylic acids',\n '$ref journal': 'Trans. Faraday Soc.',\n '$ref volume': 59,\n '$ref page': '230-240',\n '$ref date': 1963,\n 'xypoints': '(XY..XY)',\n 'end': '',\n 'x': array([247.1048, 247.1574, 247.1657, ..., 334.0779, 334.1783, 340.0658]),\n 'y': array([3.14445 , 3.182843, 3.112433, ..., 1.693346, 1.67324 , 1.25709 ])}"
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data_dictionary # Show the contents of the dictionary on screen"
]
Expand Down

0 comments on commit 4c07316

Please sign in to comment.