Bioutils provides simple biological utilities including:
Pull requests welcome, suggestions for improvement always welcome!
charsets | Numerous IUPAC character sets to either use directly or create your own mix and match. |
files | Download fastq sample files with curl using a url. See step 2 download files example in bioutils/examples. |
references | Currently includes human NCBI gencode GRCh38. Automatically downloads the latest version of user's choice. See step 2 download files example in bioutils/examples. |
utils | Functions for sequence checks, pseudorandom replacement of N or gaps, and functions to create new pseudoranndom sequences. |
image | Create images from biological data. See Image example in bioutils/examples. |
//! // Examples for using checks: //! //! use bioutils::charsets; //! use bioutils::utils; //! use bioutils::utils::check::value::CheckU8; //! use bioutils::utils::new::random::randomdna; //! use bioutils::utils::new::random::randomquality; //! use bioutils::utils::mutate::random::AsMutRandomU8; //! use rand::rngs::ThreadRng; //! use rand::seq::SliceRandom; //! use std::string::String; //! use std::str; //! //! let dna = b"ACTG"; //! let rna = b"ACUG"; //! let homopolymerN = b"NNNN"; //! let homopolymerA = b"AAAA"; //! let gapna = b"AC-G"; //! let nna = b"ACnG"; //! let quality = b"@ABC"; //! //! assert!(homopolymerN.ishomopolymer()); //! assert!(homopolymerA.ishomopolymernotn()); //! assert!(homopolymerN.ishomopolymern()); //! //! assert!(gapna.hasgap()); //! assert!(nna.hasn()); //! assert!(dna.isiupac()); //! assert!(rna.isbasicrna()); //! //! assert!(quality.isphred33()); //! assert!(quality.isphred64()); //! assert!(quality.issolexa()); //! //! // Examples for creating a new random sequence and quality //! //! let mut rng1 = rand::threadrng(); // Create a random number generator //! let dna = randomdna(4,rng1); // Create a random dna sequence //! let mut rng2 = rand::threadrng(); //! let quality = randomquality(4,rng2); // Create a random quality string //! println!("{:?}", dna.toowned()); //! println!("{:?}", quality.toowned()); //! //! // Examples for replacing nucleotides //! //! let mut rng3 = rand::threadrng(); //create a random number generator //! let mut rng4 = rand::threadrng(); //create a random number generator //! let mut seq = b"acugnnnqqq".toowned(); // or by *: let mut seq = *b"acugnnnqqq"; //! let mut seq = seq.mutrandomreplacenonbasic("RNA", rng4).mutrandomreplacen("RNA", rng3).muttoupperbasic(); //! let printseq = str::fromutf8(seq).unwrap(); //! println!("{:?}", printseq);