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

cleanup: resolve pylint warnings #149

Merged
merged 13 commits into from
Mar 8, 2023
Merged

cleanup: resolve pylint warnings #149

merged 13 commits into from
Mar 8, 2023

Conversation

korikuzma
Copy link
Contributor

@korikuzma korikuzma commented Jan 16, 2023

Close #97

Notes:

  • Resolved easy pylint warnings. Can see the warnings in this action, under Pylint static analysis
  • For those that had too-many warnings, I just disabled. We can fix this in a later issue if we want to do more code clean up.
  • disable=unused-argument in translate_from methods will be fixed in Update translate_from signature + handling different from_translators  #150
  • Disable fixme for pylint. It seemed silly to comment it out with a disable
  • Renamed normalize to do_normalize in Translator due to Redefining name 'normalize' from outer scope (line 21) (redefined-outer-name). We can rename to something else if we don't like do_normalize. I am bad at naming.
  • localize_allele was calling a method that did not exist (localize), so used localize_named_feature which seemed like what it should be calling.
  • _get_coords used chr_cb_map but the docs said "return (start,end) of band cb in map m", so switched to using m.
  • Renamed some variables due to redefined-outer-name. Open to better var names. (naming is hard x2)

- Update regex for input str
- Validate that expected reference sequence matches actual reference
  sequence
@korikuzma korikuzma self-assigned this Jan 16, 2023
@korikuzma korikuzma requested review from a team as code owners January 16, 2023 14:46
@korikuzma korikuzma marked this pull request as draft January 16, 2023 14:50
Base automatically changed from issue-147 to main January 17, 2023 22:10
@korikuzma korikuzma marked this pull request as ready for review January 17, 2023 22:38
@korikuzma
Copy link
Contributor Author

@ahwagner I think it'd be good to get your review on this

Copy link
Contributor

@jsstevenson jsstevenson left a comment

Choose a reason for hiding this comment

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

looks good to me. I made a few notes of possible changes but nothing important. Some of these ignore statements are probably fine to make QC pass but are things that would be good to refactor later (eg functions that are too long or have too many arguments).

I will also say that the amount of times we have to ignore the protected-access warning suggests that maybe we should just disable it project-wide.

src/ga4gh/vrs/extras/localizer.py Outdated Show resolved Hide resolved
src/ga4gh/vrs/extras/translator.py Outdated Show resolved Hide resolved
src/ga4gh/vrs/extras/vcf_annotation.py Outdated Show resolved Hide resolved
@korikuzma
Copy link
Contributor Author

looks good to me. I made a few notes of possible changes but nothing important. Some of these warnings are probably fine to make QC pass but are things that would be good to refactor later (eg functions that are too long or have too many arguments).

I will also say that the amount of times we have to ignore the protected-access warning suggests that maybe we should just disable it project-wide.

In my original comment for the PR, I made a note about resolving the too-many warnings if we wanted to. Just didn't want to do a major code change in this PR.

Sure, I'll go ahead and add protected-access to the .plyintrc.

@korikuzma
Copy link
Contributor Author

per @ahwagner :
Change
from ga4gh.vrs import models, normalize
to
from ga4gh.vrs import models, normalize as do_normalize

@korikuzma
Copy link
Contributor Author

@ahwagner made your suggested change of renaming the import name. Let me know if there's anything else that needs to be changed

Copy link
Member

@ahwagner ahwagner left a comment

Choose a reason for hiding this comment

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

This looks technically sound to me. I am less certain if these changes are procedurally correct. Specifically, see my comments about the localize mapping to localize_named_feature.

If you are convinced this mapping is correct, then please let @reece and me know so we can do a deeper code review.

src/ga4gh/vrs/extras/localizer.py Outdated Show resolved Hide resolved
allele_sl = ga4gh.vrs.models.Variation(**allele.as_dict())
del allele_sl._id
allele_sl.location = self.localize(allele.location)
allele_sl.location = self.localize_named_feature(allele.location, assembly_name)
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't seem right to me by the names and descriptions of these methods. Why would updating a sequence location (parent method) have anything to do with a named feature (child method)? My understanding of named features are annotated regions on a sequence, e.g. gene symbols, protein domains, named exons.

I would need to dig deeper into the code to understand if this is actually correct; and if so we need to reconsider the names and descriptions of these functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From my understanding of this and the notebook, these methods converts a Chromsome Location or Gene Location to a Sequence Location

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@reece and @ahwagner can you review the changes to the localizer module?

Copy link
Member

Choose a reason for hiding this comment

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

@korikuzma is correct: the "localization" process is intended to convert a named feature to coordinates. I proposed (and I thought that you and Larry agreed) that we needed to be able to project all features onto a common coordinate system. This operation is necessary in order to identify overlapping features, for example.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I think I misunderstood; I thought we were "localizing" a sequence location here, but understand now the idea is to localize a feature or chromosome location. That seems appropriately named to me. Thanks @korikuzma and @reece.

Copy link
Member

@reece reece left a comment

Choose a reason for hiding this comment

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

Looks good to me. I didn't actually run it. Please see comments inline.

src/ga4gh/vrs/__init__.py Show resolved Hide resolved
src/ga4gh/vrs/extras/localizer.py Outdated Show resolved Hide resolved
allele_sl = ga4gh.vrs.models.Variation(**allele.as_dict())
del allele_sl._id
allele_sl.location = self.localize(allele.location)
allele_sl.location = self.localize_named_feature(allele.location, assembly_name)
Copy link
Member

Choose a reason for hiding this comment

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

@korikuzma is correct: the "localization" process is intended to convert a named feature to coordinates. I proposed (and I thought that you and Larry agreed) that we needed to be able to project all features onto a common coordinate system. This operation is necessary in order to identify overlapping features, for example.

src/ga4gh/vrs/extras/localizer.py Show resolved Hide resolved
@korikuzma korikuzma mentioned this pull request Feb 20, 2023
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.

Resolve pylint errors
5 participants