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

Check and fix multicollinearity for association analysis and gRNA assignment #146

Open
nhu-github opened this issue Sep 17, 2024 · 7 comments

Comments

@nhu-github
Copy link

nhu-github commented Sep 17, 2024

> sceptre_object <- set_analysis_parameters(
+   sceptre_object = sceptre_object,
+   discovery_pairs = discovery_pairs,
+   positive_control_pairs = positive_control_pairs,
+   side = "right",
+   resampling_mechanism = "permutations"
+ )
Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : 
  contrasts can be applied only to factors with 2 or more levels

Tried many ways but still cannot correct this issue. I am thinking if I missed some sutle change.

The sample data works while my own data does not. So I am thinking if any data format issue related.

@nhu-github
Copy link
Author

ok, formula_object added kill this issue

@ekatsevi
Copy link
Member

Could you elaborate on what formula_object helped you resolve your issue?

@nhu-github
Copy link
Author

nhu-github commented Sep 18, 2024

I ran a nextflow pipeline using the default data from sceptredata . All the code worked well until I put in my own dataset. Then I defined formula_object=formula(~ log(response_n_nonzero) + log(response_n_umis) + log(grna_n_nonzero) + log(grna_n_umis) + response_p_mito + batch) that I found from the tutorial helped to eliminate the error. Then the same problem occurred when I ran assign_grna using the mixture method for my high MOI data, but the error was also eliminated by the same formula_object. So my question is: should I use the same formula for grna_assignment_formula to run assign_grna?

@timothy-barry
Copy link
Member

Hi,

I am not totally sure I understand. Is the issue that you passed a particular formula_object to grna_assignment_formula and you encountered a bug?

@nhu-github
Copy link
Author

No, the problem was with the default settings on my own data (without passing formula_object). After I passed formula_object, the code went well.

@Saranya-Balachandran
Copy link

Saranya-Balachandran commented Nov 1, 2024

Dear Timothy,
I am facing the same issue stated above, I have set formula object using set analysis parameters, and on printing the object the formula appears, but when assigning grna's, it only works if I provide the below command

sceptre_object_highmoi_mixture <- assign_grnas(
sceptre_object = sceptre_object,
method = "mixture", parallel = TRUE,
formula_object = formula(formula)
)
the formula is exactly the same that I provided for set_analysis_parameters.

Why is this a requirement?

@ekatsevi ekatsevi reopened this Nov 5, 2024
@ekatsevi
Copy link
Member

ekatsevi commented Nov 5, 2024

Hi Saranya, thanks for bringing this issue to our attention. By default, sceptre does not use the same formula object for association testing and for gRNA assignment. The reason for this is that there are some extra covariates that are usually good to include for gRNA assignment, like grna_n_umis and grna_n_nonzero. By default, these extra covariates are also included when running gRNA assignment. However, the fact that you are getting an error when doing so suggests that, on your data, the inclusion of these additional covariates is causing perfect multicollinearity. To resolve this issue, we'll need to implement an update that checks for this. In the meantime, I recommend you continue running the code by re-specifying the formula during gRNA assignment.

@ekatsevi ekatsevi changed the title set analysis parameter Check and fix multicollinearity for association analysis and gRNA assignment Nov 5, 2024
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