Skip to content

Commit

Permalink
Set channel size for nthreads == 1 to 0 and trim end
Browse files Browse the repository at this point in the history
  • Loading branch information
jackh726 committed May 14, 2024
1 parent a383b9f commit be13c51
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions bigtools/src/bed/bedparser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::bbi::{BedEntry, Value};
use crate::utils::streaming_linereader::StreamingLineReader;

pub fn parse_bed<'a>(s: &'a str) -> Option<Result<(&'a str, BedEntry), BedValueError>> {
let mut split = s.splitn(4, '\t');
let mut split = s.trim_end().splitn(4, '\t');
let chrom = match split.next() {
Some(chrom) => chrom,
None => return None,
Expand Down Expand Up @@ -47,7 +47,7 @@ pub fn parse_bed<'a>(s: &'a str) -> Option<Result<(&'a str, BedEntry), BedValueE
}

pub fn parse_bedgraph<'a>(s: &'a str) -> Option<Result<(&'a str, Value), BedValueError>> {
let mut split = s.splitn(5, '\t');
let mut split = s.trim_end().splitn(5, '\t');
let chrom = match split.next() {
Some(chrom) => chrom,
None => return None,
Expand Down
2 changes: 1 addition & 1 deletion bigtools/src/bed/indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn index_chroms(file: File) -> io::Result<Option<Vec<(u64, String)>>> {
if s.is_empty() {
return Ok(None);
}
let mut split = s.splitn(4, '\t');
let mut split = s.trim_end().splitn(4, '\t');
let chrom = split
.next()
.ok_or_else(|| io::Error::new(io::ErrorKind::InvalidData, "Empty file".to_string()))?;
Expand Down
1 change: 1 addition & 0 deletions bigtools/src/utils/cli/bedgraphtobigwig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ pub fn bedgraphtobigwig(args: BedGraphToBigWigArgs) -> Result<(), Box<dyn Error>
.collect();

let runtime = if nthreads == 1 {
outb.options.channel_size = 0;
runtime::Builder::new_current_thread().build().unwrap()
} else {
runtime::Builder::new_multi_thread()
Expand Down
1 change: 1 addition & 0 deletions bigtools/src/utils/cli/bedtobigbed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pub fn bedtobigbed(args: BedToBigBedArgs) -> Result<(), Box<dyn Error>> {
.collect();

let runtime = if nthreads == 1 {
outb.options.channel_size = 0;
runtime::Builder::new_current_thread().build().unwrap()
} else {
runtime::Builder::new_multi_thread()
Expand Down

0 comments on commit be13c51

Please sign in to comment.