jewettaij / moltemplate

A general cross-platform tool for preparing simulations of molecules and complex molecular assemblies
http://www.moltemplate.org
MIT License
244 stars 95 forks source link

name_sequence_multi not properly initialized when genpoly API is used. #59

Closed ProfLeao closed 2 years ago

ProfLeao commented 2 years ago

When GenPoly ParseArgs is used referencing the "-sequence" file, name_sequence_multi is not initialized. This is probably due to the fact that ReadSequence is only executed in main() which is not used in API mode. I think it's something simple to fix, but I believe you have a proposal for a better solution.

jewettaij commented 2 years ago

Thanks again Reginaldo for catching this bug. Although this is not what I want people to do, I should fix this bug. I should probably move all of that code for reading files from main() into GenPoly.ParseArgs().

Meanwhile, I suggest setting the "name_sequence_multi" member manually. That way, you can avoid having to use the file system. Here is an example from the test_genpoly_lt.py file:

gp.name_sequence_multi =[['AT', 'CG', 'GC', 'TA', 'AT', 'CG', 'GC', 'TA',
                          'AT', 'CG', 'GC', 'TA', 'AT', 'CG', 'GC', 'TA',
                          'AT', 'CG', 'GC', 'TA', 'AT']]

(Note: The "name_sequence_multi" member is a list-of-lists-of-strings. One list-of-strings per polymer. In this example, there is only one polymer.) This is a way to avoid this problem. I hope this helps.
When I fix the bug and/or change the documentation, I will close this issue. Thanks again Andrew

jewettaij commented 2 years ago

I think this has been fixed now in commit fb8eeb5, but I admit that I haven't tested the resulting behavior very thoroughly. Let me know if you run into any more difficulties with genpoly_lt.py. Thanks again for reporting this. -Andrew

ProfLeao commented 2 years ago

I'll run tests with my usage and give you some feedback. Thank you so much!

jewettaij commented 2 years ago

Closing again. Thanks again for your help today.