Package: hmm-profile
HMM_profileHidden Markov Model profile toolkit.Written in the base ofHMMER User's Guidep.107.UsageWith my package you can read and write hmm profile files.
It's easy to use and easy to read - the best documentation is a well-written code itself,
so don't be scared about reading source code.ReaderRead all hmm from fileTheread_allfunction returns generator to optimise memory usage -
it's a common pattern that one file contains many profiles.fromhmm_profileimportreaderwithopen('/your/hmm/profile/file.hmm')asf:model_generator=reader.read_all(f)# IMPORTANT: returns generatorprofiles=list(model_generator)Read single modelIf you have only single model files, you can use this method. It will returnmodels.HMMready to use.fromhmm_profileimportreaderwithopen('/your/hmm/profile/file.hmm')asf:model=reader.read_single(f)WriterWrite multiple profiles to single filefromhmm_profileimportwriterprofiles=[...]path='/your/hmm/profile/file.hmm'writer.save_many_to_file(hmms=profiles,output=path)Write single model to filefromhmm_profileimportwritermodel=...path='/your/hmm/profile/file.hmm'writer.save_to_file(hmm=model,output=path)Get file content without savingfromhmm_profileimportwritermodel=...lines=writer.get_lines(model)# IMPORTANT: returns generatorcontent=''.join(lines)Support/bugsIf you have a file that is not readable or has some glitches on save, please crate the issue and attach this file.Bug reports without files (or good examples if you can't provide full file) will be ignored.GuaranteesAbove you can see if all hmm profiles from Pfam works. Test are running every day.Test flow:Download all hmm profiles from Pfam.Load profiles sequentially.Write model to file.Load saved model from file.Check if both loaded profiles are equals.For this test the latest version ofhmm_profilefrom pypi is used.Full DB test also runs before each release, but badge above shows only periodic tests results.PerformanceWhole package is written in pure Python, without C extensions.You can treat full DB test as benchmark.Benchmark should be depended mainly on single core of CPU and secondarily on storage and eventually on RAM.
Storage is used only for read from then files will be saved to "in-memory file" (StringIO).Remember: Results may vary when CPU is under load.
Also, hmm profiles in db can be modified in future or some profiles may be added/removed from DB.ProcessorStorageTime [s]ProfilesDateVersionPythonIntel Core i7-4702MQCrucial MX500 500 GB342179282020.02.220.0.93.7Intel Core i7-4702MQCrucial MX500 500 GB322179282020.02.220.0.93.6Intel Core i7-4702MQGoodRAM Iridium Pro240 GBTBATBATBATBA3.6To run benchmark:pipinstall.exportHMM_PROFILE_RUN_INTEGRITY_TESTS=TRUE
pythonsetpu.pytest--addopts-sRun test at least 3 times if you want to share results (last line) and close as much process as possible.Important:do not run tests inside so-called terminal in IDE -
it will do much more job with output and benchmark result will be affected.As you can see python 3.6 is a little faster,
probably due to different implementation of backported dataclasses, but I'm not sure.DevelopmentReleaseChange version in setup.py tox.y.z.dev0(or leave if minor version bump) and ensure changelog is up to date.
(Nothing changed yet.is not ok, CI will fail)Tag head of master branch withx.y.zwithout.dev0Important: release ALWAYS is from master branch! So keep master untouched when you want to release.