Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Non integer strings are not accepted by R #8

Closed
KrisDavie opened this issue Apr 1, 2020 · 3 comments · Fixed by vib-singlecell-nf/vsn-pipelines#262
Closed

Non integer strings are not accepted by R #8

KrisDavie opened this issue Apr 1, 2020 · 3 comments · Fixed by vib-singlecell-nf/vsn-pipelines#262
Labels
bug Something isn't working enhancement New feature or request

Comments

@KrisDavie
Copy link
Member

Python allows non integer strings to be used, whereas R does not. Providing a string as a seed causes R processes to crash.

R functions can use the following code to get a integer seed from a string:

if (params.global.seed instanceof String) {
    seed = params.global.seed.hashCode()
} else {
    seed = params.global.seed
}
@KrisDavie KrisDavie added bug Something isn't working enhancement New feature or request labels Apr 1, 2020
@dweemx
Copy link
Contributor

dweemx commented Apr 1, 2020

Hey @KrisDavie,
Nice catch! Shouln't better have common seed instead of just handling this for R functions ?

@KrisDavie
Copy link
Member Author

Yeah, actually it would be better for people wanting to use text seeds to use
'seed_goes_here'.hashCode() in their params directly.

We should at least have a check for params built in before other things run maybe.
This didn't cause en error until very far into a pipeline for me, after cellranger and other stuff, and then because parseParams returns global, the process changes if you change the seed in the params, which would mean everything needs to be rerun

@KrisDavie
Copy link
Member Author

Adding to this, just had this error after using .hashCode(): ValueError: Seed must be between 0 and 2**32 - 1 because the seed was negative. .hashCode().abs() should fix this.

dweemx added a commit to vib-singlecell-nf/vsn-pipelines that referenced this issue Nov 24, 2020
@dweemx dweemx closed this as completed Nov 24, 2020
KrisDavie pushed a commit to vib-singlecell-nf/vsn-pipelines that referenced this issue Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants