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

Bug in selection of a pattern to search for location of CDS #2

Open
KJureckova opened this issue Jul 13, 2023 · 0 comments
Open

Bug in selection of a pattern to search for location of CDS #2

KJureckova opened this issue Jul 13, 2023 · 0 comments

Comments

@KJureckova
Copy link

I run the tool and got an error message:

'NoneType' object has no attribute 'group'

Altough, this error message was not really specific, it looked like there was a problem with some regex pattern search. After some debugging I found out that em_processor() and also batch_processor() functions contain a command to create a dictionary to store a pattern to locate start and end of CDS and to store a strand direction (lines 34-35 in em_processor(), lines 261-262 in batch_processor()).

dic = {'pattern': "complement\((.*?)\)", 'strand': "-"} if "complement" in record else \
      {'pattern': "location=(.*?)]", 'strand': "+"}

Then on the next line indices of CDS are obtained by search() function and group() method, which raised this exception.

location = search(dic['pattern'], record).group(1)

This exception was raised because the search() function didn't find any match of the pattern in the string.

In my case record variable contained string 'lcl|CP086135.1_prot_UEG76830.1_88 [locus_tag=LKW31_22130] [protein=complement resistance protein TraT] [protein_id=UEG76830.1] [location=108904..109221] [gbkey=CDS]' and the dic variable contained dictionary {'pattern': 'complement\\((.*?)\\)', 'strand': '-'}.

So the pattern in dic was wrongly chosen, because the string in record variable contained word 'complement' in protein description not in location description. Therefore, during the creation of dic variable wrong pattern was chosen.

For now I was able to fix the problem by changing the command for assignment to dic variable.

dic = {'pattern': "complement\((.*?)\)", 'strand': "-"} if "location=complement" in record else \
      {'pattern': "location=(.*?)]", 'strand': "+"}

If necessary, I can provide the files to recreate this bug.

Thank you for a very nice and helpful tool.

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