Extracting Data from UNICORN Files

Hi Forum,

I’m looking for some code (language doesn’t matter so much) to read in UNICORN files and export online signals (UV, conductivity, etc.). Exporting control data (e.g., flow rates) would be a nice as well.

Do you know of any code that does this?
Alternatively, is there a file format specification available?

Thanks,
Sam

Hey Sam,

I don’t know if its compatible with newer formats of UNICORN files, but I was using PyCORN (GitHub - pyahmed/PyCORN: A script to extract data from ÄKTA/UNICORN result-files (.res)) for my UNICORN 5.4 files a lot. It also includes the file format layout, describing the raw format and how to read it byte-by-byte. So its basically possibe to port it to other languages.

Jan

6 Likes

Just remember the fun part about these files. You can’t trust the times in them. At least for all the versions I have seen so far the time is based on the pump so if the pump stops so does the time. Part of what makes this work so difficult is having to go in and read the comments to adjust the times to account for pauses in the system.

2 Likes

This is really important. I think it would make sense to have some documentation on the exact approach / steps to take to make these corrections for pump delay.

I’m interested too since I’m working on an automation project. Thanks so much for asking Sam!

1 Like

PyCORN is unfortunately not compatible with newer versions of UNICORN.

Thanks for the info, @maxedin.
Do you also know from which version on it doesn’t work anymore?

No, I don’t know the exact version I’m afraid. An educated guess is that PyCORN works only for UNICORN versions <7.0

1 Like

I’ve been in touch with the developer of PyCORN before and he mentioned that he stopped developing the software some years back. I figure he developed it for UNICORN 5.3.1, since this was a really common version back then (we still use it now in our group too). This one uses the .res files which PyCORN pulls data from. I am not familiar with newer versions of UNICORN, but I figure if the .res files are no longer used or if the data structure has changed it would be required to edit the code to be interoperable between different UNICORN versions.

It might be worth looking into this further so we can incorporate this framework into CADET somehow - this would make a really nice user experience. I figure the majority of folks use UNICORN anyways and spend too much time annoyingly exporting the data (I sure have). So it would a natural progression to try to build on some connectivity between UNICORN and CADET. I know for a fact that GoSilico/Cytiva is trying to do this, and that is one of the bigger selling points of it. So, I think this is a pretty compelling development.

Maybe in CADET-Process @j.schmoelder?

I still have the contact info of the PyCORN developer if we want to reach out and take over development of the software. He stopped working on in 6 years ago, so I feel like it would be okay.

Does anyone have a newer UNICORN file they can share? If I have some time to spare I could have a look if its similar. I reverse engineered half of the format for the older one by myself before i noticed that they documented it in PyCORN. It took weeks and was gruesome but also kind of rewarding.

@soumi If I remember correctly, you guys use AKTA avants—meaning you should have the newer file versions. Can you share an example if you have one?

Hey Scott. No Avants (yet) I’m afraid. We have an Akta Pure (and an Explorer).

What version of UNICORN does the pure use?

I’m really late at replying to this - I was away on vacation much of last month.
The Akta Pure we have is on Unicorn 7.3.

Yes - if you need me to send an example of a chromatography run, I’m happy to do so.

Thanks!

1 Like

Hey Soumi,

I hope you had a nice vacation! Can you post an example chromatography run file here for @Jan to use? On the AKTA Explorer (UNICORN version 5.3.1), these files had the filetype of .res (result file). Not sure if the AKTA Pure would have the same filetype for results. If the filetype is different, it would presumably be whatever file contains the output of the chromatography run in the results folder.

Thanks,
Scott

Hi Scott, Jan,

Hm - I don’t see the .res files (or their equivalent) on the Akta PC. We usually use the export function to access specific runs. Here’s an example of the complete export.

10MAR23_0.7mL_Col_60cm-h_Repacked_ColumnMAbNONBINDING_Pulse 006.zip (531.5 KB)

We usually export specific curves into .asc or .csv files of this sort.
10MAR23_0.7mL_Col_60cm-h_100uL_Repacked_ColumnMAbNONBINDING_Pulse 006.csv (702.8 KB)

Let me know if this helps.
Soumi

The result files should be stored to the local user folder that is specified in the method.

I think the objective here is to be able to extract the data from UNICORN without needing to manually export it, which would be really useful when there are many runs to go through.

Thanks for the files. I just had a look into them.

TL:DR.: You can use PyCorn for Unicorn 7 files as well

The file format for the .res files is different, for sure. Basically, the Unicorn 7 files are nested compressed data, which is why you can extract most of it by just naming the files as *.zip and unpack them. Some files are available (e.g. Chrom.1.xml), which tell you where to find the specific data of your signal (e.g. Chrom1_1_True) as well as contain the logbook and etc… These files can be unpacked as well. The binary data files with the signal data are then quite easy to read. They have a short header, and then the data is in single floats.
So, I just started to set up a small script to read out the signals when I realized that PyCorn could do the exact same thing. It seems that the file format of Unicorn 6, which PyCorn is able to read, and Unicorn 7 file format are very close, if not the same.

1 Like

Btw, you can also unzip without having to rename using standard library Python:

import zipfile
with zipfile.ZipFile(path_to_zip_file, 'r') as zip_ref:
    zip_ref.extractall(directory_to_extract_to)

Also, thanks for compiling all of this information. It would be cool if we could put that into some more structured form (maybe something like here?). Then we could at some point also consider doing a rewrite of pycorn since it does no longer seem to be supported.

It would be great to be in contact with its previous developer ant it would be nice if you could connect us @alters.