-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//! Builds and writes a tabix index from a bgzip-compressed BED file. | ||
//! | ||
//! This writes the output to stdout rather than `<src>.tbi`. | ||
//! | ||
//! The output is similar to the output of `tabix --preset bed <src>`. | ||
use std::{ | ||
env, | ||
io::{self, BufWriter}, | ||
}; | ||
|
||
use noodles_bed as bed; | ||
use noodles_tabix as tabix; | ||
|
||
fn main() -> io::Result<()> { | ||
let src = env::args().nth(1).expect("missing src"); | ||
|
||
let index = bed::fs::index(src)?; | ||
|
||
let stdout = io::stdout().lock(); | ||
let mut writer = tabix::io::Writer::new(BufWriter::new(stdout)); | ||
writer.write_index(&index)?; | ||
|
||
Ok(()) | ||
} |