Commit f531a6f1 authored by NOEL Philippe's avatar NOEL Philippe

Fix examples in Readme.md and src/lib.rs

parent 3357c5ae
Pipeline #125566 failed with stages
in 55 seconds
......@@ -8,37 +8,40 @@ Add this to your `Cargo.toml`:
```toml
[dependencies]
pdbparser = { git = "ssh://git@gitlab.inria.fr/pnoel/pdbparser.git" }
```
and this to your crate root:
```rust
extern crate pdbparser;
lib3dmol = "0.3.1"
```
Here's a simple example that read a pdb file in tests/tests_file
```rust
extern crate pdbparser;
use pdbpaser::*;
use lib3dmol::parser;
fn main() {
let my_prot = parse_pdb("tests/tests_file/5jpq.pdb", "5jpq");
println!("Prot : {} \nn chain: {}\nn res: {}\nn atom: {}",
my_prot.name, my_prot.get_number_chain(),
my_prot.get_number_residue(),
my_prot.get_number_atom());
println!("Reduce protein");
let chain_a = my_prot.select_atoms("chain a").unwrap();
println!("Prot : {} \nn chain: {}\nn res: {}\nn atom: {}",
chain_a.name, chain_a.get_number_chain(),
chain_a.get_number_residue(),
chain_a.get_number_atom());
let my_structure = parser::read_pdb("tests/tests_file/f2.pdb", "Protein f2");
println!(
"Structure name: {}
Number of chain: {}
Number of residue: {}
Number of atom: {}",
my_structure.name,
my_structure.get_chain_number(),
my_structure.get_residue_number(),
my_structure.get_atom_number()
);
// Now we will extract the backbone
let backbone = my_structure.select_atoms("backbone").unwrap();
println!(
"Number of chain: {}
Number of residue: {}
Number of atom: {}",
backbone.get_chain_number(),
backbone.get_residue_number(),
backbone.get_atom_number()
);
}
```
......
......@@ -8,29 +8,24 @@
//!
//! # Examples
//! ```rust
//! use lib3dmol::parser;
//! use lib3dmol::*;
//!
//! let my_structure = parser::read_pdb("tests/tests_file/f2.pdb", "Protein f2");
//! fn main() {
//! let my_prot = parse_pdb("tests/tests_file/5jpq.pdb", "5jpq");
//!
//! println!("Structure name: {}
//! Number of chain: {}
//! Number of residue: {}
//! Number of atom: {}",
//! my_structure.name,
//! my_structure.get_chain_number(),
//! my_structure.get_residue_number(),
//! my_structure.get_atom_number());
//! println!("Prot : {} \nn chain: {}\nn res: {}\nn atom: {}",
//! my_prot.name, my_prot.get_number_chain(),
//! my_prot.get_number_residue(),
//! my_prot.get_number_atom());
//!
//! // Now we will extract the backbone
//! println!("Reduce protein");
//!
//! let backbone = my_structure.select_atoms("backbone").unwrap();
//!
//! println!("Number of chain: {}
//! Number of residue: {}
//! Number of atom: {}",
//! backbone.get_chain_number(),
//! backbone.get_residue_number(),
//! backbone.get_atom_number());
//! let chain_a = my_prot.select_atoms("chain a").unwrap();
//! println!("Prot : {} \nn chain: {}\nn res: {}\nn atom: {}",
//! chain_a.name, chain_a.get_number_chain(),
//! chain_a.get_number_residue(),
//! chain_a.get_number_atom());
//! }
//! ```
#[macro_use]
extern crate lazy_static;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment