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

Rename BRC seq_region names #292

Merged
merged 18 commits into from
Feb 19, 2024
Merged

Rename BRC seq_region names #292

merged 18 commits into from
Feb 19, 2024

Conversation

MatBarba
Copy link
Contributor

A script to automate the renaming of seq_region BRC4_seq_region_name attributes.

The script accepts a simple tab file with the current name and the new BRC name, and checks against the current database to see what it would do (not found, insert, update, or already exists). Then just add the usual --update argument to make the changes.

NB: the current name can be the seq_region name or a synonym.

Copy link
Contributor

@JAlvarezJarreta JAlvarezJarreta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite nice new features with the usage of Enum I didn't know about 🤓

src/python/ensembl/io/genomio/seq_region/rename.py Outdated Show resolved Hide resolved
src/python/ensembl/io/genomio/seq_region/rename.py Outdated Show resolved Hide resolved
src/python/ensembl/io/genomio/seq_region/rename.py Outdated Show resolved Hide resolved
src/python/ensembl/io/genomio/seq_region/rename.py Outdated Show resolved Hide resolved
src/python/ensembl/io/genomio/seq_region/rename.py Outdated Show resolved Hide resolved
Copy link
Contributor

@Dishalodha Dishalodha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested it, works well. Thank you !

)
seq_attrib = session.scalars(stmt).one()
seq_attrib.value = seq_region.brc_name
elif seq_region.operation == Operation.insert:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not able to replicate this case if i have such case as
if not db_brc_name: logging.info(f"Seq region {seqr.name} doesn't have a BRC name")
it gives the log message however seq_regions = [] so doesnt apply the insert operation for me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you get the message that says the insert operation is not supported (I have only implemented the update part)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value for return seq_regions in get_seq_regions_to_replace is an empty list for me, so I dont get any message

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok good spot, I've updated the logic

Copy link
Contributor

@JAlvarezJarreta JAlvarezJarreta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready to go 👍

src/python/ensembl/io/genomio/seq_region/rename.py Outdated Show resolved Hide resolved
Co-authored-by: J. Alvarez-Jarreta <jalvarez@ebi.ac.uk>
@MatBarba MatBarba merged commit b081f27 into main Feb 19, 2024
@MatBarba MatBarba deleted the mbarba/seqregion_rename branch February 19, 2024 17:02
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.

3 participants