cytoscape / cytoscape-automation

Collection of scripts that include programmatic io and control of Cytoscape
Creative Commons Zero v1.0 Universal
81 stars 58 forks source link

CyTargetLinker network extension automation worked, but not anymore #74

Closed pklemmer closed 2 years ago

pklemmer commented 2 years ago

I am trying to extend my network using CyTargetLinker and was able to do so, but after running the exact same code at a later point, the network is not extended anymore.

There is no error message, the console output reads "Extension step: 1", but no further output is generated. In Cytoscape, a new network called CTL-(pathwayname) is generated, but is the exact same as the initial network, with the same number of edges and nodes. Here is the relevant code:

cytoscapePing()
cytoscapeVersionInfo()
  #Pinging Cytoscape to check if it is properly running, and checking what version of Cytoscape is loaded
installApp('WikiPathways')
installApp('CyTargetLinker')
  #Installing the WikiPathways and CyTargetLinker apps in Cytoscape
park.pathways <- findPathwaysByText("Parkinsonian")
park.wpid <- park.pathways[1,"id"]
  #Defining the required ID as the ID of the first row/result of the se
commandsRun(paste0('wikipathways import-as-network id=',park.wpid)) 
  #Importing the relevant Parkinsonian motor deficit pathway as network
hsa <- file.path(getwd(), "LinkSets", "wikipathways-20220511-hsa-WP.xgmml")
hsa_react <- file.path(getwd(), "LinkSets", "wikipathways-20220511-hsa-REACTOME.xgmml")
  #Loading the WikiPathways linksets available at https://cytargetlinker.github.io/pages/linksets/wikipathways
CTLextend.cmd = paste('cytargetlinker extend idAttribute="XrefId" linkSetFiles="', hsa, ',', hsa_react, '" network=current direction=TARGETS', sep="")
commandsRun(CTLextend.cmd)
  #Extending the network with CyTargetLinker

I've verified multiple times that the proper working directory is set, have reinstalled Cytoscape, tried it on another device and reinstalled the cytoscape app FileTransfer ver 1.2. I am also sure of all the spelling in the script.

Tested on both Windows 10 and 11 64-bit with Cytoscape 3.9.1 Again, the script worked previously just as expected, but didn't anymore after reopening the session.

AlexanderPico commented 2 years ago

Hi. I ran your script and it worked fine. One observation is that the resulting network doesn't look extended at first because the nodes are added in the same positions. So, I had to perform a layout to see all of them as expected. If you add this line to the end of your script, it should fix that issue:

layoutNetwork()

However, from your description, I suspect you are actually having a different problem. Something related to running this script more than once? This part of your issue is not clear to me. Can you provide simple steps to reproduce your issue, if this is the case?

pklemmer commented 2 years ago

Hi, I have the layout line in my script as well. The issue is that no nodes or edges are added at all. To be more precise, the script ran fine and generated the extended network as expected on the first time running the script. However, when I now try to run it again and thus try to generate the extended network again, the script fails and nothing happens. I've tried setting all conditions like when I ran the script the first time, i.e. new cytoscape session, new RStudio session etc. You should be able to reproduce the issue by running the script multiple times, either in the same (R) session or when starting a new session - either way, I doesn't work for me. I have some suspicion that the issue is within the cytoscape log file, but since I entirely uninstalled and reinstalled cytoscape, I'm not sure this is the case.

If you'd like, I can also provide the entire script and the linkset files.

AlexanderPico commented 2 years ago

This is the part I don't understand. Why would you run the script mulitple times? When I do this, I end up with multiple copies of the original WikiPathways network and multiple copies of the extended form. This works fine for me, but I can't imagine that this is what you want.

What is your goal?

AlexanderPico commented 2 years ago

I've got the script you shared above and I downloaded the linkset files already (that's how I reproduced running the script). If there is more script that is relevant to your issue, then please do share. If it's not relevant to this particular issue, then I don't need to see it.

pklemmer commented 2 years ago

I simply didn't save the extended cytoscape network, so I just want to recreate it once and then save it - at the moment I'm not able to get an extended network at all. I can also just extend the network in cytoscape directly which will give me the results I need but it would be nice if the script ran, especially since I can't figure out why it won't :).

I just want to be able to run the script and generate the extended network accordingly, but again, the script did work once, but won't anymore when I try to rerun it.

AlexanderPico commented 2 years ago

Ah, I think I understand now. At some point in the past (weeks ago?), this script ran fine for you. Now, it doesn't.

When I run your script, it works fine.

So, there is nothing wrong with your script. There is nothing wrong with RCy3, nor with Cytoscape.

You suspect that something changed on your system that causes the script to no longer work for you? I'm not sure I can help. Here are some basic troubleshooting tips:

pklemmer commented 2 years ago

Exactly.

I've not changed anything in the system as far as I know, and the rest of my script (importing the network from wikipathways etc.) works fine. I will try to redownload the linksets and reinstall everything I can. Thank you for your help!

pklemmer commented 2 years ago

Small update: The script now works everytime and properly extends the network every time. I don't think I changed a relevant part of the code or my PC settings (besides maybe updating RStudio).