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

Mean coverage and coverage variance #8

Open
fitbio opened this issue Jun 21, 2018 · 1 comment
Open

Mean coverage and coverage variance #8

fitbio opened this issue Jun 21, 2018 · 1 comment

Comments

@fitbio
Copy link

fitbio commented Jun 21, 2018

Hi,
I used gridss to find breakpoints. My question is which tool shall i use to calculate the mean coverage and coverage variance values from my bam file to use clove. It would be really helpful.

@lmfaber
Copy link

lmfaber commented Feb 7, 2022

I don't think this is still relevant to you, but maybe this answer helps people in the future. I think you can use either of those options:

  • Use samtools coverage and calculate the values from the output.
    samtools coverage input.bam > coverage.txt
    mean_coverage=$(grep -v '^#' coverage.txt | awk 'BEGIN{OFS="\t"}{x+=$6}END{print x/NR}')
    sd_coverage=$(grep -v '^#' coverage.txt | awk 'BEGIN{OFS="\t"}{x+=6; y+=$6^2}END{print sqrt(y/NR-(x/NR)^2)}')
    
  • I think you can also use CollectWgsMetrics from gatk/picard.
    Explanation of the output: see here.
    The metrics are called MEAN_COVERAGE and SD_COVERAGE

It would be nice if clove could detect these options itself, because one is already providing the bam file from which the information could be calculated. Looking at the activity of this repo, I think it's unlikely to happen, so stick to the above-mentioned options.

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