pub fn bwa_index_if_required(ref_name: &str) {
    // first, create the absolute filepath from the relative filepath (but throw an error if it doesn't exist)
    let ref_path: PathFile = absolute_filepath_checked(ref_name);
    let ref_path_os_str: &OsStr = ref_path.as_ref();
    let ref_path_str: &str = ref_path_os_str.to_str().unwrap();

    // now check if the BWA index already exists
    let bwa_index_path_str = format!("{}.{}", ref_path_str, "bwt");
    if let Ok(_) = PathFile::new(bwa_index_path_str) {
        println!("BWA index already exists");
        return;
    }

    // Now that we know that we have to index:
    println!("Waiting for bwa index...");
    let mut child_proc = Command::new("bwa")
        .args(&["index", ref_path_str])
        .spawn()
        .unwrap();
    let _result = child_proc.wait().unwrap();
    println!("BWA index complete");
}
// creates a bwa index if one does not already exist
// by default, bwa index will create a new file with name equal to the original file name + ".bwt"
creates a bwa index if one does not already exist
by default, bwa index will create a new file with name equal to the original file name + ".bwt"
creates a bwa index if one does not already exist by default bwa index will create a new file with name equal to the original file name + " . bwt "
pub fn bwa_index_if_required(ref_name: &str) {
    // first, create the absolute filepath from the relative filepath (but throw an error if it doesn't exist)
    let ref_path: PathFile = absolute_filepath_checked(ref_name);
    let ref_path_os_str: &OsStr = ref_path.as_ref();
    let ref_path_str: &str = ref_path_os_str.to_str().unwrap();
    // now check if the BWA index already exists
    let bwa_index_path_str = format!("{}.{}", ref_path_str, "bwt");
    if let Ok(_) = PathFile::new(bwa_index_path_str) {
        println!("BWA index already exists");
        return;
    }
    // Now that we know that we have to index:
    println!("Waiting for bwa index...");
    let mut child_proc = Command::new("bwa")
        .args(&["index", ref_path_str])
        .spawn()
        .unwrap();
    let _result = child_proc.wait().unwrap();
    println!("BWA index complete");
}
pub fn bwa_index_if_required ( ref_name : & str ) { // first, create the absolute filepath from the relative filepath (but throw an error if it doesn't exist) let ref_path : PathFile = absolute_filepath_checked ( ref_name ) ; let ref_path_os_str : & OsStr = ref_path . as_ref ( ) ; let ref_path_str : & str = ref_path_os_str . to_str ( ) . unwrap ( ) ; // now check if the BWA index already exists let bwa_index_path_str = format ! ( " " ref_path_str " " ) ; if let Ok ( _ ) = PathFile :: new ( bwa_index_path_str ) { println ! ( " " ) ; return ; } // Now that we know that we have to index: println ! ( " " ) ; let mut child_proc = Command :: new ( " " ) . args ( & [ " " , ref_path_str ] ) . spawn ( ) . unwrap ( ) ; let _result = child_proc . wait ( ) . unwrap ( ) ; println ! ( " " ) ; }
creates a bwa index if one does not already exist
by default, bwa index will create a new file with name equal to the original file name + ".bwt"
creates a bwa index if one does not already exist by default bwa index will create a new file with name equal to the original file name + " . bwt "
ref_name
&str
ref_name
&str