jdwor / LQT

R implementation of the Lesion Quantification Toolkit (LQT; Griffis et al. 2021)
7 stars 2 forks source link

'!' not found" error in get_tract_discon #2

Open jdwor opened 3 years ago

jdwor commented 3 years ago

From @luanraguiar

When running the get_tract_discon(cfg) command, the following error appeared:

"Error in system(paste0("! ", cfg$dsi_path, " --action=ana --source=", : '!' not found"

jdwor commented 3 years ago

I'm not exactly sure what the issue is here, but it's definitely not something that you're doing wrong. My best guess at the moment is that it's a result of the "system" command functioning differently on a Windows OS than it does on a Mac or Linux OS.

I've pushed an update to the github that catches an error and tries the "shell" command instead; if it's a windows issue, that should hopefully help.

But let me know if it doesn't help and I can keep looking around

luanraguiar commented 3 years ago

Hi Jordan,

Thank you very much! I updated the package "update.packages("LQT")", and tried to run the commands again, but I got the same error. Did I do it right or should I remove the package and install it again?

jdwor commented 3 years ago

Hey Luan,

I think you might have to reinstall using install_github() - I'm not sure that update.packages works for github packages. If you're still getting the error after that, would you mind taking a screenshot and uploading it in a comment?

Thanks! Jordan

luanraguiar commented 3 years ago

Hi Jordan,

I removed LQT using the code "remove.packages()", and then reinstalled again "devtools::install_github('jdwor/LQT')". However, this time, the "get_parcel_damage(cfg)" and the "get_tract_discon(cfg)" command is not also running. Previously, it was just "get_tract_discon(cfg)".

> get_parcel_damage(cfg) Error in get_parcel_damage(cfg) : objeto 'cfg' não encontrado > get_tract_discon(cfg) Error in get_tract_discon(cfg) : objeto 'cfg' não encontrado

image

If you are interested, follow the codes in txt: console_packageLQT.txt

Thanks! Luan

jdwor commented 3 years ago

Hey Luan,

Note that there is an earlier error message stating that the cfg object wasn't created. Since you had to re-download the template files, you have to re-run the "parcel_path" line and then re-run the "create_cfg_object" function before moving forward.

Let me know if you still see errors after doing so.

luanraguiar commented 3 years ago

Hi Jordan,

Thank you very much! I hadn't noticed, sorry!! However, it worked, but there was an error in "get_parcel_cons(cfg)".

In the "Atlas" directory, there are no documents.

image

luanraguiar commented 3 years ago

Hi Jordan,

I tried to run the next codes to view the figures/images, but with no success. Could you help me with this, please? Besides the command "get_parcel_cons(cfg)", the other plotting commands did not work. Below are the errors in the RStudio image.

Thank you very much for your help and attention. In addition, I apologize in advance for any inconvenience.

image

Best, Luan

jdwor commented 3 years ago

Hi Luan,

Regarding the error in "plot_lqt_subject" - the problem is that you're missing the "subject" variable. If you run "plot_lqt_subject(cfg, subject=1, type='parcel.damage')" it should work.

Regarding the error in "get_parcel_cons" - I'm not totally sure about this one, but it seems to be a permissions issue specific to Windows OS. I tried pushing a small update to the code, so let me know whether it helps after you re-install and re-run.

luanraguiar commented 3 years ago

Hi Jordan,

Thank you so much! I managed to solve the issue of the plot for "parcel. damage" (see the image below). However, I couldn't run the others!

image

As for "get_parcel_cons(cfg)", the error below continues: `

"Error in file(con, open = "rb") : cannot open connection Also: Warning message: In file(con, open = "rb") : could not open file 'C:/Users/Neuroimager/Desktop/R_Documentos/LQT_R/VERA/OUTPUT/Atlas/': Permission denied" `

The other plots:

`

` plot_lqt_subject(cfg, subject=1, type="tract.discon") Error in park_palette("Yosemite") : não foi possível encontrar a função "park_palette"

plot_lqt_subject(cfg, subject=1, type="parcel.discon") Error in readChar(con, 5L, useBytes = TRUE) : não é possível abrir a conexão Além disso: Warning message: In readChar(con, 5L, useBytes = TRUE) : não foi possível abrir o arquivo comprimido 'C:/Users/Neuroimager/Desktop/R_Documentos/LQT_R/VERA/OUTPUT/subjectAXT1.nii/Parcel_Disconnection/subjectAXT1.nii_Yeo.100.7_percent_parcel_mats.RData', motivo provável 'No such file or directory'

plot_lqt_subject(cfg, subject=1, type="parcel.sspl") Error in readChar(con, 5L, useBytes = TRUE) : não é possível abrir a conexão Além disso: Warning message: In readChar(con, 5L, useBytes = TRUE) : não foi possível abrir o arquivo comprimido 'C:/Users/Neuroimager/Desktop/R_Documentos/LQT_R/VERA/OUTPUT/subjectAXT1.nii/Parcel_SSPL/subjectAXT1.nii_Yeo.100.7_SSPL_matrices.RData', motivo provável 'No such file or directory' " `

Regards, Luan

jdwor commented 3 years ago

I fixed the tract.discon bug. But parcel.discon and parcel.sspl won't work until we fix the get_parcel_cons issue, since they depend on the output from that function.

I'm trying to figure out why you don't have write permissions for the Atlas folder. That's the reason that get_parcel_cons isn't working. Could you take a screenshot of the permissions for the "OUTPUT/Atlas" directory, and also for the "OUTPUT/subjectAXT1.nii" directory?

You should be able to do this using something similar to the process described here: "Right-click the folder or file and click 'Properties' in the context menu. Switch to 'Security' tab and click “Advanced”. In the 'Permissions' tab, you can see the permissions held by users over a particular file or folder."

luanraguiar commented 3 years ago

I understood! Thank you very much!

Below are the screenshots.

image

image

jdwor commented 3 years ago

Huh. It seems like they have the same permissions, so I'm not sure why it's giving you a permissions error when you try to write to the Atlas folder but not the subject folder.

Could you send me a screenshot of the error traceback? To do this, you just run get_parcel_cons as you normally would, and then run "traceback()" once you see the error appear.

luanraguiar commented 3 years ago

Hi Jordan, Of course! Below is the screenshot.

image

Thank you very much !

Regards, Luan

luanraguiar commented 3 years ago

Hi Jordan,

How are you? About the error that appears when I run "get_parcel_cons", I tried to run it again for a few days, but unfortunately I haven't had any success.

Regards, Luan

jdwor commented 3 years ago

Hi Luan,

Sorry for the delay. It seems that this error is specific to the Windows operating system. Since I don't currently have a Windows machine up and running, I haven't been able to reproduce the error or figure out what's going wrong. I'm currently working on getting one set up so I can do some local testing and fix the bug ASAP. Hopefully I'll have an update for you by the end of the week.

In the meantime, if you have access to a Mac or Linux machine, you should be able to run the software properly on there!

Best, Jordan

luanraguiar commented 3 years ago

Hi Jordan,

Thank you very much for your kindness. I greatly appreciate the help! I have a computer with a Mac system at my institution, but so far I haven't been successful in downloading any CRAN packages ('devtools', 'remotes', etc.), most likely due to the internet proxy. I'm trying to work this out too!

Thank you very much!

Best, Luan.

jdwor commented 3 years ago

Hi Luan,

I think I've finally tracked down and fixed all of the Windows-specific issues that were occurring. Please re-install the updated version of the package, and let me know if you're able to successfully run the code on your machine.

Fingers crossed!

Best, Jordan

luanraguiar commented 3 years ago

Hi Jordan,

Thank you so much !!! I'm running the program at the moment, and I'm thinking positively that it's going to work.

Ah! A question that didn't appear before came up "Enter a numerical threshold to binarize the masks, or enter 'c' to cancel:" . What would be the best answer?

Best, Luan

jdwor commented 3 years ago

I opened a new issue for that question, so we can keep this one specific to Windows OS bugs

jdwor commented 3 years ago

Hey Luan, were you able to run the full set of commands?

luanraguiar commented 3 years ago

Hi Jordan,

Sorry for the immense delay in responding. I was in the hospital and I had to get away from the computer for a while. I also took a while because I was trying to understand the binary mask topic, as I believed that my lesion mask was binary.

I'll run it again now and let you know!

Thank you so much! Best, Luan

luanraguiar commented 3 years ago

Hi Jordan,

This error appeared below when it was running.

image

Best, Luan

jdwor commented 3 years ago

Hey Luan,

Hope you had a nice weekend! Sorry about the new error - to be honest I'm not sure what's causing it and cannot reproduce it on either my Mac or my Windows machine.

When you get a chance, could you try working through the code in the file I've attached? The error seems to be appearing at line 101, so it would be good to see what is contained in 'tract_discon', 'tract_counts', and 'tc_index' when you arrive at that point in the function.

Let me know if it would be easier to set up a phone call to take a look at this together!

Best, Jordan

Luan_Tract_Test.R.zip

luanraguiar commented 3 years ago

Hi Jordan,

I hope you're well ! Thank you very much for the script!!!

Sorry for the delay in responding but my laboratory was in funding request week and needed my full attention and help. So my sincere apologies!

I run the script you sent me. Below is a photo!

image

'tract_discon','tract_counts' and 'tc_index':

image

Console:

Console_Script_Luan.txt

Best, Luan

luanraguiar commented 3 years ago

Hi Jordan,

I forgot to send the script result. See below!

https://mfr.osf.io/render?url=https%3A%2F%2Fosf.io%2Fxpabw%2Fdownload

Also, were you able to see the 'tract_discon', 'tract_counts' and 'tc_index' variable items in the photo I uploaded? I couldn't fully preview and save, but I'm already solving it.

Best, Luan

mjmarte commented 3 years ago

Hi Jordan,

First, thanks for your efforts in putting together this package. It's a fantastic resource for us who love working in R (and mostly R).

Second, interestingly, I am having the same issue as Luan, and this is on MacOS (Big Sur 11.2). There seems to be some sort of issue with writing permissions and specifically relating to the atlas.

I'm able to run get_parcel_damage() to good success (btw -- is there a way to plot the group-level parcel damage?), and get_tract_discon() runs, but produces a column of zeroes under Discon. Finally, get_parcel_cons() produces an error similar in nature to the one Luan describes. Likewise re: get_parcel_atlas(). Furthermore, there is nothing in the actual Atlas folder LQT creates in the output directory. It all seems to converge on these directory/atlas/permissions(?) issues.

I've attached a screenshot of my console and my code. Please let me know if there is anything I can add to help out!

Thanks for your time!

Screen Shot 2021-08-11 at 9 30 47 AM

LQT_MJM.R.zip

jdwor commented 3 years ago

Hi Manuel,

Thanks for reaching out! My apologies, there was a bug in my code that broke get_parcel_atlas & get_parcel_cons for multi-subject analyses. I've pushed an update to the repository, so if you reinstall and try again it should (hopefully) work better now.

I'm not sure what the issue is with get_tract_discon though, since that function is working fine on all my local examples. If you're able to send me an example of a lesion mask that's giving you all zeros for tract discon, I'd be happy to check it out and see if I can solve the issue.

And unfortunately I haven't yet implemented any group-level visualizations, but if you want to play around with possible visualizations on your end feel free to use the code in plot_lqt_subject as a starting point!

All the best, Jordan

mjmarte commented 3 years ago

Hi Jordan,

Thanks for the quick reply and fix for the multi-subject analyses. I believe it will work once I figure out this atlas issue. In running the multi-subject analyses (re: get_parcel_damage()), computing parcel damage continues to work very nicely.

However, I still come up against this "missing" or unwritten atlas at the output path. I tried with a single subject, and specifically with the example lesion mask you provided in the /Example_Lesions folder in the LQT installation. get_tract_discon(cfg, cores = 4) runs without any errors but I still get a column of zeroes in the .csv output as you can see in the attachment. For the single-subject analysis, I only changed the code necessary (i.e.,pats_ids = "Subject1") and renamed your ExampleLesion1.nii.gz file to Subject1.nii.gz.

Subject1_percent_discon_tracts.csv

Here are the errors I get re: get_parcel_cons() and get_atlas_sspl() on the single-subject analysis (and multi): Screen Shot 2021-08-11 at 11 03 45 AM

Any thoughts?

Best, Manny

jdwor commented 3 years ago

Hi Manny (and @luanraguiar),

Thanks for bringing this to my attention! Turns out the most recent versions of dsi-studio changed the command line interface in a way that broke my original code. Since I had an old version of dsi-studio on my local machine, I didn't notice the effect of the change.

I've now gone through and pushed an update that should work with the new version of dsi-studio. I believe it should fix the issues you were both facing with get_tract_discon and get_parcel_cons/atlas/discon/sspl.

Let me know if that helps, or if you're still seeing errors! Fingers crossed it's almost solved.

Best, Jordan

luanraguiar commented 3 years ago

Hi Jordan,

Thank you very much!!!!

Best, Luan

mjmarte commented 3 years ago

Hi Jordan,

We're nearly there!

I tried your update on macOS and still received the same errors. Then, I was curious about this directory issue, so I tried running the LQT package on one of our Windows virtual machines. It worked beautifully for my entire patient sample, except that data = compile_data() gives me: Error: $ operator is invalid for atomic vectors.

Interestingly, I tried messing around with my dsi_path in macOS, and I think that may be the issue. I do have dsi_studio.app in my Applications folder per the create_cfg_object() function's check (hence no errors when running the function and not inputting an argument for dsi_path), but there must be some sort of issue. I then tried manually setting dsi_path to another copy of dsi_studio.app, elsewhere on my desktop, and using the same final path as the create_cfg_object() function (i.e., all the way to the Unix Executable File), which then returned the same errors I show above re: _cannot open connection etc., not sure why. dsi_path set to the .exe on the Windows VM works just fine. I may try tomorrow on another person's Mac to see if it's something specific to my computer.

Thanks as always, Manny

jdwor commented 3 years ago

Ugh so sorry Manny! Could you try running the "get_parcel_atlas" function on your Mac? If it gives you that error, could you run "traceback()" and send me a screenshot? Thanks very much for your patience

luanraguiar commented 3 years ago

Hi Jordan,

I downloaded LQT twice, but I found the same error in "get_parcel_cons(cfg)" as you can see in the image below. However, after you commented on "DSI Studio" I remembered that I downloaded my version from the website provided by "Griffis JC et." (https://wustl.app.box.com/v/LesionQuantificationToolkit).

On the site above, even has the following guidance (in the document: Note on DSI_Studio Versions):

"Created: (May 17, 2021, 2:08 PM) DSI_Studio Issue

There is an issue with the most recent versions of DSI_Studio prior to the May 17, 2021 release that prevented the connectivity estimation from proceeding. This has been fixed in the May 17, 2021 version, so if you are encountering errors during the connectivity estimation steps, please download the newest DSI_Studio version and update the cfg.dsi_path field to the location of the newest version. "

Which version of DSI Studio did you download Manny @mjmarte ? I will try it with the new version of DSI Studio and return to let you know if I was successful!

image

Best, Luan

luanraguiar commented 3 years ago

Hi Jordan,

The same error appeared in "> get_parcel_cons(cfg)" with the new version of DSI Studio. Also, I rerun the script you sent me, and the tract_discon and tc_index are empty, only the tract_counts which is filled with "num [1:70]"

image

Luan_Tract_Test: image

Best, Luan.

mjmarte commented 3 years ago

Hi Luan and Jordan,

Sorry for the late reply -- I went on vacation and then returned to a very problematic situation with my personal computer. I'm no longer running LQT on macOS and am running it on Windows via remote desktop. I'm not sure if anything changed re: updates, but the compile_data() command returned no errors after running the analyses again.

The only remaining issue is that parc2.parc.discon returns NaNs for all possible values. Likewise, the measure of parcel disconnection is either 100% or 0%. SSPL Change (%) is also either 500 or 0 when plotted. Could this be an issue relating to the lesion masks? I will try out LQT on MATLAB and report back if there are any differences.

@luanraguiar -- I ran it using the newest version of DSI available for download.

Best, Manny

jdwor commented 3 years ago

Hi Manny,

Hope you had a nice vacation!

I'm a bit at a loss, because I have been unable to replicate any of the recent bugs that you two are reporting on either my Mac or my Windows.

If possible, could you send me an example of a lesion mask that is giving you these weird values? If I can walk through the code step by step with one of your images I can hopefully figure out where it's going wrong. If you'd be willing to send one, you can send it to jordan.dworkin@nyspi.columbia.edu.

Thanks, and sorry for the difficulty, Jordan

mjmarte commented 3 years ago

Hi Jordan,

Thanks!

I'll send you a few lesion masks and their corresponding results folder. The NaNs applied to all analyses. No apologies needed.

Best, Manny

jdwor commented 3 years ago

Thanks Manny!

In the meantime, I will note that a good deal of NaNs are expected in the parc2parc.discon; lots of parcel pairs don't have any structural connections between them, so those get NAs instead of 0s for their % disconnectivity. I considered pushing an update that dropped those columns, but I figured I would keep them in case people wanted to re-create the full pairwise matrix for analysis or visualization.

So if you're getting a lot of NaNs but also a good deal of real numbers, then that might be okay. If you're getting all NaNs, then that's definitely a problem.

Though parcel disconnection and sspl change should still have more of a range than you're describing, so there is probably something else going on overall.

mjmarte commented 3 years ago

Hi Jordan,

I double-checked my data and you are right, there were just so many columns that it seemed like all were NaNs. The pattern seems odd, though, as only certain columns contain 0s or 1s. I've attached the .csv here.

parc2parcdiscon.csv

Also, are any .trk.gz files meant to be generated by this implementation of LQT? They're mentioned in the manual but I couldn't find any in the Results folder.

Thanks!

mjmarte commented 3 years ago

Hi Jordan,

Do you have an alternative email I could send the files to? I get a "Delivery incomplete" message when trying the one you provided for whatever reason. Tried twice since your last message and yesterday!

Manny

jdwor commented 3 years ago

Hi Manny, sorry for the delay. You can try jordandworkin@gmail.com. Hopefully that one works!