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

Support for multiple reference ligands #2

Open
michael-robo opened this issue Jan 18, 2024 · 0 comments
Open

Support for multiple reference ligands #2

michael-robo opened this issue Jan 18, 2024 · 0 comments

Comments

@michael-robo
Copy link

michael-robo commented Jan 18, 2024

Hello!

I'm trying to set up maps using a pre-built distance matrix where I have multiple reference ligands. I've attached a zipfile with the script, inputs, and output of "conda list". I'm using HiMap version 1.0.0 .

When I run the script using the existing codebase, I get the following error:

R[write to console]: Error in t(design.mat) %*% diag(null.weight) : non-conformable arguments

Traceback (most recent call last):
  File "/N/project/R-M-01/mrobo/1/mol_enum_02/network/himap/himap_with_matrix.py", line 40, in <module>
    himap.clusters2optimize(sub_arr, sub_ID, clusters2optim = selected_clusters,
  File "/N/slate/mrobo/mambaforge_br200/envs/himap/lib/python3.9/site-packages/himap-0+unknown-py3.9.egg/himap/clustering.py", line 843, in clusters2optimize
    himap.Optimize(n_ar, ID_list = sub_ID_list, ref_lig = sub_refs[k], **kwargs)
  File "/N/slate/mrobo/mambaforge_br200/envs/himap/lib/python3.9/site-packages/himap-0+unknown-py3.9.egg/himap/optimal.py", line 273, in Optimize
    c=py_run_optimization(ref_lig, r_df, r_optim_types, num_edges)
  File "/N/slate/mrobo/mambaforge_br200/envs/himap/lib/python3.9/site-packages/himap-0+unknown-py3.9.egg/himap/optimal.py", line 141, in py_run_optimization
    out=r.run_optimization(*args)
  File "/N/slate/mrobo/mambaforge_br200/envs/himap/lib/python3.9/site-packages/rpy2/robjects/functions.py", line 198, in __call__
    return (super(SignatureTranslatedFunction, self)
  File "/N/slate/mrobo/mambaforge_br200/envs/himap/lib/python3.9/site-packages/rpy2/robjects/functions.py", line 125, in __call__
    res = super(Function, self).__call__(*new_args, **new_kwargs)
  File "/N/slate/mrobo/mambaforge_br200/envs/himap/lib/python3.9/site-packages/rpy2/rinterface_lib/conversion.py", line 45, in _
    cdata = function(*args, **kwargs)
  File "/N/slate/mrobo/mambaforge_br200/envs/himap/lib/python3.9/site-packages/rpy2/rinterface.py", line 680, in __call__
    raise embedded.RRuntimeError(_rinterface._geterrmessage())
rpy2.rinterface_lib.embedded.RRuntimeError: Error in t(design.mat) %*% diag(null.weight) : non-conformable arguments

Investigating the issue myself, I found that the issue was in optimal_design.R . I made the following changes in that file (old lines are commented out):

          #rbind( diag( length( ligand.list))[ which( ligand.list == reference.ligand),])
          rbind( diag( length( ligand.list))[ which( ligand.list %in% reference.ligand),])
     
        #null.weight <- c( rep( 1, nrow(.)), 2)
        #sim.weight <- c( .$SIM_WEIGHT, 2)
        null.weight <- c( rep( 1, nrow(.)), rep(2,length(reference.ligand)))
        sim.weight <- c( .$SIM_WEIGHT, rep(2, length(reference.ligand)))

With this change, using multiple reference ligands is now tolerated.

I won't claim that I know what I'm doing here (in ligand mapping, the R programming language, GitHub etiquette, or life in general), so the first question that I'll ask is whether this is a bug or a feature. If it's a feature, why would using multiple reference ligands be discouraged in this use case, and why isn't there a corresponding error message that fails the program early? If it is a bug, did I fix it correctly without introducing any new issues downstream?

Thanks for your help (and writing the library),
Michael Robo
Computational Chemistry Staff Scientist
Indiana Biosciences Research Institute

himap_bug_report.zip

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

1 participant