TASBE / TASBEFlowAnalytics

Flow cytometry unit conversion and analytics
Other
7 stars 8 forks source link

Excel interface only works on Windows #292

Closed jakebeal closed 4 years ago

jakebeal commented 6 years ago

Right now, the Excel interface depends on the Windows COM interface. There may be a way to make it work on Mac and/or Linux as well.

coverney commented 6 years ago

Would we potentially be able to get it to work on MAC if we establish a connection with Octave instead of MATLAB?

jakebeal commented 6 years ago

Worth investigating, though there other problems with Octave on a Mac that might make this still a problem.

coverney commented 6 years ago

@jakebeal, I was wondering if the "Could not open MATLAB!" MsgBox pops up when you try to use the Run Buttons with a Mac or do you receive another error message?

jakebeal commented 6 years ago

I get "Could not open MATLAB!"

coverney commented 6 years ago

Great! Thank you very much!

coverney commented 6 years ago

I tried to do some research on this issue, and it seems like getting VBA to connect with Octave would be even harder than getting it to connect with Matlab, and it still might only work on Windows. I will continue looking into this to see if I can find anything more promising.

jakebeal commented 5 years ago

This looks like it's not going to be able to change any time soon, so closing it as unable to be fixed.

jakebeal commented 5 years ago

I may have found a workaround for this: http://www.rondebruin.nl/mac/applescripttask.htm

coverney commented 5 years ago

Wow! This looks really promising.

coverney commented 5 years ago

I tried going through the tutorial of the workaround and setting up the MacBook. I have two problems right now:

coverney commented 5 years ago

Here is an image of what the current Visual Basic Editor looks like:

Screen Shot 2019-10-09 at 3 12 53 PM

I can't expand the window to see the actual text of the module. Everything is basically frozen.

jakebeal commented 5 years ago

I just opened the Excel VB editor on batch_template.xlsm with no difficulties, so I don't know what's going on for you there.

With respect to Matlab --- for now, see if you can run Octave instead. It should be equally hard or easy from Excel on Mac.

coverney commented 5 years ago

That is really strange. I will try to update my Excel. Also, the excel interface directly connects to Matlab, so I would need to look into finding a new way to connect VBA to Octave. I will try a few more things to get Matlab onto the MacBook.

coverney commented 5 years ago

Good news:

Everything should be ready for some actual issue fixing now!

coverney commented 4 years ago

Some helpful resources: https://www.mathworks.com/help/matlab/ref/matlabmacos.html#d117e885998

coverney commented 4 years ago

Update: it turns out that the code used to do cooperative multitasking created a VBScript and WScript.shell, which only works in Windows. I am trying to find a way to substitute everything with AppleScripts.

jakebeal commented 4 years ago

You may be able to do the multitasking via a non-blocking launch of the application with the shell command, e.g., with an "&" suffix

coverney commented 4 years ago

Cool! I will look into that

coverney commented 4 years ago

I was able to get the non-blocking launch working by adding > /dev/null 2>&1 & to the end of my shell command. However, when I tested it out in the excel interface, nothing else works except calling the Matlab analyses functions. Here are some of my ideas for next steps:

I would love to hear your thoughts on this plan.

coverney commented 4 years ago

I just realized that reading from the warnings.xml file depends on how the file gets updated. Should it be updated in the excel interface by calling the matlab function that exports the TASBE session log every minute or so? (I am assuming that calling another Matlab script will have access to the same TASBESession log as the first analysis Matlab call.)

Or, should the xml be updated within Matlab every time a new message gets added to the session, and we would need to have a TASBEConfig/parameter that tells Matlab where the xml file is stored? For the second choice, we would just read the xml file in excel every minute or so without having to call the Matlab function.

jakebeal commented 4 years ago

This all sounds like reasonable next steps.

With regards to the XML file, we cannot access the same Matlab session from a second call. So I think we should give an option for the XML file to be output incrementally.

coverney commented 4 years ago

I tried finding an alternative to reading in an XML file using VBA, but everything I tried is not supported in Mac OS. Quite a few forums I found confirmed that XML file reading wasn't supported. I was wondering if you can think of any workarounds. I was thinking that we can convert the TASBESession xml into another file format in Matlab and try to read the new file format into Excel.

jakebeal commented 4 years ago

We could readily make a CSV export instead

coverney commented 4 years ago

I was also looking into that. There isn't a particular reason why our TASBESession logs are outputted as XML files?

jakebeal commented 4 years ago

The particular XML is JUnit, which is being used to incorporate automatic evaluation of outputs in the SD2.

coverney commented 4 years ago

Then I will create another function called to_csv_excel that would be called only when the excel interface runs.

coverney commented 4 years ago

Update: I was able to create a method that creates a csv version of the TASBE session log. I also wrote a VBA script that can read it and do the color-coding. Currently, I am trying to figure out how to write the session log into the workbook with Mac os because the old code using the parallel threads is no longer applicable.

coverney commented 4 years ago

Update: I updated the Matlab csv_to_excel function to append new messages instead of re-writing the session log each time. However, I still have problems with getting the periodic TASBESession log updates in the Excel template. Here is a breakdown of the issues I am currently encountering:

  1. When the application waits for a certain amount time, the entire application freezes, which is a problem we dealt with previously via cooperative multitasking. However, excel Mac can't use the same cooperative multitasking approach we used for Windows.
  2. I don't know when the analysis is completed unless I keep looking for the End message in the TASBESession csv file, which means I need some sort of timer (leads back to problem 1).

Maybe we could find another way of recognizing when the analysis finishes running and then read in the session log and output figures (though I can't think of way that won't involve the Application waiting/ freezing till then). I would love to hear your thoughts on this.

coverney commented 4 years ago

I was able to figure out the freezing problem using another timing method. In terms of next steps, I will clean up my code for creating the color model and then apply it to the other analyses. :)

coverney commented 4 years ago

Update: I cleaned up the code for the colormodel and tried to get the cancel button working but running another command to abort TASBESession doesn't actually cancel the current analysis. Instead, I just display a message box that the cancel buttons don't work on macOS. I also started getting the plusminus analysis workflow working. Unfortunately, sometimes running the analysis makes Excel crash, but I am not sure how to fix it.

While testing, I realized that the TASBESession log updates can be somewhat clunky at times. I have a few ideas to alleviate this problem, but I was thinking of opening separate issues once a basic version of the analyses work in macOS.

In terms of next steps, I will get the transfer curve and batch analyses working. (For batch I still need to figure out how to make the Batch Results sheet.) Then I will transition everything back to Windows and integrate everything.

jakebeal commented 4 years ago

Sounds like a good plan --- please set up this merge and the new follow-on issues when ready.

coverney commented 4 years ago

Update: I was able to get all of the analyses running. My next steps will be to write up a guide for macOS users and add back in the Windows code.

coverney commented 4 years ago

Can be closed once https://github.com/TASBE/TASBEFlowAnalytics/pull/488 gets merged into develop

jakebeal commented 4 years ago

Fixed --- though there are some rough bits.