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

Sourcery refactored master branch #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Sep 3, 2021

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from burkesquires September 3, 2021 13:37
@sourcery-ai sourcery-ai bot force-pushed the sourcery/master branch 2 times, most recently from 1293610 to 9a493fe Compare September 3, 2021 13:38
Copy link
Owner

@burkesquires burkesquires left a comment

Choose a reason for hiding this comment

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

Reviewing sourcery changes

@sourcery-ai sourcery-ai bot force-pushed the sourcery/master branch 2 times, most recently from 38da1bd to 12edaf8 Compare September 3, 2021 20:40
Comment on lines -215 to +219
test = True

raw_sequence = reference_sequence.replace("-", "")

length = len(raw_sequence)

for position in sequence_feature_positions:

if position > length:
test = False
test = all(position <= length for position in sequence_feature_positions)
Copy link
Author

Choose a reason for hiding this comment

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

Function confirm_seq_feature_in_ref refactored with the following changes:

Comment on lines -248 to +249
test = True

# check that all positions are in sequence

if all(i <= seq_length for i in positions):

for position in positions:

if reference_sequence[position - 1] == "-":
test = False

return test

else:
if any(i > seq_length for i in positions):

return False

return all(reference_sequence[position - 1] != "-" for position in positions)
Copy link
Author

Choose a reason for hiding this comment

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

Function check_reference_positions refactored with the following changes:

Comment on lines -286 to +272
vt_id = "VT-%03d" % (i,)

return vt_id
return "VT-%03d" % (i,)
Copy link
Author

Choose a reason for hiding this comment

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

Function vt_count refactored with the following changes:

Comment on lines -366 to +350
df_selected = df[df['VT'].isin(vts_to_select)]
return df_selected
return df[df['VT'].isin(vts_to_select)]
Copy link
Author

Choose a reason for hiding this comment

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

Function select_var_types_to_plot refactored with the following changes:

Comment on lines -450 to +433
sequence_feature_temp = ''.join([sequence[index] for index in vt_positions])
sequence_feature_temp = ''.join(sequence[index] for index in vt_positions)
Copy link
Author

Choose a reason for hiding this comment

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

Function compute_variant_types refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Sep 3, 2021

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.03%.

Quality metrics Before After Change
Complexity 3.78 ⭐ 3.53 ⭐ -0.25 👍
Method Length 71.05 🙂 70.40 🙂 -0.65 👍
Working memory 8.00 🙂 7.92 🙂 -0.08 👍
Quality 69.62% 🙂 69.65% 🙂 0.03% 👍
Other metrics Before After Change
Lines 604 587 -17
Changed files Quality Before Quality After Quality Change
FeaVar/FeaVar.py 69.62% 🙂 69.65% 🙂 0.03% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
FeaVar/FeaVar.py process_metadata 6 ⭐ 178 😞 11 😞 52.37% 🙂 Try splitting into smaller methods. Extract out complex expressions
FeaVar/FeaVar.py compute_variant_types 5 ⭐ 130 😞 8 🙂 64.47% 🙂 Try splitting into smaller methods

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

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.

1 participant