-
Notifications
You must be signed in to change notification settings - Fork 1
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
Quantify strand exchange #124
Conversation
Good job on getting this started, @Bernadetadad. But a few things I noticed:
|
@jbloom I've updated this to call tag variants by melting and merging as per your suggestion.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Bernadetadad, looking good! Just a few minor requested changes:
-
First, you should keep the output and input CSVs separate as you have now, even if that means some files are duplicated. This is much "safer". Having code that modifies files in place won't work with
Snakemake
and is dangerous in general, as for instance what happens if same rule is run twice (file gets additional columns). -
In
pacbio_analysis.smk
, although not essential forsnakemake
functioning, I think it makes it a lot easier if you use a consistent naming scheme for files. Right now the CSV file containing the mutations is calledmutation_df
(seems reasonable) in the output ofalign_pacbio
. But it is calledccs_alignments
in the input tostrand_exchange
(doesn't seem like a good name, as file isn't alignments, it's a CSV of mutations and other information parsed from alignments). Then the new veresion coming out ofstrand_exchange
has a totally new name oftag_identity_df
, where it seems like that isn't the main information in there, maybe more likemutations_with_tag_identity_df
. -
In
strand_exchange.py.ipynb
notebook Jupyter notebook, last cell, merging is dangerous if you don't check columns are preserved as merging by default is done "inner" so will drop missing queries. So I'd suggest adding something before the merge likeassert set(alignments['query_name']) == set(strand_exchange_df['query_name'])
. If that isn't true, then there are problems with the merge. Also, within the merge you can replaceleft_on=...
andright_on=...
with juston='query_name'
. You might also addvalidate='one_to_one'
as this is a good check like theassert
. -
I don't think it's necessary to hard-code the tags. The
viral_tags
list is already defined inSnakefile
, so that can just be passed to the notebook as a parameter. In fact, it already is, so I'm not sure why you havevalid_tags
defined in the sixth-to-last cell? Then you can just use this with something like the following inclassify_func
:
unique_tags = set(unique_tags)
for valid_tag in viral_tags:
if unique_tags = {valid_tag}:
return valid_tag
if 'unknown_tag' in unique_tags:
<the rest of the code there right now>
- One last thing, did you run the linting over this?
When list is valid_tags = ['syn', 'wt'] the error is |
@Bernadetadad, the problem is your indentation is wrong. It should look like below. The loop should just check the two known tags, and then if neither of those match (no
|
Sorry, this was very stupid of me. Now all should run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. I didn't check that it actually runs, but approving and assuming it runs OK for you then I'd say go ahead and merge it!
this pull requests uses
strand_exchange
rule to look at strand exchange using viral tags found in CCS. The rule outputs{expt}_plot_strand_exchange.svg
plot showing how many mixed tags are found among CCSs.There's no accuracy metric currently being outputted with the tag identities, I don't know if maybe I should also ask
alignparse
to output tag accuracy and filter on tags with >0.999 accuracy?