10XGenomics / bamtofastq

Convert 10x BAM files to the original FASTQs compatible with 10x pipelines
MIT License
59 stars 6 forks source link

bam.fetch error with expecting u64 but getting u32 #18

Closed biobenkj closed 4 years ago

biobenkj commented 4 years ago

Hello 10X team!

When compiling the latest version of bamtofastq, I get the following error:

error[E0308]: mismatched types
   --> src/main.rs:846:28
    |
846 |             bam.fetch(tid, loc.start, loc.end)?;
    |                            ^^^^^^^^^
    |                            |
    |                            expected `u64`, found `u32`
    |                            help: you can convert an `u32` to `u64`: `loc.start.into()`

error[E0308]: mismatched types
   --> src/main.rs:846:39
    |
846 |             bam.fetch(tid, loc.start, loc.end)?;
    |                                       ^^^^^^^
    |                                       |
    |                                       expected `u64`, found `u32`
    |                                       help: you can convert an `u32` to `u64`: `loc.end.into()`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0308`.
error: could not compile `bamtofastq`.

but switching the line with the suggested fix ameliorates the issue and builds successfully.

full compilation output:

   Compiling cc v1.0.50
   Compiling libc v0.2.69
   Compiling proc-macro2 v1.0.10
   Compiling unicode-xid v0.2.0
   Compiling syn v1.0.17
   Compiling cfg-if v0.1.10
   Compiling serde v1.0.106
   Compiling autocfg v1.0.0
   Compiling version_check v0.9.1
   Compiling memchr v2.3.3
   Compiling lazy_static v1.4.0
   Compiling pkg-config v0.3.17
   Compiling bitflags v1.2.1
   Compiling regex-syntax v0.6.17
   Compiling rustc-demangle v0.1.16
   Compiling ryu v1.0.3
   Compiling glob v0.3.0
   Compiling getrandom v0.1.14
   Compiling itoa v0.4.5
   Compiling semver-parser v0.7.0
   Compiling byteorder v1.3.4
   Compiling remove_dir_all v0.5.2
   Compiling pulldown-cmark v0.2.0
   Compiling bindgen v0.53.2
   Compiling quick-error v1.2.3
   Compiling same-file v1.0.6
   Compiling bytecount v0.4.0
   Compiling shlex v0.1.1
   Compiling ppv-lite86 v0.2.6
   Compiling rustc-hash v1.1.0
   Compiling peeking_take_while v0.1.2
   Compiling lazycell v1.2.1
   Compiling glob v0.2.11
   Compiling semver v0.1.20
   Compiling failure_derive v0.1.7
   Compiling maybe-uninit v2.0.0
   Compiling smallvec v1.3.0
   Compiling matches v0.1.8
   Compiling doc-comment v0.3.3
   Compiling either v1.5.3
   Compiling crc32fast v1.2.0
   Compiling log v0.4.8
   Compiling percent-encoding v2.1.0
   Compiling void v1.0.2
   Compiling min-max-heap v1.3.0
   Compiling strsim v0.9.3
   Compiling linear-map v1.2.0
   Compiling termcolor v1.1.0
   Compiling custom_derive v0.1.7
   Compiling ieee754 v0.2.6
   Compiling thread_local v1.0.1
   Compiling fs-utils v1.1.4
   Compiling walkdir v2.3.1
   Compiling unicode-bidi v0.3.4
   Compiling itertools v0.8.2
   Compiling itertools v0.9.0
   Compiling unreachable v0.1.1
   Compiling rustc_version v0.1.7
   Compiling unicode-normalization v0.1.12
   Compiling aho-corasick v0.7.10
   Compiling csv-core v0.1.10
   Compiling quote v1.0.3
   Compiling crossbeam-utils v0.7.2
   Compiling num-traits v0.2.11
   Compiling regex-automata v0.1.9
   Compiling newtype_derive v0.1.6
   Compiling rand v0.4.6
   Compiling idna v0.2.0
   Compiling error-chain v0.12.2
   Compiling nom v5.1.1
   Compiling rand_core v0.5.1
   Compiling clang-sys v0.29.3
   Compiling rand_chacha v0.2.2
   Compiling crossbeam-channel v0.4.2
   Compiling url v2.1.1
   Compiling rand v0.7.3
   Compiling tempdir v0.3.7
   Compiling regex v1.3.7
   Compiling num-traits v0.1.43
   Compiling ordered-float v0.3.0
   Compiling uuid v0.8.1
   Compiling tempfile v3.1.0
   Compiling os_type v2.2.0
   Compiling backtrace-sys v0.1.35
   Compiling libz-sys v1.0.25
   Compiling libloading v0.5.2
   Compiling openssl-sys v0.9.55
   Compiling bzip2-sys v0.1.8+1.0.8
   Compiling curl-sys v0.4.30+curl-7.69.1
   Compiling lz4-sys v1.8.3
   Compiling lzma-sys v0.1.15
   Compiling cexpr v0.4.0
   Compiling flate2 v1.0.14
   Compiling backtrace v0.3.46
   Compiling synstructure v0.12.3
   Compiling serde_derive v1.0.106
   Compiling snafu-derive v0.6.6
   Compiling derive-new v0.5.8
   Compiling hts-sys v1.10.2
   Compiling failure v0.1.7
   Compiling snafu v0.6.0
   Compiling serde_json v1.0.51
   Compiling semver v0.9.0
   Compiling bio-types v0.6.0
   Compiling toml v0.5.6
   Compiling bincode v1.2.1
   Compiling bstr v0.2.12
   Compiling docopt v1.1.0
   Compiling serde_bytes v0.11.3
   Compiling csv v1.1.3
   Compiling human-panic v1.0.3
   Compiling cargo_metadata v0.6.4
   Compiling skeptic v0.13.4
   Compiling lz4 v1.23.1
   Compiling rust-htslib v0.30.0
   Compiling shardio v0.7.0 (https://github.com/10XGenomics/rust-shardio.git#88aacb25)
   Compiling bamtofastq v1.3.0 (/home/benjohnson/NGS_tools/utils/bamtofastq)

cargo 1.42.0 (86334295e 2020-01-31) Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-96-generic x86_64)

wyattmcdonnell commented 4 years ago

Hi @biobenkj what does git show --oneline -s return for you?

biobenkj commented 4 years ago

Hi @wyattmcdonnell,

it shows:

d321c4c (HEAD -> master, origin/master, origin/HEAD) update version
wyattmcdonnell commented 4 years ago

Thanks for sharing that info! Please try pulling the latest commit; I was unable to replicate your particular error on d321c4c using both OS X Catalina and AWS-flavored Linux with Cargo 1.42.0. Please let me know if you can replicate this error on a different machine.

biobenkj commented 4 years ago

Thanks for looking into this @wyattmcdonnell! I think I've found the problem (I hope). I can reproduce the error using the latest commit on mac osx catalina and centos 7 if I force bamtofastq to pick up rust-htslib v 0.30.0. If the default Cargo.toml picks up rust-htslib v 0.27.0, it'll build just fine. But if it bumps to v0.30.0, it'll break. It seems on my Ubuntu system, it picked up the v0.30.0.

wyattmcdonnell commented 4 years ago

Thanks @biobenkj this replicates on my end too. Patch to follow shortly.