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: Invalid wig ID on line 1 #239

Closed
ghost opened this issue Jun 15, 2020 · 10 comments
Closed

Error: Invalid wig ID on line 1 #239

ghost opened this issue Jun 15, 2020 · 10 comments

Comments

@ghost
Copy link

ghost commented Jun 15, 2020

Hello, trying

wig2bed < asm.dist_5_kad.wig
Error: Invalid wig ID on line 1

here is the beginning of my wig file

variableStep  chrom=Chrom_1
1	1.661
2	1.649
3	1.645
4	1.644
5	1.6434
6	1.64233333333333
7	1.64128571428571
8	1.6405
9	1.63988888888889

it seems all right to me.
Thanks

@ghost
Copy link
Author

ghost commented Jun 15, 2020

Got it, it needs the multisplit tag
The error message is a bit misleading though.

@alexpreynolds
Copy link
Collaborator

Thanks for the report.

Because this input is a file stream, and not a regular file, there would be no way for wig2bed (convert2bed) to read ahead and know that the input contains multiple sections, without reading through the entire file.

But I'll look at modifying the error message to suggest to the user to investigate if the wig file contains multiple sections, in the case this error is thrown.

@ghost
Copy link
Author

ghost commented Jun 15, 2020

Ah ok I understand. But yes if it threw a line saying "maybe there are multiple sections" that would be handy.

thank you for bedops

@alexpreynolds
Copy link
Collaborator

Yep, that's probably what I'll do. I'll leave this ticket open to add a commit.

@alexpreynolds
Copy link
Collaborator

Fixed in d9776fd

@rsharris
Copy link

rsharris commented Apr 1, 2022

I ran into this problem today, same error, apparently the same cause, running version 2.4.39 (installed via conda). I also tried to test by building an executable from the repo, but wasn't able to successfully run convert2bed-typical --input=wig (because the "sort-bed binary" apparently isn't installed on this machine).

I was following the instructions from a tool/pipeline from someone's ≈4 year old paper. So either this behavior didn't exist then, or that author didn't accurately relate the commands in his pipeline.

Indeed, adding the command-line option --multisplit=something fixes the problem (or, I should say, the problem doesn't occur on line 1). But I'm at a loss as to how I (or any other user) could be expected to discover this. The error message makes you think the input wig file is non-compliant. So I kept looking at the UCSC wiggle format spec and at my file and damned if it didn't look fine.

And I pored through the options to see if there was something I was missing. And now even that I know --multisplit is the answer, and reading the description of that option, I would never have realized that is the magic incantation needed to solve my problem.

As best I can tell, this error comes from line ≈6110 in convert2bed.c. And it doesn't look to me like it is checking the validity of a wig ID. It's just checking whether the internal wig->id string is empty. And that string is empty because wig->start_write is initialized as false and never gets set to true.

A more useful error mesage would include the suggestion that user try "--multisplit".

@alexpreynolds
Copy link
Collaborator

@rsharris Thanks for the report. Streaming input is great because it is fast. It can be problematic, however, as there is no way to check if the input is valid, or that certain options are required, until after chunks of data come in. If you can provide a link to the input or paper, I can investigate that file and see if a patch makes sense. Let me know if I can help further.

@rsharris
Copy link

You should be able to access the wig file via this link:
https://pennstateoffice365-my.sharepoint.com/:u:/g/personal/rsh915_psu_edu/EVHAwrB3T-9JsyGIftZynbwBs2imSOIYusBtJNpV7CVmlQ?e=tCk9g9
File size is 5,654,710,690 bytes. sha256 should be 98abc2a714c6a9f1e900c8e909d489885c92d8f02c7e1c0769396a429ec63507 .

(I've posted the same file in issue 255)

The command that failed was time wig2bed < example.wig > example.bed. It finishes immediately, reporting 'Invalid wig ID on line 1".

alexpreynolds added a commit that referenced this issue Apr 18, 2022
@alexpreynolds
Copy link
Collaborator

Added warning message in commit d932dc1

@rsharris
Copy link

Cool. I'm a big proponent of trying to make the program tell the user what might solve the problem. If for no other reason than that it might cut down on users having to resort to contacting me.

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

No branches or pull requests

2 participants