pub fn deindex(v: &mut Vec<u8>) -> Vec<usize>  {

    let (mut j, mut x, mut print, mut singleton,  mut b) = (0,0, false,true, 0);

    let mut vec = vec![0;v.iter().filter(|&r|*r == '\n' as u8).count()+1];

    for (e,i) in v.clone().iter().enumerate(){

        if *i == 10u8 {
            singleton = false;
            if print == true{
                vec[x] = 1;
            }else{
                vec[x] = decode(&v[b..e].to_vec(), &b"ACGT".to_vec());
            }
            x+=1;
            v[j] = *i;j+=1;
            print = false;

        }else if *i == 94u8 {
            if print == false{
                print = true;
            } else {
                print = false;
                b = e + 1;
            }
            continue;
        }

        if print == true {
            v[j] = *i;
            j += 1;
        }
    }

    //if singleton {eprintln!("Singleton is true");}

    if print == true || singleton == true {
        vec[x] = 1;
    } else {
        vec[x] = decode(&v[b..v.len()].to_vec(), &b"ACGT".to_vec())+1;
        //j+=1;
    }

    v.resize(j,0x00);
    vec

}
/** Function takes `Vec<u8>` and the length of an index
    and removes it from the data

    Example:
    in: AAAbbbbb\nACAbbbbb\nAGAbbbbb\nATAbbbbb
    out: bbbbb\nbbbbb\nbbbbb\nbbbbb\n
*/
Function takes `Vec` and the length of an index
and removes it from the data


Function takes ` Vec ` and the length of an index and removes it from the data
pub fn deindex(v: &mut Vec<u8>) -> Vec<usize>  {
    let (mut j, mut x, mut print, mut singleton,  mut b) = (0,0, false,true, 0);
    let mut vec = vec![0;v.iter().filter(|&r|*r == '\n' as u8).count()+1];
    for (e,i) in v.clone().iter().enumerate(){
        if *i == 10u8 {
            singleton = false;
            if print == true{
                vec[x] = 1;
            }else{
                vec[x] = decode(&v[b..e].to_vec(), &b"ACGT".to_vec());
            }
            x+=1;
            v[j] = *i;j+=1;
            print = false;
        }else if *i == 94u8 {
            if print == false{
                print = true;
            } else {
                print = false;
                b = e + 1;
            }
            continue;
        }
        if print == true {
            v[j] = *i;
            j += 1;
        }
    }
    //if singleton {eprintln!("Singleton is true");}
    if print == true || singleton == true {
        vec[x] = 1;
    } else {
        vec[x] = decode(&v[b..v.len()].to_vec(), &b"ACGT".to_vec())+1;
        //j+=1;
    }
    v.resize(j,0x00);
    vec
}
pub fn deindex ( v : & mut Vec < u8 > ) -> Vec < usize > { let ( mut j , mut x , mut print , mut singleton , mut b ) = ( 0 , 0 , false , true , 0 ) ; let mut vec = vec ! [ 0 v iter ( ) filter ( r r '\n' as u8 ) count ( ) 1 ] ; for ( e , i ) in v . clone ( ) . iter ( ) . enumerate ( ) { if * i == 10u8 { singleton = false ; if print == true { vec [ x ] = 1 ; } else { vec [ x ] = decode ( & v [ b .. e ] . to_vec ( ) , & b" " . to_vec ( ) ) ; } x += 1 ; v [ j ] = * i ; j += 1 ; print = false ; } else if * i == 94u8 { if print == false { print = true ; } else { print = false ; b = e + 1 ; } continue ; } if print == true { v [ j ] = * i ; j += 1 ; } } //if singleton {eprintln!("Singleton is true");} if print == true || singleton == true { vec [ x ] = 1 ; } else { vec [ x ] = decode ( & v [ b .. v . len ( ) ] . to_vec ( ) , & b" " . to_vec ( ) ) + 1 ; //j+=1; } v . resize ( j , 0x00 ) ; vec }
Function takes `Vec<u8>` and the length of an index
and removes it from the data
Function takes ` Vec<u8 > ` and the length of an index and removes it from the data
v
&mut Vec<u8>
v
&mut Vec<u8>