pub fn gc_four_fold_deg_sites<'a>(dna: &'a str, degeneracy: &str) -> Vec<&'a [u8]> {
        let bytes = dna.as_bytes();
        let codon_iterator = bytes.chunks(3);
        let mut collector = Vec::new();

        match degeneracy {
            "fourfold" => {
                for codon in codon_iterator {
                    let str_codon = str::from_utf8(codon).unwrap_or("");
                    if FOURFOLD_DEG.iter().any(|&i| i == str_codon.to_uppercase()) {
                        collector.push(codon);
                    }
                }
            }
            "sixfold" => {
                for codon in codon_iterator {
                    let str_codon = str::from_utf8(codon).unwrap_or("");
                    if SIXFOLD_DEG.iter().any(|&i| i == str_codon.to_uppercase()) {
                        collector.push(codon);
                    }
                }
            }
            // should NEVER reach here.
            _ => panic!("\"fourfold\" or \"sixfold\" should be specified."),
        }
        collector
    }
// take a trimmed sequence and return a vector of four/sixfold degenerate codons.
take a trimmed sequence and return a vector of four/sixfold degenerate codons.
take a trimmed sequence and return a vector of four / sixfold degenerate codons .
pub fn gc_four_fold_deg_sites<'a>(dna: &'a str, degeneracy: &str) -> Vec<&'a [u8]> {
        let bytes = dna.as_bytes();
        let codon_iterator = bytes.chunks(3);
        let mut collector = Vec::new();
        match degeneracy {
            "fourfold" => {
                for codon in codon_iterator {
                    let str_codon = str::from_utf8(codon).unwrap_or("");
                    if FOURFOLD_DEG.iter().any(|&i| i == str_codon.to_uppercase()) {
                        collector.push(codon);
                    }
                }
            }
            "sixfold" => {
                for codon in codon_iterator {
                    let str_codon = str::from_utf8(codon).unwrap_or("");
                    if SIXFOLD_DEG.iter().any(|&i| i == str_codon.to_uppercase()) {
                        collector.push(codon);
                    }
                }
            }
            // should NEVER reach here.
            _ => panic!("\"fourfold\" or \"sixfold\" should be specified."),
        }
        collector
    }
pub fn gc_four_fold_deg_sites < ' a > ( dna : & ' a str , degeneracy : & str ) -> Vec < & ' a [ u8 ] > { let bytes = dna . as_bytes ( ) ; let codon_iterator = bytes . chunks ( 3 ) ; let mut collector = Vec :: new ( ) ; match degeneracy { " " => { for codon in codon_iterator { let str_codon = str :: from_utf8 ( codon ) . unwrap_or ( " " ) ; if FOURFOLD_DEG . iter ( ) . any ( | & i | i == str_codon . to_uppercase ( ) ) { collector . push ( codon ) ; } } } " " => { for codon in codon_iterator { let str_codon = str :: from_utf8 ( codon ) . unwrap_or ( " " ) ; if SIXFOLD_DEG . iter ( ) . any ( | & i | i == str_codon . to_uppercase ( ) ) { collector . push ( codon ) ; } } } // should NEVER reach here. _ => panic ! ( " \" \" \" \" " ) , } collector }
take a trimmed sequence and return a vector of four/sixfold degenerate codons.
take a trimmed sequence and return a vector of four / sixfold degenerate codons .
dna
&'a str
degeneracy
&str
dna
&'a str
degeneracy
&str