Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

CNV consensus (4 of 6): Restructure column #349

Merged
merged 11 commits into from
Dec 18, 2019

Conversation

fingerfen
Copy link
Contributor

Purpose/implementation Section

Implement next step of copy number consensus call. This section reformats the start_pos, end_pos, and copy numbers of the individual CNVs so that these "raw" info can be retained even after multiple CNVs are merged together.

What GitHub issue does your pull request address?

issue #128

Is there anything that you want to discuss further?

Nope, this is a simple PR, it should be pretty quick to go through

Reproducibility Checklist

  • The dependencies required to run the code in this pull request have been added to the project Dockerfile.
  • This analysis has been added to continuous integration.

@fingerfen
Copy link
Contributor Author

Fixing this right now

Copy link
Member

@jashapiro jashapiro 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 good, assuming it passes CI this time.

I have a couple suggestions for simplifying, one in the snakefile and one in the script. The one in the script is more of a python tip than an important suggestion, so it is up to you if you want to do anything with it. I would probably make the Snakefile change though, as that substantially reduces redundancy.

analyses/copy_number_consensus_call/Snakefile Outdated Show resolved Hide resolved
Comment on lines 58 to 63
## Initialize a variable to store the new restructred information
growing_list = ''

## Rearange the split information into the new format
for j in range(0,len(list_start)):
growing_list += '{}:{}:{},'.format(list_start[j],list_end[j],list_cn[j])
Copy link
Member

@jashapiro jashapiro Dec 18, 2019

Choose a reason for hiding this comment

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

This is a great place for a python list comprehension, which is a bit faster (and more pythonic) than adding to a list bit by bit. It won't make much of a difference in this instance, but might be worth knowing about.

These lines could be replaced with:

cnv_list = ['{}:{}:{},'.format(*cnv) for cnv in zip(list_start, list_end, list_cn)]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jashapiro I see! Thank you for the suggestion. I never knew about the zip() function. It is helpful to know it exists! Thanks for that. I will add that in no problem!! Just a quick question, did you add an extra ] by accident at format(*cnv]) ?

Copy link
Member

Choose a reason for hiding this comment

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

yes, that is an accident!

Copy link
Member

Choose a reason for hiding this comment

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

The * is not though, as you need to unpack the tuple.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jashapiro Yep! I fixed it and since list comprehension output my info in a list, I added join() to combine all of my strings together. Please have a look.

@fingerfen fingerfen changed the title CNV consensus (4 of n): Restructure column CNV consensus (4 of 6): Restructure column Dec 18, 2019
Copy link
Member

@jashapiro jashapiro 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, on to step 5!

(once CI passes)

@jaclyn-taroni jaclyn-taroni merged commit 9f5fe65 into AlexsLemonade:master Dec 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants