Commit 5627e5f6 authored by NOEL Philippe's avatar NOEL Philippe

Change all doc to prepare cargo doc with references

parent 3850e13c
Pipeline #73696 passed with stages
in 1 minute and 25 seconds
//! # pdbparser
//!
//! `pdbparser` is a library to manipulate protein structure. It can parse, and filter PDB files.
//! You can create a protein structure by parsing with parse_pdb function. Then you can add filters on your protein.
//! You can create a [`Structure`] by parsing with read_pdb function. Then you can add filters on your Structure.
//! And save it with write_pdb function.
//!
#[macro_use]
......
use std::collections::HashMap;
use std::ops::Deref;
/// An `Atom` is a sub-structure linked to a `Residue`.
/// It stores the following properties:
/// An [`Atom`] is a sub-structure linked to a [`Residue`].
/// It stores the following properties
/// - atom name;
/// - atom number (atomid);
/// - Coordinates x, y and z
......@@ -17,7 +17,7 @@ pub struct Atom {
}
impl Atom {
/// Create a new structure Atom. An atom have a name, a number and x, y, z coordinates
/// Create a new structure [`Atom`]. An atom have a name, a number and x, y, z coordinates
/// If the atom name is "C", "CA", "N", "O", "OT1" or "OT2", it will be consider as backbone
///
/// # Examples
......@@ -39,13 +39,13 @@ impl Atom {
}
}
/// Get the name of the atom
/// Get the name of the [`Atom`]
///
pub fn name(&self) -> String {
self.name.clone()
}
/// Compute the distance between 2 Atoms
/// Compute the distance between 2 [`Atom`]
///
/// # Examples
///
......@@ -68,7 +68,7 @@ impl Atom {
/// Enumerate to check the types of the parsed atom.
///
/// Atom will be class into the following map:
/// [`Atom`] will be class into the following map:
/// "ARG" => AtomTypes::AminoAcid
/// "LYS" => AtomTypes::AminoAcid
/// "ASN" => AtomTypes::AminoAcid
......@@ -110,7 +110,7 @@ pub enum AtomTypes {
}
impl AtomTypes {
/// Return a AtomTypes according to the "residue" of the atom
/// Return a [`AtomTypes`] according to the "residue" of the atom
///
/// ````
/// use pdbparser::AtomTypes;
......
use super::residue::Residue;
/// A `Chain` is a sub-structure linked to a `Protein`.
/// It contain one or more `Residue` and a name
/// A [`Chain`] is a sub-structure linked to a [`Protein`].
/// It contain one or more [`Residue`] and a name
///
#[derive(Debug)]
pub struct Chain {
......@@ -10,7 +10,7 @@ pub struct Chain {
}
impl Chain {
/// Create a new chain structure with an empty list of residue
/// Create a new [`Chain`] structure with an empty list of residue
///
/// # Examples
///
......@@ -27,7 +27,7 @@ impl Chain {
}
}
/// Add a new structure residue to the Chain
/// Add a new structure [`Residue`] to the [`Chain`]
///
/// # Examples
///
......@@ -46,7 +46,7 @@ impl Chain {
self.lst_res.push(r);
}
/// Get the number of residue in the Chain
/// Get the number of [`Residue`] in the [`Chain`]
///
/// # Examples
///
......@@ -62,7 +62,7 @@ impl Chain {
self.lst_res.len() as u64
}
/// Return a mutable reference of a residue with its name. Return None if the
/// Return a mutable reference of a [`Residue`] with its name. Return None if the
/// residue does not exist
///
/// # Examples
......
......@@ -45,7 +45,7 @@ fn parse_int(s: &str) -> i64 {
}
/// Parse the pdb file and return a `Structure`
/// Parse the pdb file and return a [`Structure`]
///
/// # Examples
/// ```
......
use super::atom::Atom;
/// A `Residue` is a sub-structure linked to a `Chain`.
/// It contain one or more `Atom`
/// A [`Residue`] is a sub-structure linked to a [`Chain`].
/// It contain one or more [`Atom`]
/// It stores the following properties:
/// - res name;
/// - res number (resid);
......@@ -15,7 +15,7 @@ pub struct Residue {
}
impl Residue {
/// Create a new Residue structure with an empty list of atom.
/// Create a new [`Residue`] structure with an empty list of atom.
/// The Residue have a name and a number
///
/// # Examples
......@@ -40,13 +40,13 @@ impl Residue {
self.name.clone()
}
/// Get the residue ID of the residue
/// Get the residue ID of the [`Residue`]
///
pub fn get_res_num(&self) -> u64 {
self.res_num
}
/// Get the number of Atom in the Residue
/// Get the number of [`Atom`] in the [`Residue`]
///
/// # Examples
///
......@@ -61,7 +61,7 @@ impl Residue {
self.lst_atom.len() as u64
}
/// Add an Atom structure to the Residue
/// Add an [`Atom`] structure to the [`Residue`]
///
/// # Examples
///
......
......@@ -5,7 +5,7 @@ use super::atom::Atom;
use super::selection_atom;
/// A `Structure` is the SUPER structure which contain molecules like Protein, DNA, etc.
/// A [`Structure`] is the SUPER structure which contain molecules like Protein, DNA, etc.
///
pub struct Structure {
pub name: String,
......@@ -14,7 +14,7 @@ pub struct Structure {
}
impl Structure {
/// Create a new `Structure`
/// Create a new [`Structure`]
///
/// # Examples
///
......@@ -32,7 +32,7 @@ impl Structure {
}
}
/// Get the name of the `Structure`
/// Get the name of the [`Structure`]
///
/// # Examples
///
......@@ -48,7 +48,7 @@ impl Structure {
&self.name
}
/// Add a new `Chain` in the `Structure`
/// Add a new [`Chain`] in the [`Structure`]
///
/// # Examples
///
......@@ -68,7 +68,7 @@ impl Structure {
self.chains.push(c);
}
/// Return True if the chain is in the `Structure`
/// Return True if the [`Chain`] is in the [`Structure`]
///
/// # Examples
///
......@@ -91,7 +91,7 @@ impl Structure {
false
}
/// Get the number of `Chain` in the `Structure`
/// Get the number of [`Chain`] in the [`Structure`]
///
/// # Examples
///
......@@ -106,7 +106,7 @@ impl Structure {
self.chains.len()
}
/// Return the number of `Residue` in the `Structure`
/// Return the number of [`Residue`] in the [`Structure`]
///
/// According to PDB format, residue can be molecules of amino acid, nucleic acid, lipid or ligand
///
......@@ -137,7 +137,7 @@ impl Structure {
n
}
/// Return the number of atom in the protein
/// Return the number of [`Atom`] in the [`Structure`]
///
/// # Examples
///
......@@ -159,7 +159,7 @@ impl Structure {
n
}
/// Generate a vector of atoms index
/// Generate a [`Vector`] of atoms index (u64)
/// Can be used in other program like rrmsd_map to select specific atoms
///
/// # Examples
......@@ -184,8 +184,8 @@ impl Structure {
lst
}
/// Return a mutable reference of a chaine with its name. Return None if the
/// chain does not exist
/// Return a mutable reference of a [`Chain`] with its name. Return None if the
/// [`Chain`] does not exist
///
/// # Examples
///
......@@ -211,7 +211,7 @@ impl Structure {
}
/// Function that add information on the `Structure` (used in the parsing)
/// Function that add information on the [`Structure`] (used in the parsing)
/// /!\Change this to a macro!
///
pub fn update_structure(
......@@ -247,7 +247,7 @@ impl Structure {
residue.add_atom(atom);
}
/// Select atoms from a pattern and return a new `Structure`
/// Select [`Atom`] from a pattern and return a new [`Structure`]
///
/// The pattern could use keywords "Chain", "Resid" or "Backbone" (keyword are not case sensitive)
///
......@@ -321,7 +321,7 @@ impl Structure {
Some(new_struct)
}
/// Used to clean the dialing of atoms in the `Structure`
/// Used to clean the dialing of [`Atom`] in the [`Structure`]
/// Does not change the dialing of residues.
///
///
......
......@@ -4,9 +4,9 @@ use std::fs::File;
use std::io;
use std::io::Write;
/// Write a PDB file for the `Protein`.
/// Write a PDB file for the [`Structure`].
/// Be careful, the protein is write with the atom numbers in its structure. Remind to use the method
/// my_protein.refine_dialing() before !
/// my_struct.refine_dialing() before !
pub fn write_pdb(my_prot: &Structure, file: &str) -> io::Result<()> {
let mut output_pdb = File::create(file)?;
......
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