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

How should bcf::Record::push_info_float work? #342

Open
xosxos opened this issue Nov 23, 2021 · 1 comment
Open

How should bcf::Record::push_info_float work? #342

xosxos opened this issue Nov 23, 2021 · 1 comment

Comments

@xosxos
Copy link

xosxos commented Nov 23, 2021

In the documentation it says under bcf::record::Record::push_info_float

Add/replace a float-typed INFO entry.

However when trying to add an INFO field from another VCF file I get the following error:

 let af = record_1.info(b"my_tag")).float().unwrap().unwrap();
 let af: Vec<f32> = info.iter().copied().collect();            
 record_2.push_info_float(b"my_tag"), &af).unwrap();

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: BcfSetTag { tag: "my_tag" }'

I haven't followed the source code beyond the hts_sys bindings to C, however I was hoping there is some simple explanation to this specific error. Should the tag be defined in the Record header before trying to push? The same error applies to all push_info functions when adding fields. Replacing seems to work fine.

@ebioman
Copy link

ebioman commented Nov 29, 2021

Hi, any record you push has first to be defined in the header

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