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

NA/NaN/Inf in foreign function call (arg 4) #9

Open
hvalim opened this issue Jan 11, 2024 · 4 comments
Open

NA/NaN/Inf in foreign function call (arg 4) #9

hvalim opened this issue Jan 11, 2024 · 4 comments

Comments

@hvalim
Copy link

hvalim commented Jan 11, 2024

Hi there,

I am working on time series data (Illumina raw reads quantified using Salmon) and ran into the following error:

Error in dynGENIE3(TS.data2, time.points2) : 
  NA/NaN/Inf in foreign function call (arg 4)

I initially suspected this was related to a large number of zeros in my dataset, but this problem persists even when I remove all rows containing zeros from the analysis. If you have some input into this problem, I would greatly appreciate it!

@vahuynh
Copy link
Owner

vahuynh commented Jan 12, 2024

Hi,

Have you checked that your data does not contain any NaNs?
Also, as your are using alpha="from.data" (which is the default), you can check issue #6.

@hvalim
Copy link
Author

hvalim commented Jan 12, 2024

Hi, thank you for the reply! I have checked my data but not found any NaNs.

I am using the default alpha="from.data" and have followed the advice in issue #6. However, setting alpha as a fixed value seems to spit out the same error as above NA/NaN/Inf in foreign function call (arg 4).

I have tried running alphas <- estimate.decay.rates(TS.data, time.points) but even with the test data, I get the following error message:
Error in current.timeseries[, target.gene.name] : subscript out of bounds

@dkainer
Copy link

dkainer commented Mar 6, 2024

I am getting the same error as @hvalim.

Error in { :
  task 264 failed - "NA/NaN/Inf in foreign function call (arg 4)"

I am running this with 32 cores, and i am aware that the message with "task 264" is probably from Foreach package when one of the forked tasks fails. Since each task is probably fitting a model for one gene, I checked the 264th gene in my input data. Here is what I see:

> ts1[264,]
 DRT_63  DRT_70  DRT_77  DRT_84  DRT_91 DRT_98  DRT_105  DRT_112  DRT_119
        0           0          0            0         0         0            0           0           0

So clearly this gene has all zeros and is possibly causing problems. However, the reason I have not removed it because I have a second time series in which this 264th gene is NOT all zeros. When I run these together using TS.data = list(ts1, ts2) in the function call, I get the exact same error with task 264.
Do I need to remove any gene that has all zeros in one of the timeseries?

@vahuynh
Copy link
Owner

vahuynh commented Mar 13, 2024

Hi @dkainer ,

The error arises because, when estimating the gene decay rate from the data, I assume that there is an exponential decay between the highest and lowest expression values of the gene. Since gene 264 has only zero values in one time series, the function estimating the decay rates will return a NaN for that time series.

I modified the function estimating the decay rates, so that it can handle genes having constant values. Let me know if it works, now!

@hvalim , I hope it will solve the problem for you too.

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

3 participants