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

Automatically recognise /dev/stdin as stdin in bedgraphtobigwig and… #72

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bigtools/src/utils/cli/bedgraphtobigwig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use super::BBIWriteArgs;
long_about = "Converts an input bedGraph to a bigWig. Can be multi-threaded for substantial speedups. Note that ~11 temporary files are created/maintained."
)]
pub struct BedGraphToBigWigArgs {
/// The bedgraph to convert to a bigwig. Can use `-` or `stdin` to read from stdin.
/// The bedgraph to convert to a bigwig. Can use `-`, `stdin` or `/dev/stdin` to read from stdin.
pub bedgraph: String,

/// A chromosome sizes file. Each line should be have a chromosome and its size in bases, separated by whitespace.
Expand Down Expand Up @@ -99,7 +99,7 @@ pub fn bedgraphtobigwig(args: BedGraphToBigWigArgs) -> Result<(), Box<dyn Error>
};

let allow_out_of_order_chroms = !matches!(outb.options.input_sort_type, InputSortType::ALL);
if bedgraphpath == "-" || bedgraphpath == "stdin" {
if bedgraphpath == "-" || bedgraphpath == "stdin" || bedgraphpath == "/dev/stdin" {
let stdin = std::io::stdin().lock();
let vals = BedParserStreamingIterator::from_bedgraph_file(stdin, allow_out_of_order_chroms);
outb.write(vals, runtime)?;
Expand Down
4 changes: 2 additions & 2 deletions bigtools/src/utils/cli/bedtobigbed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use super::BBIWriteArgs;
long_about = None,
)]
pub struct BedToBigBedArgs {
/// The bedGraph to convert to a bigbed.
/// The bed to convert to a bigbed. Can use `-`, `stdin` or `/dev/stdin` to read from stdin.
pub bed: String,

/// A chromosome sizes file. Each line should be have a chromosome and its size in bases, separated by whitespace.
Expand Down Expand Up @@ -108,7 +108,7 @@ pub fn bedtobigbed(args: BedToBigBedArgs) -> anyhow::Result<()> {
};

let allow_out_of_order_chroms = !matches!(outb.options.input_sort_type, InputSortType::ALL);
if bedpath == "-" || bedpath == "stdin" {
if bedpath == "-" || bedpath == "stdin" || bedpath == "/dev/stdin" {
if let Some(file) = args.autosql.as_ref() {
outb.autosql = Some(std::fs::read_to_string(file)?);
}
Expand Down
Loading