Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run causalpath.jar From Within Cytoscape App #10

Open
cannin opened this issue Jun 14, 2021 · 14 comments
Open

Run causalpath.jar From Within Cytoscape App #10

cannin opened this issue Jun 14, 2021 · 14 comments
Assignees
Labels
enhancement New feature or request question Further information is requested

Comments

@cannin
Copy link
Owner

cannin commented Jun 14, 2021

How can the casualpath jar be run from Cytoscape? Via a commandline call like "java -jar ..." or by calling a function in the jar? The best would be if it can be run calling Java functions, but I do not know what options are available.

@cannin cannin added enhancement New feature or request question Further information is requested labels Jun 14, 2021
@thepritam
Copy link
Collaborator

Hi, @cannin Thank you for your query.
For creating and installing the app we can use the command mentioned in the Readme. file
https://github.com/cannin/causalpath_cytoscape_app/blob/main/README.md
Then the app will be created in the target folder of the project.
We can link the "app.jar" to this folder "C:\Users<your PC_NAME>\CytoscapeConfiguration\3\apps\installed".
Such that whenever we reinstall the app and a new app is created it will automatically be copied into that folder.
Windows command for that
mklink /h "C:\Users<your PC_NAME>\CytoscapeConfiguration\3\apps\installed\app.jar" "<path-to-the-target-folder\sample-app.jar"
Linux command:
ln -s /path/to/my_app.jar my_app.jar
The detailed instruction is given at
https://github.com/cytoscape/cytoscape/wiki/Install-and-Run-a-Sample-Cytoscape-App
Also, we simply copy the app to this folder "C:\Users<your PC_NAME>\CytoscapeConfiguration\3\apps\installed".
But we have to this multiple times.
Then we can open the Cytoscape from our desktop and simply run the app from the Apps from the menubar as shown in the documentation.
Please let me know for any other questions.
Thanks,
@thepritam

@thepritam
Copy link
Collaborator

Also, I have found the link to some commands in this link http://manual.cytoscape.org/en/3.5.0/Command_Line_Arguments.html
Here are some commands which we can perform using cytoscape.sh for linux or cytoscape.bat for windows are given.

@cannin
Copy link
Owner Author

cannin commented Jun 14, 2021

Let's define our nomenclature.

How will you run causalpath.jar from the Cytoscape App?

@thepritam
Copy link
Collaborator

@cannin Thank you for rephrasing the query.

To run the casupath.jar file we can run the following command
java -jar target/causalpath.jar path/to/input/directory

This command can be found at CasualPath Repository in the following link
https://github.com/PathwayAndDataAnalysis/causalpath/blob/master/README.md

I run the following command to run the app on my machine.

java -jar "C:\Users\PRITAM PC\Desktop\casualpathnrnb\causalpath\target\causalpath.jar" "C:\Users\PRITAM PC\Desktop\casualpathnrnb\data\TCGA-RPPA\ACC"

And I think it is not a Cytoscape app so we can't run it from the Cytoscape App.
Please let me know for any other queries.
Thanks,
@thepritam

@cannin
Copy link
Owner Author

cannin commented Jun 14, 2021

@thepritam please communicate with alex pico by email (CC me) and see if he can give clarity to this. the goal of this project is to simplify the use of causalpath.jar. this strategy is cumbersome for many users we seek to target.

@thepritam
Copy link
Collaborator

@cannin I have mailed Alex Pico about the issue.

@thepritam
Copy link
Collaborator

@ozgunbabur @cannin I have tried to run the Causalpath. main() function from the repository from the application. But after getting the repository the app is not getting started. There is some issue with the dependency. I have sent a mail describing the issue regarding this.

@thepritam
Copy link
Collaborator

@cannin
I am trying to run the Casual Path Algorithm from the Cytoscape App.
The link to my code: https://github.com/cannin/causalpath_cytoscape_app/blob/gh_integrate_test/casualpath-cytoscape-app/src/main/java/org/cytoscape/sample/internal/cellnoptr/tasks/TxtFileImport.java

The Repository to the Casual Path Algorithm: https://github.com/PathwayAndDataAnalysis/causalpath

The function I am calling from My code is the main function and it is given in this link:
https://github.com/PathwayAndDataAnalysis/causalpath/blob/master/src/main/java/org/panda/causalpath/run/CausalPath.java

So,
After doing this when I added the newly installed app into Cytoscape, the app is not getting started. And It is giving some OSGI error.
The error is given below:

org.cytoscape.app.internal.exception.AppStartupException: Bundle start error
        at org.cytoscape.app.internal.manager.BundleApp.start(BundleApp.java:84) ~[49:org.cytoscape.app-impl:3.8.2]
        at org.cytoscape.app.internal.manager.AppManager$1.onFileCreate(AppManager.java:500) [49:org.cytoscape.app-impl:3.8.2]
        at org.cytoscape.app.internal.manager.AppManager$1.onFileChange(AppManager.java:521) [49:org.cytoscape.app-impl:3.8.2]
        at org.apache.commons.io.monitor.FileAlterationObserver.doMatch(FileAlterationObserver.java:400) [22:org.apache.commons.io:2.1.0]
        at org.apache.commons.io.monitor.FileAlterationObserver.checkAndNotify(FileAlterationObserver.java:334) [22:org.apache.commons.io:2.1.0]
        at org.apache.commons.io.monitor.FileAlterationObserver.checkAndNotify(FileAlterationObserver.java:304) [22:org.apache.commons.io:2.1.0]
        at org.apache.commons.io.monitor.FileAlterationMonitor.run(FileAlterationMonitor.java:182) [22:org.apache.commons.io:2.1.0]
        at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: org.osgi.framework.BundleException: Unable to resolve Casual-path-cytoscape-app [212](R 212.0): missing requirement [Casual-path-cytoscape-app [212](R 212.0)] osgi.wiring.package; (osgi.wiring.package=org.panda.causalpath
.run) Unresolved requirements: [[Casual-path-cytoscape-app [212](R 212.0)] osgi.wiring.package; (osgi.wiring.package=org.panda.causalpath.run)]
        at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4149) ~[?:?]
        at org.apache.felix.framework.Felix.startBundle(Felix.java:2119) ~[?:?]
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) ~[?:?]
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984) ~[?:?]
        at org.cytoscape.app.internal.manager.BundleApp.start(BundleApp.java:82) ~[?:?]
        ... 7 more

@scootermorris
Copy link

This isn't the right way to go about this at all. The CausalPath jar file provides functionality that you need to call (not run) from your Cytoscape app. Essentially, all of the information you are getting from the command line, you need to get as Tunables and then call a new method that's going to run the algorithm and return a Cytoscape network (without writing anything out).

@thepritam
Copy link
Collaborator

@scootermorris Thank you for the response.
There are a couple of things I need to mention which I have discussed with @cannin and @ozgunbabur.

  1. There are a lot of variables that can be tweaked, but the easier way of using it has been via parameters.txt. There is an interface where we can insert the values which are in the parameter. txt and run the algorithm. But there are so many parameters in the parameter. txt and it is very much time-consuming the values every time we run it. So, that's why the parameter. txt to serve the purpose. So for our case, the path to the file parameter. txt is the only tunable parameter.
    Below is the example of the sample parameter. txt file.
# Name of the proteomic data file
proteomics-values-file = MCF7-IGF1.txt

# Names of columns that contain information other than values and what they map to
id-column = ID
symbols-column = Symbols
sites-column = Sites
effect-column = Effect

# How the values should be interpreted
value-transformation = significant-change-of-mean-paired

# FDR thresholds for data types
fdr-threshold-for-data-significance = 0.1 protein
fdr-threshold-for-data-significance = 0.1 phosphoprotein

# Should we use proteomic and phosphoproteomic values together while calculating the p-value threshold that satisfies the required FDR? We say yes here because this is RPPA data.
pool-proteomics-for-fdr-adjustment = true

# Which value corresponds to the most intense color? When the value is a p-value (as here), this setting is applied to -ln(p).
color-saturation-value = 10

# Whether to show proteomic values on the disconnected proteins
show-all-genes-with-proteomic-data = true

# Even though we set network significance calculations on here, the webserver will ignore it because of limited resources. If this analysis is performed locally using the JAR file, then the network significance will be calculated.
calculate-network-significance = true
permutations-for-significance = 10000
fdr-threshold-for-network-significance = 0.1
use-network-significance-for-causal-reasoning = true

# Names of control and test columns. In a paired analysis, their order are important.
control-value-column = Serum-DMSO-2hr
test-value-column = IGF1-DMSO-2hr
control-value-column = Serum-DMSO-4hr
test-value-column = IGF1-DMSO-4hr
control-value-column = Serum-DMSO-48hr
test-value-column = IGF1-DMSO-48hr
control-value-column = Serum-DMSO-5min
test-value-column = IGF1-DMSO-5min
control-value-column = Serum-DMSO-24hr
test-value-column = IGF1-DMSO-24hr
control-value-column = Serum-DMSO-12hr
test-value-column = IGF1-DMSO-12hr
control-value-column = Serum-DMSO-60min
test-value-column = IGF1-DMSO-60min
control-value-column = Serum-DMSO-15min
test-value-column = IGF1-DMSO-15min
control-value-column = Serum-DMSO-30min
test-value-column = IGF1-DMSO-30min
  1. Secondly @ozgunbabur mentioned for running the algorithm we just need to call the below code and pass only the to generate the network files.
org.panda.causalpath.run.CausalPath.main(new String[]{input_directory}), 

And I have tried to do the same and also tried another thing which is given in the below link:
The link to my code:
So, I am confused about the new method which you are describing to run the algorithm and also about calling the function not running it.
Please help me out with the doubts I am having.
Thanks,
@thepritam

@scootermorris
Copy link

I'll take these in turn:

  1. Yes, there are a lot of values, but the way it's currently set up, the user will have to edit those values manually anyways, which for many Cytoscape users might be a significant hurdle. Frankly, by the time I edit all of the parameters in parameter.txt, I don't understand what value the Cytoscape app provides. It seems like all it really does is run the algorithm (which, if I'm familiar enough with the command line to do all of the editing, I can probably execute the jar file) and then read in the resulting network. This approach also makes this more difficult to automate. So, I would suggest a different approach. First, I would read the proteomics data into a table -- you now have all of the data in columns. Next, get the names of the control and test columns. At the same time, you can get the names of the other columns. That leaves relatively few parameters: transformation, fdr cutoffs, etc. Now you have all of the data you need to execute the algorithm without any extra directories. All the user needs to worry about is their proteomics results.
  2. Now that you have all of the data, you need to get that data into the algorithm. That's where the second constructor would come in. The idea is that the new constructor would allow you to pass the parameters and the data and get back an edge list. Since you have the raw proteomics data, you could also create virtual columns in the result network that would point to the actual abundance numbers, fold changes, etc. This could be used to color nodes, change node borders, etc.

So, the real question here is what is the purpose of writing a Cytoscape app? Clearly, it isn't for folks who are adept at using editors and command line tools, so who is it for? At the end of the day, I think that the goal is to make the CausalPath algorithm more accessible to researchers who aren't computational. To that end, I would suggest thinking hard about your design. If, on the other hand, you think that the users are perfectly fine using emacs, vim, or a reasonable text editor, then I would suggest just writing a very small app that will read in the output files from causal path and not bother with running the algorithm itself -- completely decouple the algorithm from the output and just focus on getting the output into Cytoscape.

@cannin
Copy link
Owner Author

cannin commented Jun 22, 2021

@scootermorris I appreciate the feedback. We'll think about the UI that users interact with over the course of the summer (the first point); the goal is to target users who are not computational and not comfortable with the command line.

In the short term, rather than questions of design, I'm more concerned about the feasibility of running our existing Java code (as is) from Cytoscape. It appears that we running into issues with OSGI (or something else) and we're not sure how to proceed.

Apps like Cytocopter seem to use genetic algorithms/CSV reading/plotting from existing projects within Cytoscape:

https://github.com/saezlab/cytocopter/blob/master/pom.xml

so I assume it is possible, but I'm not sure how to guide @thepritam in debugging errors he is facing (the bundle start error; see above).

The easiest way to prototype the work is the 1 parameter function that @thepritam is using and I would prefer to continue to use this until we know there are no major incompatibilities between CausalPath and Cytoscape.

If you have time and it would facilitate this discussion, we could have a video chat.

@thepritam
Copy link
Collaborator

@scootermorris Can we please discuss over video chat to discuss the issues as @cannin mentioned? It is one of the core-task for the project. And We are very much stuck with it. Please let me know if we can arrange a video chat for it.
Thanks
@thepritam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants