Skip to content

Commit 5244c1d

Browse files
committed
When bed is empty, don't fail at autosql step
1 parent 9ad9727 commit 5244c1d

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

bigtools/src/utils/cli/bedtobigbed.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,13 @@ pub fn bedtobigbed(args: BedToBigBedArgs) -> anyhow::Result<()> {
119119
let infile = File::open(&bedpath)
120120
.with_context(|| format!("Failed to open bed file `{}`", &bedpath))?;
121121
let mut vals_iter = BedFileStream::from_bed_file(infile);
122-
crate::bed::autosql::bed_autosql(&vals_iter.next().unwrap().unwrap().1.rest)
122+
vals_iter
123+
.next()
124+
.map(|v| crate::bed::autosql::bed_autosql(&v.unwrap().1.rest))
123125
}
124-
Some(file) => std::fs::read_to_string(file)?,
126+
Some(file) => Some(std::fs::read_to_string(file)?),
125127
};
126-
outb.autosql = Some(autosql);
128+
outb.autosql = autosql;
127129

128130
let infile = File::open(&bedpath)
129131
.with_context(|| format!("Failed to open bed file `{}`.", &bedpath))?;

0 commit comments

Comments
 (0)