diff --git a/pybigtools/src/lib.rs b/pybigtools/src/lib.rs index afca2bc..75386b8 100644 --- a/pybigtools/src/lib.rs +++ b/pybigtools/src/lib.rs @@ -1175,24 +1175,21 @@ fn bigWigAverageOverBed( Some(names) => match names.extract::(py) { Ok(b) => { if b { - (Name::Column(4), true) + (Name::Column(3), true) } else { (Name::None, true) } } Err(_) => match names.extract::(py) { - Ok(col) => { - if col < 0 { + Ok(col) => match col { + 0 => (Name::None, true), + 1.. => (Name::Column((col - 1) as usize), true), + _ => { return Err(PyErr::new::( "Invalid names argument. Must be >= 0.", )); } - if col == 0 { - (Name::None, true) - } else { - (Name::Column(col as usize), true) - } - } + }, Err(_) => { return Err(PyErr::new::("Invalid names argument. Should be either `None`, a `bool`, or an `int`")); }