Skip to content

Commit

Permalink
Prepare for v0.1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Arkanosis committed Jul 21, 2017
1 parent 9a638c8 commit 9e07934
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bamrescue"
version = "0.0.2-dev"
version = "0.1.0"
description = "Utility to check Binary Sequence Alignment / Map (BAM) files for corruption and repair them"

authors = ["Jérémie Roquet <[email protected]>"]
Expand Down
25 changes: 0 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,6 @@ Even though most tools would gave up on this file, it still contains almost
100% of non-corrupted bam payload, and the user probably wouldn't mind much if
they could work only on that close-to-100% amount of data.

Let's rescue the non-corrupted payload (beware: this takes as much additional
space on the disk as the original file):

$ bamrescue rescue samples/corrupted_payload.bam rescued_file.bam

The output is the following:

Jun 17 23:06:48.840 INFO Rescuing data from samples/corrupted_payload.bam…
bam rescue statistics:
1870 bgzf blocks found (117 MiB of bam payload)
2 corrupted blocks removed (0% of total)
46 KiB of bam payload lost (0% of total)
1868 non-corrupted blocks rescued (almost 100% of total)
111 MiB of bam payload rescued (almost 100% of total)
Jun 17 23:07:10.555 ERRO INFO Data rescued to rescued_file.bam

The resulting bam file can now be used like if it never had been corrupted.
Rescued data is validated using a CRC32 checksum, so it's not like ignoring
errors and working on corrupted data (typical use of gzip to get garbage data
from a corrupted bam file): it's working on (ridiculously) less, validated
data.

## Performance

bamrescue is very fast. Actually, it is even faster than gzip while doing more.
Expand Down Expand Up @@ -132,17 +110,14 @@ Copy the `bamrescue` binary wherever you want.

```console
Usage: bamrescue check [--quiet] [--threads=<threads>] <bamfile>
bamrescue rescue <bamfile> <output>
bamrescue -h | --help
bamrescue --version

Commands:
check Check BAM file for corruption.
rescue Keep only non-corrupted blocks of BAM file.

Arguments:
bamfile BAM file to check or rescue.
output Rescued BAM file.

Options:
-h, --help Show this screen.
Expand Down
15 changes: 0 additions & 15 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,14 @@ use std::process;

const USAGE: &str = "
Usage: bamrescue check [--quiet] [--threads=<threads>] <bamfile>
bamrescue rescue <bamfile> <output>
bamrescue -h | --help
bamrescue --version
Commands:
check Check BAM file for corruption.
rescue Keep only non-corrupted blocks of BAM file.
Arguments:
bamfile BAM file to check or rescue.
output Rescued BAM file.
Options:
-h, --help Show this screen.
Expand All @@ -39,9 +36,7 @@ Options:
#[derive(RustcDecodable)]
struct Args {
cmd_check: bool,
cmd_rescue: bool,
arg_bamfile: String,
arg_output: String,
flag_quiet: bool,
flag_threads: usize,
flag_version: bool,
Expand Down Expand Up @@ -97,15 +92,5 @@ fn main() {
results.truncated_between_blocks {
process::exit(1);
}
} else if args.cmd_rescue {
File::open(&args.arg_bamfile).and_then(|bamfile| {
File::create(&args.arg_output).and_then(|mut output| {
let mut reader = BufReader::new(&bamfile);
bamrescue::rescue(&mut reader, &mut output, &logger)
})
}).unwrap_or_else(|cause| {
error!(logger, "Unable to rescue bam file: {}", cause);
process::exit(1);
});
}
}

0 comments on commit 9e07934

Please sign in to comment.