Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
pdbparser
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NOEL Philippe
pdbparser
Commits
823247e7
Commit
823247e7
authored
Nov 27, 2018
by
NOEL Philippe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update doc in select atom
parent
0d2afd1a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
13 deletions
+32
-13
src/main.rs
src/main.rs
+2
-2
src/pdb/protein.rs
src/pdb/protein.rs
+25
-7
src/pdb/selection_atom.rs
src/pdb/selection_atom.rs
+5
-4
No files found.
src/main.rs
View file @
823247e7
...
...
@@ -3,7 +3,7 @@ extern crate pdbparser;
use
pdbparser
::
*
;
fn
main
()
{
let
toto
=
parse_pdb
(
"src/tests_file/f2
_adn
.pdb"
);
let
toto
=
parse_pdb
(
"src/tests_file/f2.pdb"
);
println!
(
"Nb res : {}"
,
toto
.get_number_residue
());
println!
(
"Nb chain : {}"
,
toto
.get_number_chain
());
println!
(
"Nb atom : {}"
,
toto
.get_atom_index
()
.len
());
...
...
@@ -12,7 +12,7 @@ fn main() {
println!
(
"Nb res : {}"
,
toto_A
.get_number_residue
());
println!
(
"Nb chain : {}"
,
toto_A
.get_number_chain
());
println!
(
"Nb atom : {}"
,
toto_A
.get_atom_index
()
.len
());
let
toto_A_b
=
toto
.select_atoms
(
"
chain A
and backbone"
)
.unwrap
();
let
toto_A_b
=
toto
.select_atoms
(
"
resid 10 to 50
and backbone"
)
.unwrap
();
println!
(
"Nb res : {}"
,
toto_A_b
.get_number_residue
());
println!
(
"Nb chain : {}"
,
toto_A_b
.get_number_chain
());
println!
(
"Nb atom : {}"
,
toto_A_b
.get_atom_index
()
.len
());
...
...
src/pdb/protein.rs
View file @
823247e7
...
...
@@ -232,25 +232,43 @@ impl<'a> Protein {
///
/// ## "Chain"
/// The Chain keyword is used to select chain. It must be follow by one or two chain names separate by the "to" keyword.
/// The chain name is case sensitive.
/// The chain name is case sensitive.
/// examples:
/// "Chain A" will select only the Chain A.
/// "Chain A to D" will select chains A, B, C and D.
///
/// ## "Resid"
/// The Resid keyword is used to select residues. It must be follow by one or two chain names separate by the "to" keyword.
/// In case where the protein has multiple chains, the Resid will return residue(s) for all chains.
/// In case where the protein has multiple chains, the Resid will return residue(s) for all chains.
/// examples:
/// "Resid 1" will select only the residue 1 of each chain
/// "Resid 12 to 50" will select residues 12, 13, .., 50 for all chains
/// "Resid 1" will select only the residue 1 of each chain
/// "Resid 12 to 50" will select residues 12, 13, .., 50 for all chains
///
/// ## "Backbone"
/// The Backbone keyword is used to select atoms in the backbone for each residues. It don't take parameters.
///
/// TODO: The methode is idiot and need to be improve.
/// ex: don't parse the chain if it's not selected
/// ## Special keyword "and"
/// You can use the keyword "and" to separate 2 or more differents selection.
/// examples:
/// "Chain A and Resid 40 to 150"
///
/// # Examples
///
/// ```
/// use pdbparser;
///
/// let my_prot = pdbparser::parse_pdb("src/tests_file/f2.pdb");
///
/// assert_eq!(66, my_prot.get_number_residue());
/// assert_eq!(1085, my_prot.get_number_atom());
///
/// let prot_backbone = my_prot.select_atoms("resid 10 to 50 and backbone").unwrap();
///
/// assert_eq!(41, prot_backbone.get_number_residue());
/// assert_eq!(164, prot_backbone.get_number_atom());
/// ```
// TODO: The methode is idiot and need to be improve.
// ex: don't parse the chain if it's not selected
pub
fn
select_atoms
(
&
self
,
pattern
:
&
str
)
->
Option
<
Protein
>
{
let
mut
n_prot
=
Protein
::
new
(
String
::
from
(
self
.name
.clone
()));
...
...
src/pdb/selection_atom.rs
View file @
823247e7
/// Structure enum for the different pattern keywords.
/// Chain(begin, end) for the selection of proteic chain with names
/// Resid(begin, end)
/// Backbone
#[derive(Debug,
PartialEq)]
pub
enum
Select
{
Chain
(
char
,
char
),
...
...
@@ -8,8 +13,6 @@ pub enum Select {
/// Parse option given for the selection of residues and return
/// the index of begin and end of select residues.
///
///
///
fn
parse_options_int
(
opt
:
&
[
&
str
])
->
Option
<
[
usize
;
2
]
>
{
// if the len is 1 mean that the request is like "Resid 1".
// return Some(1, 1)
...
...
@@ -66,8 +69,6 @@ pub fn parse_select(pattern: &str) -> Option<Vec<Select>> {
//
// Return None if there is a probleme in the pattern parsing
if
pattern
==
""
{
return
None
;
//selection empty
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment