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

Databases parser for ENSEMBL and UNIPROT #2

Merged
merged 3 commits into from
Apr 24, 2024
Merged

Databases parser for ENSEMBL and UNIPROT #2

merged 3 commits into from
Apr 24, 2024

Conversation

dsmutin
Copy link
Owner

@dsmutin dsmutin commented Mar 24, 2024

Done homework for API request parsing

File with all functions from HW2
@dsmutin dsmutin requested a review from rinnifox March 24, 2024 21:00
@rinnifox
Copy link
Contributor

Hi Daniil!

Comments regarding your homework:

  1. ENSEMBL. Your expression ENS.*{11} is incorrect in terms of syntax. It is impossible to use {11} after *, this item is not quantifiable. Also, I recommend you checking this page to get the idea of how ENSEMBL IDs should be constructed, which characters and how many should be there.
  2. Uniprot. In yor expression r'\w{6} you denote any 6 non-word symbols. It does not match any of symbols in Uniprot example IDs. Moreover, in the lecture materials I provided a link for Uniprot accession ID construction rules as the actual expression for this database is rather complex, and it is explicitly indicated in the home task file that you should use this materials to complete a correct expression for Uniprot.
  3. Your code is running with errors. In re.search you provide a pattern in figure brackets, which leads to an error. Have you tried running the code yourself?

Fix this please before the next lecture, ok?

@dsmutin
Copy link
Owner Author

dsmutin commented Mar 27, 2024

Thank you for comments, fixed

@rinnifox
Copy link
Contributor

Currently, your expression for Uniprot [A-Z]\w{5}|\w{7}|\w{9} allows three options:

  1. One [A-Z] symbol then 5 other word characters ([a-zA-Z0-9_]);
  2. 7 word characters ([a-zA-Z0-9_]) - please note that here you don't have the first [A-Z] symbol (it is not included in your alternative expressions);
  3. 9 word characters ([a-zA-Z0-9_]) - here you don't have first [A-Z] symbol as well.

Since you do not have a linkage to the end of the sequence, almost any string will match in case it has first 6, 7 or 9 symbols matching the indicated patterns.
So you have to link the pattern to the beginning and end of the string, and I also recommend setting it up more precisely accounting for different options in the beginning ([OPQ] or [A-N,R-Z]).

For ENSEMBL, ENS[A-Z]{0,3}|MGP_[a-zA-Z]*_)\w\w?\d{11} seems to be almost correct but note please that currently you have [A-Z]{0,3} for species but you are not accounting for feature prefixes, check this also please.

@dsmutin
Copy link
Owner Author

dsmutin commented Apr 12, 2024

I believe that it finally works, thank you for all responses!
All fixed

@rinnifox
Copy link
Contributor

Seems to be correct now! You can merge it to main.

@dsmutin dsmutin merged commit ff895cd into main Apr 24, 2024
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

Successfully merging this pull request may close these issues.

2 participants