Skip to content

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

@KSabatova

Description

@KSabatova

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions