Error in chisq.test(obs2, p = rep(1/4, 4)) : at least one entry of 'x' must be positive
Closed this issue · 14 comments
Hi,
I think this error message appears when the obs2 variable for the chisq.test is c(0,0,0,0).
When I debugged line by line, I think there are a number of TRA events but no event from the DEL, DUP, h2hINV, t2tINV categories. Perhaps a test for non-zero before the chisq.test is needed.
Hello Alvin,
Thanks for your comment. Please note that in function_criteria.R we only use that function when the number of SVs > 0. If you give me more information I might be able to help with your particular issue.
Best,
Isidro
Thanks Alvin. I will have a look at this. Please note that TRA assumes that the SVs are interchr. That is, there are no intrachr SVs in the TRA category.
Thanks @isidroc, I checked and there are no intrachr SVs in the TRA category. The manta calls include INS, causing nrow > 1 but not falling into the main svclasses. How would you classify the SV type for INS for shatterseek? Would you filter it out for the analysis.
Hi Alvin, apologies for my tardiness (I reply by email more quickly). INS will generate two breakpoints, which you can classify into the 4 categories we consider. Happy to help you further if needed.
Hi Isidro,
I am having the same issue and the program corrupted.
Error in chisq.test(obs2, p = rep(1/4, 4)) :
at least one entry of 'x' must be positive
In addition: Warning messages:
1: In min(c(SVsnow$pos1, SVsnow$pos2)) :
no non-missing arguments to min; returning Inf
2: In max(c(SVsnow$pos1, SVsnow$pos2)) :
no non-missing arguments to max; returning -Inf
3: In min(c(SVsnow$pos1, SVsnow$pos2)) :
no non-missing arguments to min; returning Inf
4: In max(c(SVsnow$pos1, SVsnow$pos2)) :
no non-missing arguments to max; returning -Inf
5: In min(c(SVsnow$pos1, SVsnow$pos2)) :
no non-missing arguments to min; returning Inf
6: In max(c(SVsnow$pos1, SVsnow$pos2)) :
no non-missing arguments to max; returning -Inf
7: In chisq.test(obs2, p = rep(1/4, 4)) :
Chi-squared approximation may be incorrect
Called from: chisq.test(obs2, p = rep(1/4, 4))
Looking at the SV data, there are TRA, DEL, DUP, and INS, but I still has the error. I appreciate any suggestions.
Any futher progress regarding this error? I got the same error when i used a GRIDSS-called VCF (all svtype "BND").
Any suggestions as to how one can convert BND to your preferred svtypes?
Evaluating the statistical criteria
Error in chisq.test(obs, p = rep(1/4, 4)) :
at least one entry of 'x' must be positive
In addition: Warning messages:
1: In min(c(SVsnow_window$pos1[which(SVsnow_window$chrom1 == chr_inter)], :
no non-missing arguments to min; returning Inf
2: In max(c(SVsnow_window$pos1[which(SVsnow_window$chrom1 == chr_inter)], :
no non-missing arguments to max; returning -Inf
Any futher progress regarding this error? I got the same error when i used a GRIDSS-called VCF (all svtype "BND").
Any suggestions as to how one can convert BND to your preferred svtypes?Evaluating the statistical criteria Error in chisq.test(obs, p = rep(1/4, 4)) : at least one entry of 'x' must be positive In addition: Warning messages: 1: In min(c(SVsnow_window$pos1[which(SVsnow_window$chrom1 == chr_inter)], : no non-missing arguments to min; returning Inf 2: In max(c(SVsnow_window$pos1[which(SVsnow_window$chrom1 == chr_inter)], : no non-missing arguments to max; returning -Inf
I used StructuralVariantAnnotation
and convert the none DEL/DUP/INS to TRA and it works a treat.
Thanks for providing a solution @alhafidzhamdan . Alternatively, you can preprocess your calls using https://github.com/ljdursi/mergevcf
Please check the documentation re the input requirements, as e.g. BND are not accepted.
Best and thanks,
Isidro
Thank you for your great work.
Probably my problem is related to this issue#9.
When I ran the package, I have two different warning message;
In chisq.test(obs2, p = rep(1/4, 4))Chi-squared approximation may be incorrect
In max(c(SVsnow_window$pos1[which(SVsnow_window$chrom1 == chr_inter)],no non-missing arguments to max; returning -Inf
If I understand correctly, the number of SVs is too small in calculating "Fragment join test". So, I think it is an unavoidable message. But, if there is any solution to put these warning messages away, could you tell me how to manage.
Thank you in advance for your generous support.
Can you please send me a minimal working example (i.e. the SV and CN files/data you are using) so I can see how to fix this? Thanks
I assume it works as I have not received any further comments. Thanks for reporting
Hi, sorry for this intromission, but I had the same problem and I resolved it just by converting "BND" with "TRA" (trivially, gsub("BND","TRA", mySVtab$mySVType_column )
). I also had a Manta output, which I converted to bedpe format via svtools . Hope this is useful.