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

Error whilst querying BigWig file: "got an error in bwStatsFromZoom" #20

Closed
andrewyatz opened this issue Mar 15, 2017 · 10 comments
Closed
Assignees
Labels

Comments

@andrewyatz
Copy link

Whilst querying for stats from a BigWig file from the Ensembl FTP site I got an error from libBigWig. I found it first in my Perl bindings but I've been able to replicate this in C below:

#include "bigWig.h"
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
    bigWigFile_t *fp = NULL;
    double *stats = NULL;
    
    char file[] = "http://ftp.ensembl.org/pub/data_files/homo_sapiens/GRCh38/rnaseq/GRCh38.illumina.sk_muscle.1.bam.bw";
    char chrom[] = "21";
    int start = 33031597;
    int end = 34041570;
    int full = 0;
    int bins = 100;
    
    if(bwInit(1<<17) != 0) {
        fprintf(stderr, "Received an error in bwInit\n");
        return 1;
    }
    
    fp = bwOpen(file, NULL, "r");
    if(!fp) {
        fprintf(stderr, "An error occured while opening %s\n", file);
        return 1;
    }
    if(full) 
      stats = bwStatsFromFull(fp, chrom, 33031597, 34041570, bins, mean);
    else 
      stats = bwStats(fp, chrom, 33031597, 34041570, bins, mean);

    if(stats)
      free(stats);

    bwClose(fp);
    bwCleanup();
    return 0;
}

This was compiled using cc -g -Wall -O3 -Wsign-compare -o query query.c libBigWig.a -lcurl -lm -lz. When run the error I currently get back is

got an error in bwStatsFromZoom in the range 33031597-33041696: Operation now in progress

When I switch to requesting full stats the message goes away. The BigWig file in question is a coverage plot from a BAM file and was created using the kent utils. I've also checked with the kent binaries and it's able to report statistics for the requested region.

Any help is appreciated.

@dpryan79
Copy link
Owner

Weird, I'll have too have a look at this. Note that it might take me a bit of time as I'm off for vacation tomorrow.

@dpryan79 dpryan79 self-assigned this Mar 15, 2017
@dpryan79 dpryan79 added the bug label Mar 15, 2017
@andrewyatz
Copy link
Author

Thanks for looking into it. Don't worry about speed of response. Have a nice vacation!

dpryan79 added a commit that referenced this issue Mar 15, 2017
@dpryan79
Copy link
Owner

Please check the fix20 branch, which at least fixes this exact example.

@andrewyatz
Copy link
Author

andrewyatz commented Mar 16, 2017 via email

@dpryan79
Copy link
Owner

Cool, when I have time I'll try to figure out what the heck is up with the other issue you reported (for whatever reason, curl was only asking for 8 bytes at a time, which made everything take ages). Once those are both fixed I'll push out a new release.

@andrewyatz
Copy link
Author

andrewyatz commented Mar 16, 2017 via email

@andrewyatz
Copy link
Author

I'll close this down as well since 33d436b seems to fix everything

dpryan79 added a commit that referenced this issue Mar 17, 2017
@lidaof
Copy link

lidaof commented Mar 17, 2017

I also have similar issue while trying to view a large region, but not small region...but sometimes I don't get this error. Is it possible to print out the fail reason? Thanks.

got an error in bwStatsFromZoom in the range 27053199-27069217: Operation now in progress

@dpryan79
Copy link
Owner

"Operation now in progress" is the full error message and corresponds to libcurl setting errno to EINPROGRESS. In the python wrapper for this, I tended to see this most often when using multithreading where each thread was querying the remote server (you have to limit your thread numbers when doing that).

@lidaof
Copy link

lidaof commented Mar 17, 2017

Thank you. I am not using the python wrapper. Just single C binary file, but it didn't happen every time. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants