This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Quick method for calculating mean and standard deviation of read coverage of a chromosome.

Hello,

I am in search for a program that can calculate the mean and standard deviation of coverage of a chromosome. Ideally, the program will use BAM files and be implemented in a pipeline.

The pipeline would require to use the mean and standard deviation of the coverage to scale the read depth of a user defined reason. I'm thinking to run a perl script of this sort.


    system("quick_coverage_prog chr1.bam >coverage_stats.txt");
    open IN, "~/coverage_stats.txt" or die "cannot open file\n";

    my $mean;
    my $sd;

    my $stats = <IN>;
    my @stats = split /\t/, $stats;

    $mean = $stats[0];
    $sd = $stats[1];

    close(IN);
    open IN, "~/ch1_.bam" or die "cannot open bam\n";

    while(<IN>){

             #parse data using $mean and $sd here
    }

   #close IN, print parsed data to output file

I would like this script to be fast, I have 1000s of files to analyze. Any advice is greatly appreciated.

read-depth coverage

1 answer

Have a look at Picard, especial the output MEAN_COVERAGE and SD_COVERAGE.

Log in to answer this question.