Skip to content

orhanbalci/patoz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Patoz

Protein Data Bank (pdb) file parser

Build Status License

⚠️ WIP This is a work in progress. Expect breaking changes frequently. Right now use at your own risk

📦 Cargo.toml

patoz = "0.1.0"

🔧 Examples

use std::{
    fs::File,
    io::{BufReader, Read},
    path::PathBuf,
};

use patoz::parse;

fn main() {
    let mut current_file_path = PathBuf::from(file!());
    current_file_path.pop();
    current_file_path.pop();
    current_file_path.push("1BYI.pdb");
    let content = read_file(&current_file_path);
    if let Ok((_, mut res)) = parse(&content) {
        println!(
            "Classification : {:?}",
            res.header().header().unwrap().classification
        );
        println!("Id Code : {:?}", res.header().header().unwrap().id_code);
        println!("Keywords : {:?}", res.header().keywds().unwrap().keywords);
    }
}

fn read_file(path: &PathBuf) -> String {
    let file = File::open(path).unwrap();
    let mut buf_reader = BufReader::new(file);
    let mut contents = String::new();
    if let Ok(_read_res) = buf_reader.read_to_string(&mut contents) {
        contents
    } else {
        "".to_owned()
    }
}

📊 Status

Record Parser Status

Title Section

Primary Structure Section

Heterogen Section

Secondary Structure Section

Connectivity Annotation Section

Miscellaneous Features Section

Crystallographic and Coordinate Transformation Section

Coordinate Section

Connectivity Section

Bookkeeping Section

📝 License

Licensed under MIT License (LICENSE).

🚧 Contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the MIT license, shall be licensed as above, without any additional terms or conditions.