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

Issue with "wrong reads being mapped to genome as MAD == 0." #11

Open
joelwwh opened this issue Jul 20, 2023 · 4 comments
Open

Issue with "wrong reads being mapped to genome as MAD == 0." #11

joelwwh opened this issue Jul 20, 2023 · 4 comments

Comments

@joelwwh
Copy link

joelwwh commented Jul 20, 2023

Hi again. While trying to map reads from an un-induced sample, in some cases I get and error resulting in the useful Z-score png file not being generated. Is there a way to force it to still generate the .png file so I can at least visualize the reads? This is the error:

              ################ Getting Z-scores ################
              hafeZ: error: Likely wrong reads being mapped to genome as MAD == 0.
              Please check you are using correct reads.
              If error persists please create an issue on github (https://github.com/Chrisjrt/hafeZ)

I dont have this issue when trying to map the MMC-induced reads back. Even if no prophage are found by the software, looking at the .png read file at least gives me a sense of whether the assignment is accurate.

@Chrisjrt
Copy link
Owner

Hey Joel,

So this scenario normally occurs when there are basically no reads mapping to the genome.

I imagine this is DNase-treated filtered supernatants? If so, we've come across this before for some samples. Normally in this scenario it means your prep is really clean, so minimap could only map minimal amounts of DNA to the bacterial chromosome resulting in that zero MAD value.

Currently outputting a plot in this scenario is not possible in hafeZ. This is because its not really possible to calculate the modified Z-score if MAD == 0 then the formula would be dividing by zero.

However, I can write up and add a feature that would allow a .png to be output of just the actual mapping coverage values over the chromosome in these scenarios instead.

Leave it with me.

@joelwwh
Copy link
Author

joelwwh commented Jul 21, 2023

Thank you, Chris!

Because I wanted to get some levels of detectable DNA in my sequencing (from spotaneous induction / lysis), the samples were not DNAse treated, hence I was expecting some level of mapping, albeit low.

Like you mentioned that could still be a useful feature to output alongside the Z-score based plot!

@Chrisjrt
Copy link
Owner

Hmmm.... thats interesting, I would have expected there to have at least some bacterial DNA floating around in your supernatant then 🤔.

I've written the function for you to plot the raw coverage from the mappings. Hopefully this helps you get to the bottom of what's going on! To use it just run your same commands but add the new -e/--expect_mad_zero flag.

-e, --expect_mad_zero
                        allow MAD == 0 to exit without non-zero exit code. Will also cause coverage plots for each contig to be output to help with debugging. Useful for uninduced lysates. 

You'll need to clone the github repo to use it though for now as I haven't updated the bioconda version yet.

@joelwwh
Copy link
Author

joelwwh commented Jul 31, 2023

Just tried this and can confirm it plots the coverage depth successfully! I'm not sure if this is helpful to know: Previously, the same data ran on version 1.0.3 could not generate a Z-score graph. However, after your modification with the -e flag, it now can generate this coverage depth graph. It looks to me like that was decent mapping back (also looked at the raw sorted bam file on IGV), so I'm not quite sure why there was that initial issue of not being able to map reads to genome.

Shown is the uninduced sample, now with the coverage plot:
MAD_ERROR_coverage_plot_for_Ecoli_BW_lambda_contig_1

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

No branches or pull requests

2 participants