Skip to content

The script exports channels according to suffix-mapping and evaluates whether is channel flat or not from .adicht file to multiple .csv files.

Notifications You must be signed in to change notification settings

SCIENCE-OPEN/adicht-signal-to-csv-exporter

Repository files navigation

.adicht Signal to .csv Exporter

GitHub Release License: GPL v3 Ask Me Anything ! PRs Welcome Badge

The script requires first argument directory where recursivelly find .adicht files or is required path to single .adicht file. Second argument is required output directory. For each .adicht file on the input the script exports the channels according to provided channel-suffix mapping to separated .csv files to the output directory. Nested structure from the input to output is not followed!

The names of created .csv files will be taken from the name of .adicht file according to default channel-suffix mapping r:0,g:2 and the default delimeter , (e.g. the channel 0 if not evaluated as flat from the file AC17654r, AC17657g.adicht will be written to the file AC17654.csv and channel 2 to AC17657.csv, the suffix (e.g. r at the end of filename AC17654r.adicht) that is informing which channel should be exported to which .csv file is then not part of filenames of the created .csv files).

Features

  • When splitting by separator was found only 1 specimen ID (e.g. using default comma separator and filename AC17654r.adicht) and mapping point to channel with flat signal, then is assigned first not flat channel's signal

Usage

root@a55904f85091:/src# wine python adicht-signal-to-csv-exporter.py --help
usage: adicht-signal-to-csv-exporter.py [-h] [--sep SEP] [--suffix-map SUFFIX_MAP] src_path dest_dir_path

positional arguments:
  src_path              Path to source directory or single .adicht file
  dest_dir_path         Path to destination directory for .csv output file or files

options:
  -h, --help            show this help message and exit
  --sep SEP             Delimiter used to split specimen entries in filenames (default is comma)
  --suffix-map SUFFIX_MAP
                        Mapping of specimen suffixes to channel numbers, e.g. r:0,g:2

Changelog

CHANGELOG.md

Dependencies

  • python3.11

and

For python dependencies, take a look at requirements.txt.

Requirements

or cross-platform

or Linux, macOS and ChromeOS

Installation

Windows

Using Conda

  • create conda env for python3.11 $ conda create --name myenv python=3.11 (python3.11 is necessary because pip package adinstruments_sdk_matlab is built for python3.11)
  • activate conda env $ conda activate myenv
  • install pip packages $ pip install -r requirements.txt

Docker

  • build container $ docker build -t for-adicht-signal-to-csv-exporter . from the Dockerfile (when moving to another directory make sure the script adicht-signal-to-csv-exporter.py and files requirements.txt and requirements.windows.txt were passed inside)
  • run container $ docker rm -f for-adicht-signal-to-csv-exporter && docker run -p 5000:5000 -it --name for-adicht-signal-to-csv-exporter -v ./examples/:/src/examples/for-adicht-signal-to-csv-exporter adicht-csv-exporter
  • run inside container $ mkdir output && wine python /src/adicht-signal-to-csv-exporter.py ...

The Dockerfile is prepared for running a python3 code with possibility debug it using port 5678, just uncomment lines below marks #debugging only (e.g. VS code is able attach to running container and use breakpoints).

CrossOver

  • setup CrossOver

  • create bottle Windows10 64-bit (when using a free trial is required to repeat steps starting this one after 14 days)

  • install python-3.11.9-amd64 using CrossOver custom application .exe feature (python3.11 is necessary because pip package adinstruments_sdk_matlab is built for python3.11)

  • install Git-2.47.0.2-64-bit.exe (or get newest here) using CrossOver custom application .exe feature (reboot when progress was stuck at post-install helped)

  • move get-pip.py (or get newest here) to folder ~/Downloads of laptop to which one was installed CrossOver

  • move requirements.txt to folder ~/Downloads of laptop to which one was installed CrossOver

  • move adicht-signal-to-csv-exporter.py to folder ~/Downloads of laptop to which one was installed CrossOver

  • open inside CrossOver Git Cmd $ cd C:\users\crossover\Downloads

  • install pip $ python3 get-pip.py

  • install pip packages $ pip3 install -r requirements.txt

Examples

root@a55904f85091:/src# wine python adicht-signal-to-csv-exporter.py examples examples --sep=";" --suffix-map="r:2,g:0"
Loaded examples\subdir\G81r; G94g.adicht
Created examples\G81.csv
Created examples\G94.csv

root@a55904f85091:/src# wine python adicht-signal-to-csv-exporter.py examples examples --sep=";" --suffix-map="r:2"
Loaded examples\subdir\G81r; G94g.adicht
Created examples\G81.csv

root@a55904f85091:/src# wine python adicht-signal-to-csv-exporter.py examples examples --sep=";" --suffix-map="r:1"
Loaded examples\subdir\G81r; G94g.adicht
Error accessing channel 1 in examples\subdir\G81r; G94g.adicht: # of samples requested is less than 1
? Skipping G81r; G94g: no usable signal found.

root@5af19b760131:/src# wine python adicht-signal-to-csv-exporter.py examples examples --suffix-map="r:1"
Loaded examples\subdir\CP058R.adicht
Error accessing channel 1 in examples\subdir\CP058R.adicht: # of samples requested is less than 1
No suffix match. Trying fallback for single ID: CP058R
Created examples\CP058R.csv (from channel 0)

References

  • In the repository of the used library for conversion this was mentioned as an answer to How to use a library on non-Windows platforms? (respectively as solution to Currently only works for Windows. Not fixable by me, requires changes by ADInstruments)

TODO:

CrossOver

  • $ git bash does not open inside crossover, display error with title mintty, Font not found, using system substitute: Courier New (does not work autocompletion of dir names)

About

The script exports channels according to suffix-mapping and evaluates whether is channel flat or not from .adicht file to multiple .csv files.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published