This repository contains some python scripts and jupyter notebooks specifically made for the use of EBRAINS related curation and optimisation.
To run the scripts, the following requirements apply:
- Python version 3.6 or higher
- openMINDS python package (can be downloaded from PyPi)
- Authorisation to read and write to the Knowledge Graph via the API
link_filebundles.ipynb :
script to automatically link specimen to their corresponding file bundles. Relevant information is stored in a csv file with the name "fb_"extract_tsc_info.ipynb :
script to extract important metadata related to a tissue sample collection. This information is stored in a csv file with the name "tsc_"create_servicelinks.ipynb :
script to create URL and service link instances based on the provided metadata. These instances can be directly uploaded to the KG editor via the API.
Creating Protocols and Protocol Executions
make_protocols.ipynb :
script to automatically create protocols and protocol executions from an excel template file (protocolTemplate.xlsm). The instances rely on the openMINDS python package and are openMINDS conform. They can be directly uploaded to the Knowledge Graph editor if you have read and write permission. Relevant information is stored in a csv file with the name "createdProtocols.csv".protocolTemplate.xlsm :
Macro-enabled excel file for the creation of protocols and protocol executions (don't forget to enable the macros). Before running the jupyter notebook, please save the file as an .xlsx file. This will disable the macros and allows it to be imported by the python script.
Changing existing metadata for specimen
patchNupload.ipynb :
script to add/change metadata from an excel file (e.g. ExamplePatch.xlsx) to existing specimen instances in the KGE.ExamplePatch.xlsx :
Example excel file to define metadata and update instances.
Creating Persons
create_persons.ipynb :
script to create persons (first name, last name, email address and ORCID) from excel file (e.g. personTemplate.xlsx) and upload instances to the correct space in the KGE (common for person and ORCID and restricted for email address). Relevant information is stored in a csv file with the name "createdPersons.csv".personTemplate.xlsx :
Example excel file to define person metadata.
Releasing instances
release_instance :
script to release instances based on the uuid. You can either list the uuids you want to release in an excel file (e.g. instances2release.xlsx), or you can paste an individual uuid in the script (when asked the questions).instances2release.xlsx :
Example excel file for releasing multiple instances at the same time.
MeshView related
changeColour.py :
script to change colours in a MeshView compatible JSON file. Colours can be individually defined in an excel file where the filename and corresponding colour is defined on each row in the excel file, or one colour can be defined for all files at the start of the script (as answer to one of the questions).convertTXT2JSON.py :
script to convert coordinates in a text file to a MeshView compatible JSON file. Coordinates in the txt file should be tab-separated. Each line represent x y z coordinates. The colour of the coordinates can be defined on the first row of the txt file using the RGB code, e.g. RGB 0 0 255. If no RGB code is defined, the colour is set to black as default.exportCoordinates.py :
script to export coordinates from a MeshView compatible JSON file and save them in a csv file.convertXYZ2JSON.py :
script to convert coordinates stored in an .xyz file to a MeshView compatible JSON file. The script was written for a specific set of files so that the colour of the point clouds match the injection tracer, but the script can be used for any .xyz file (default colour of the points is black).convertJSON2TXT.py :
script to convert MeshView compatible JSON file into a txt file using the colour that was defined in the JSON file. The script was written for a specific set of files, but it can be used for any MeshView comparible JSON file as long as the correct folder for the file names has been defined.