Giter Club home page Giter Club logo

bgzip-rs's People

Contributors

ebedthan avatar informationsea avatar shahamran avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bgzip-rs's Issues

'Prepare' println appears in production

Really nice crate!! I was playing around with some bgzip implementations and ran into your crate. It's really nice. I was getting some random 'Prepare' in my output stream, and I think (?) this is from an uncommented println making it into the crate. I see it's commented out in the source here. Thanks again!

How to read a header from a bgzip file

Hello!
Interesting looking library.
I'm trying to read a header from a bgzip file. Also new to rust. Any help would be appreciated.

fn load_header(infile: PathBuf) -> Result<(), bgzip::BGZFError> {
    use bgzip::header;
    let f = fs::File::open(&infile)?;
    let mut reader = io::BufReader::new(f)
    let header = header::BGZFHeader::from_reader(&mut reader)?;
    // ...
}

cargo build/rustc alerts me that the from_reader function is private, but its declared with pub(crate).

I understand this makes the function accessible from within the crate. But I'd like to read a header on my own!

Is there another way to do this with the BGZFReader?

Panic when doing read_line often enough - failure to cross block boundaries?

I'm getting panics such as these, both for versions 0.1.0 and 0.2.0:

thread 'main' panicked at 'internal error: entered unreachable code', /home/oliverr/.cargo/registry/src/github.com-1ecc6299db9ec823/bgzip-0.2.0/src/read.rs:130:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/88f19c6dab716c6281af7602e30f413e809c5974/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/88f19c6dab716c6281af7602e30f413e809c5974/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/88f19c6dab716c6281af7602e30f413e809c5974/library/core/src/panicking.rs:50:5
   3: <bgzip::read::BGZFReader<R> as std::io::BufRead>::fill_buf
             at /home/oliverr/.cargo/registry/src/github.com-1ecc6299db9ec823/bgzip-0.2.0/src/read.rs:130:9
   4: std::io::read_until
             at /rustc/88f19c6dab716c6281af7602e30f413e809c5974/library/std/src/io/mod.rs:1766:35
   5: std::io::BufRead::read_line::{{closure}}
             at /rustc/88f19c6dab716c6281af7602e30f413e809c5974/library/std/src/io/mod.rs:2025:35
   6: std::io::append_to_string
             at /rustc/88f19c6dab716c6281af7602e30f413e809c5974/library/std/src/io/mod.rs:333:19
   7: std::io::BufRead::read_line
             at /rustc/88f19c6dab716c6281af7602e30f413e809c5974/library/std/src/io/mod.rs:2025:9
   8: selene::join::join_input_with_data
             at ./src/join.rs:93:52
   9: selene::run
             at ./src/lib.rs:41:5
  10: selene::main
             at ./src/main.rs:2:11
  11: core::ops::function::FnOnce::call_once
             at /rustc/88f19c6dab716c6281af7602e30f413e809c5974/library/core/src/ops/function.rs:227:5

Just checking: this is supposed to be able to read across block boundaries, right? Thanks!

Panic when reaching end of file.

I think this is the same problem as #3, and that it's unrelated to reading across blocks.
The following test fails when added to lib.rs :

#[test]
fn test_read_all() -> Result<(), BGZFError> {
    let reader =
        BGZFReader::new(fs::File::open("testfiles/common_all_20180418_half.vcf.gz")?);
    for _line in reader.lines() {}
    Ok(())
}

with the following backtrace:

thread 'test::test_read_all' panicked at 'internal error: entered unreachable code', src/read.rs:130:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/core/src/panicking.rs:50:5
   3: <bgzip::read::BGZFReader<R> as std::io::BufRead>::fill_buf
             at ./src/read.rs:130:9
   4: std::io::read_until
             at /homes/ransh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/io/mod.rs:1766:35
   5: std::io::BufRead::read_line::{{closure}}
             at /homes/ransh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/io/mod.rs:2025:35
   6: std::io::append_to_string
             at /homes/ransh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/io/mod.rs:333:19
   7: std::io::BufRead::read_line
             at /homes/ransh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/io/mod.rs:2025:9
   8: <std::io::Lines<B> as core::iter::traits::iterator::Iterator>::next
             at /homes/ransh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/io/mod.rs:2562:15
   9: bgzip::test::test_read_all
             at ./src/lib.rs:127:22
  10: bgzip::test::test_read_all::{{closure}}
             at ./src/lib.rs:124:5
  11: core::ops::function::FnOnce::call_once
             at /homes/ransh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
  12: core::ops::function::FnOnce::call_once
             at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/core/src/ops/function.rs:227:5

As a more minimal test, generating a really small bgzip file, like:

$ printf "hello\nworld\n" | bgzip > test.gz

and using reader.read_line() on it more than twice panics.

Release with AdaptiveReader?

I like this crate, and could use it, as it seems relatively light on dependencies and builds for me on multiple systems I use. But I need the functionality you have in AdaptiveReader, which as far as I can tell is not in a tagged release. I think means I can't get it directly from cargo. Please correct me on this if I'm wrong on this. I'd rather not reimplement that functionality (or copy your code into my app) if you will soon be releasing a new version.

Do you have plans to update the crate with this functionality in the near future?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.