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

Add jba executable to your Path #97

Open
ryao-mdanderson opened this issue Nov 9, 2023 · 11 comments
Open

Add jba executable to your Path #97

ryao-mdanderson opened this issue Nov 9, 2023 · 11 comments

Comments

@ryao-mdanderson
Copy link

Dear JaBbA authors:

I followed https://github.com/mskilab-org/JaBbA/tree/master to install JaBbA on R/4.1.0 on RHEL 7 server.

Section Installation from GitHub, I have trouble to understand step 4
4. For convenience, add jba executable to your PATH
the instruction is :
$ JABBA_PATH=$(Rscript -e 'cat(paste0(installed.packages()["JaBbA", "LibPath"], "/JaBbA/extdata/"))')
$ export PATH=${PATH}:${JABBA_PATH}
$ jba ## to see usage

The following is my installation:
1, check out JaBbA under $HOME https://github.com/mskilab-org/JaBbA.git
-- this creates JaBbA directory under $HOME (below /rsrch3/home/itops/ryao/), with the following contents:

codecov.yml configure configure.ac DESCRIPTION inst jba LICENSE NAMESPACE old.travis.yml R README.md R-pkgs rtdocs srcs tests

2, Installed all R package by devtools::install_github('mskilab/JaBbA') under $HOME/JaBbA/R-pkgs
-- this step is not straightforward. including many troubleshooting remove and reinstall packages.

3, there are 146 packages installed under $HOME/JaBbA/R-pkgs, including JaBbA, it has the following contents:

CITATION cmd.args cmd.args.rds DESCRIPTION extdata help html libs LICENSE Meta NAMESPACE R

4, I try a test run jba executable on provided toy data:

/rsrch3/home/itops/ryao/JaBbA/jba /rsrch3/home/itops/ryao/JaBbA/R-pkgs/JaBbA/extdata/junctions.vcf /rsrch3/home/itops/ryao/JaBbA/R-pkgs/JaBbA/extdata/coverage.txt
Did not find hets file setting to NULL
Did not find nseg file setting to NULL


(___ ) ( \ ( ) ( _ ) | | _ _ | (_) )| |_ | (_) | _ | | /'_ )| _ <'| '\ | _ | ( )_| |( (_| || (_) )| |_) )| | | | _/'`_,)(___/'(,/'() ()

(Junction Balance Analysis)

JaBbA 2023-11-09 11:56:16: Located junction file /rsrch3/home/itops/ryao/JaBbA/R-pkgs/JaBbA/extdata/junctions.vcf
JaBbA 2023-11-09 11:56:16: Located coverage file /rsrch3/home/itops/ryao/JaBbA/R-pkgs/JaBbA/extdata/coverage.txt
JaBbA 2023-11-09 11:56:16: Loading packages ...
Error in JaBbA(junctions = opt$junctions, coverage = opt$coverage, juncs.uf = opt$j.supp, :
could not find function "JaBbA"
Calls: suppressPackageStartupMessages -> withCallingHandlers
In addition: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called ‘JaBbA’
Execution halted

Referring to JABBA_PATH=$(Rscript -e 'cat(paste0(installed.packages()["JaBbA", "LibPath"], "/JaBbA/extdata/"))')
I guess my question is how do I specify JABBA_PATH in step 4 in order to find customized R-pkgs?

Thank you for your help.
Rong Yao

@shihabdider
Copy link
Collaborator

You don't have to clone the package if you are installing via devtools::install_github(). It is also not necessary to add the jba CLI script to path. This is only required if you are attempting to run directly from the terminal (i.e not within R).

If you want to use the package from within R, you'll need to first import the package to the R session using library("JaBbA").

Regarding step four, you can append these lines:

JABBA_PATH=$(Rscript -e 'cat(paste0(installed.packages()["JaBbA", "LibPath"], "/JaBbA/extdata/"))')
export PATH=${PATH}:${JABBA_PATH}

to your .bashrc file (located in your ${HOME} directory) and then do source .bashrc. This will add the jba executable to your PATH so that you can run jba <path_to_junctions_file> <path_to_coverage_file> [OPTIONS] on the terminal.

@ryao-mdanderson
Copy link
Author

Hello @shihabdider Thank you for your quick response.

I am able to import the package to the R session using library("JaBbA"). However, I do have a test command to test this library.

I aim to run jba executable in command line, use the test case described in step 5.
Hit an error message: All my R packages are installed in $HOME/JaBbA/R-pkgs.

$ which Rscript
/risapps/rhel7/R/4.1.0/lib64/R/bin/Rscript
$ JABBA_PATH=$(Rscript -e 'cat(paste0(installed.packages()["JaBbA", "LibPath"], "/JaBbA/extdata/"))')
Error in installed.packages()["JaBbA", "LibPath"] :
subscript out of bounds
Calls: cat -> paste0
Execution halted

I replaced the above LibPath to be the R package location $HOME/JaBbA/R-pkgs, received the same error message.

Thank you for help.
Rong

@shihabdider
Copy link
Collaborator

shihabdider commented Nov 9, 2023

OK you can try to set the JABBA_PATH directly to the path of jba. I.e JABBA_PATH=<path/to/your/jba/file>. The jba file should be inside the extdata/inst directory of the JaBbA package.

If you want to test JaBbA inside of R, you can try the following:

JaBbA(junctions = path_to_junctions_file, coverage = path_to_coverage_file)

Alternatively, if you're still having issues, you can try to load the package manually through the repo. To do this:

  1. Clone the repo:git clone https://github.com/mskilab-org/JaBbA
  2. cd into the repo directory
  3. Inside of an R session do devtools::load_all('.')

You should now be able to run JaBbA through the JaBbA() method mentioned above. You can also run the test code in tests/testthat/test_JaBbA.R

@ryao-mdanderson
Copy link
Author

Hello @shihabdider:
Thank you for reply.

I tried both methods, unfortunately, both are not working.

first method:
R
R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"

library(JaBbA)
JaBbA(junctions="/rsrch3/home/itops/ryao/JaBbA/R-pkgs/JaBbA/extdata/junctions.vcf",
coverage="/rsrch3/home/itops/ryao/JaBbA/R-pkgs/JaBbA/extdata/coverage.txt")
2023-11-09 14:42:59: Starting analysis in /rsrch3/home/itops/ryao/JaBbA
CPLEX environment opened
Rcplex: num variables=3 num constraints=2
Version identifier: 12.10.0.0 | 2019-11-26 | 843d4de
CPXPARAM_TimeLimit 9.9999999999999995e+73
CPXPARAM_MIP_Tolerances_AbsMIPGap 0
CPXPARAM_MIP_Pool_RelGap 0
CPXPARAM_MIP_Pool_AbsGap 0
Tried aggregator 1 time.
QP Presolve eliminated 2 rows and 3 columns.
All rows and columns eliminated.
Presolve time = 0.00 sec. (0.00 ticks)
Barrier time = 0.00 sec. (0.00 ticks)
...
JaBbA 2023-11-09 14:43:05: Built gGraph with 358 nodes, 518 edges, purity 0.6, and ploidy 1.93
Error in aggregate.formula(...) : 'formula' missing or incorrect
In addition: Warning messages:
1: In gGnome:::read.juncs(rafile, flipstrand = flipstrand, keep.features = keep.features, :
some BND entries have unsupported ALT fields
2: JaBbA 2023-11-09 14:43:01: Tier field tier missing: giving every junction the same tier, i.e. all have the potential to be incorporated
3: In dt2gr(tmp) : Warning: Coercing to GRanges via non-standard columns
4: JaBbA 2023-11-09 14:43:01: doing nothing special to the small INDEL-like isolated junctions
5: In karyograph_stub(seg, coverage, ra = ra, out.file = kag.file, :
No normal copy number values supplied so defaulting to 2 for all segments.

Second method:

Go to /tmp directory, git clone code; cd to the cloned repo

devtools::load_all('.')
ℹ Loading JaBbA
Error in abort_for_missing_packages():
! Dependency package(s) 'gGnome' not available.
Run rlang::last_error() to see where the error occurred.
Warning messages:
1: multiple methods tables found for ‘seqinfo<-’
2: In (function (dep_name, dep_ver = "*") :
Dependency package 'gGnome' not available.

I am not sure if this is just my test ends up this ...

Thank you for your help.
Rong

@shihabdider
Copy link
Collaborator

I was able to reproduce this error and am still working on debugging it. In the meantime, you can try using our recently released pipeline which starts from BAMs or FASTQs and runs all the way to the JaBbA output. Every tool in the pipeline is containerized so there should no issues with package installation.

If you'd prefer to run JaBbA by itself, I recommend to try using our docker container instead. Note: you will need to add/install cplex to the container, the instructions are given here.

@shihabdider
Copy link
Collaborator

shihabdider commented Nov 16, 2023

For the test case try running the following code (taken from test_JaBbA.R):

library(JaBbA)
library(gUtils)
library(gTrack)
library(testthat)

whitelist.junctions = system.file("extdata", "whitelist.junctions.rds", package = 'JaBbA')
blacklist.coverage = system.file("extdata", "hg19.blacklist.coverage.rds", package = 'JaBbA')
jj = system.file("extdata", "junctions.rds", package = "JaBbA")
cf = system.file("extdata", "coverage.txt", package = "JaBbA")
ht = system.file("extdata", "hets.txt", package = "JaBbA")
hr = fread(ht) %>% dt2gr

## default is boolean
jab = suppressWarnings(
    JaBbA(junctions = jj,
          coverage = cf,
          whitelist.junctions = whitelist.junctions,
          blacklist.coverage = blacklist.coverage,
          ## seg = segs,
          ## nseg = nsegs,
          ## strict = TRUE,
          slack.penalty = 10,
          hets = ht,
          tilim = 60,
          cfield = 'nudge',
          verbose = 2,
          outdir = './JaBbA.allin',
          overwrite = TRUE,
          ploidy=4.5,## preset HCC1954
          purity=1,
          epgap = 0.01,
          all.in = TRUE,
          ## juncs.uf = juncs.fn,
          tfield = 'nothing',
          nudge.balanced = TRUE,
          dyn.tuning = TRUE,
          max.na = 1)
)

@ryao-mdanderson
Copy link
Author

@shihabdider Thank you for your patience to support!

I tried the above test for two R versions. With JaBbA loaded successfully on both R sessions.

Test on R/4.1.0, hit the error message:
...
JaBbA 2023-11-16 11:17:47: Built gGraph with 88 nodes, 50 edges, purity 1, and ploidy 4.5
Error in aggregate.formula(...) : 'formula' missing or incorrect

in R/4.3.1, hit the error message
JaBbA 2023-11-16 11:08:37.318085: Built gGraph with 88 nodes, 50 edges, purity 1, and ploidy 4.5
Error in !is.null(formatting(object)$y.field) && !is.na(formatting(object)$y.field) :
'length = 2' in coercion to 'logical(1)'

The source code was check out by
git clone https://github.com/mskilab-org/JaBbA.git

The site I refer to is https://github.com/mskilab-org/JaBbA/ master branch.

Thank you for help.
Rong

@shihabdider
Copy link
Collaborator

Unfortunately, I'm not able to reproduce either error on my machine. To eliminate versioning as a cause of the issue, could you please run the test using R 4.0.2? You can download it here.

@Kazuki526
Copy link

Kazuki526 commented Mar 6, 2024

Hello- thanks for the tool.

I am facing the same problem.
In R 4.3.0,
"Error in !is.null(formatting(object)$y.field) && !is.na(formatting(object)$y.field) :.
'length = 2' in coercion to 'logical(1)'",

In R 4.0.2,
"Error in aggregate.formula(...) : 'formula' missing or incorrect R 4.0.2 gives "Error in aggregate.formula(...) : 'formula' missing or incorrec".

The error in R 4.3.0 was the same as #94, so I tried using the segmentation file and got the same error as above.

@jrafailov
Copy link

jrafailov commented Mar 14, 2024

Hi, I was able to replicate your error and my best guess is that it is caused by an outdated gTrack package. The latest commit should address the error you see in R 4.3.0.

@jrafailov
Copy link

As a follow up, the latest commit of gTrack should address both errors you experience. Please let us know if you still see the same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants