Closed sdhutchins closed 5 years ago
@sdhutchins Can you show me what your script looks like?
Taking a look at the ProjectManagement
class:
https://github.com/datasnakes/OrthoEvolution/blob/c62bfe213f09b1a4f12b37ab530232bc2b3e6630/OrthoEvol/Manager/management.py#L249-L326
If the logic failed to pass here: https://github.com/datasnakes/OrthoEvolution/blob/c62bfe213f09b1a4f12b37ab530232bc2b3e6630/OrthoEvol/Manager/management.py#L277
Then you wouldn't have a self.project_index
, and you would end up getting an AtrributeError
Yes, the class itself is working with similar parameters.
There's no script. This code (attribute_config) has existed in the BlastN class for some time, and I'm guessing I'd never tested it with ProjectManagement because I was trying to circumvent that.
It seems not to be setting the attributes from the ProjectManagement
class. I tried a bit of debugging and inspecting the class, methods, and the attribute_config function but I wasn't able to figure out a way to solve the issue.
The other option is to inherit from the ProjectManagement
class which wouldn't be very difficult imo. I was just curious if you had an idea about fixing this. Didn't want to just throw away that function entirely for this class.
There's no script.
Then how are you getting the error you're reporting? 😉 What I mean is "Can you give me a reproducible example?".
Show me the code you used to get this error.
I've tried a number of different ways to get this to work properly, but I continue to have issues with it unless I set proj_mana to None.
If you are using BlastN
without ProjectManagement
, then this is currently the only way to get things working.
The other option is to inherit from the ProjectManagement class which wouldn't be very difficult imo. I was just curious if you had an idea about fixing this
The goal was to remove any explicit inheritance of the management stuff from the class so that you could set it up however you wanted. It still forces you to use specific directories, but you can supply the root path (e.g. project_path
). This could be expanded upon so that you could give it a bunch of custom locations instead of forcing this directory structure:
Didn't want to just throw away that function entirely for this class.
The attribute_config
function is literally used in all of the Orthologs modules. So don't throw it away! It may just need to be expanded upon based on your needs.
That being said...
I'm guessing I'd never tested it with ProjectManagement because I was trying to circumvent that.
In the past I've only used BlastN
with ProjectManagement
, and it's worked fine. So I'm not sure what's going on. Maybe I can speak more to it tomorrow after I've done some testing myself.
_See db_mana_test.py for an example on how I've gotten PM to work with other modules. (it uses initialize_new.yml_ to set up kwargs for PM.
Not sure if this will help or not, but that's all I can go off of without testing it myself or seeing what you're running.
And I see now this was for your tests...
haha yes, I'm running this test...not sure how I missed mentioning that....Feel free to check out that branch and run it.
And yes, the ability of those classes to be used with ProjectManagement is important - as well as for it to not be used there so I definitely understand keeping that function - hence the issue after I spent the past 2 days breaking allllllllllll my code down and then reverting it all to see if it was just something I did. Could be the python version (I would guess not but who knows?). Then, I thought it may be my ide - but I tried this on 3 different ide's...and the OS...and...wellllllllp lol
Of course, just change the proj_mana or comment out that line....
"""This is the test suite for Orthologs."""
import unittest
from shutil import rmtree
from OrthoEvol.Orthologs.Blast import BaseBlastN
class TestOrthologs(unittest.TestCase):
"""Test the Orthologs module."""
def setUp(self, project="gpcr", project_path="projects"):
self.project = project
self.project_path = project_path
def delete_project(self, project_path):
rmtree(project_path)
def test_baseblastn(self):
"""Test the BaseBlastN class."""
# The with statement is for travisci where a BLASTDB variable
# is not set.
# TIP: Remove the with statement if testing locally.
with self.assertRaises(EnvironmentError):
gpcr_blastn = BaseBlastN(project=self.project, method=3,
save_data=True, acc_file="gpcr.csv",
proj_mana=None,
project_path=self.project_path,
copy_from_package=True)
self.assertEqual(gpcr_blastn.proj_mana, None)
self.assertEqual(gpcr_blastn.acc_file, "gpcr.csv")
self.assertTrue(gpcr_blastn.copy_from_package)
self.delete_project(project_path=self.project_path)
if __name__ == '__main__':
unittest.main()
Resolved per our discussion...
In summary, proj_mana
should be None
or input an instance of the ProjectManagement
class.
What is the error or issue?
Can you reproduce the behavior/error (place code below)?
The error is stemming from
OrthoEvol/utilities.py
in the attribute_config function.In comparative_genetics.py, the function is called as seen below...
I've tried a number of different ways to get this to work properly, but I continue to have issues with it unless I set
proj_mana
toNone
.Also, I'm currently using Python version
3.6.7
onlinux
.@grabear Any thoughts on a fix?