Skip to content

Commit

Permalink
cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
rvhonorato committed Aug 13, 2024
1 parent 15edfb3 commit 855e910
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 27 deletions.
3 changes: 0 additions & 3 deletions src/air.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use core::panic;

use crate::interactor;

pub struct Air(Vec<interactor::Interactor>);
Expand Down Expand Up @@ -40,7 +38,6 @@ impl Air {
// let header = append_header(i);
// tbl.push_str(&header);

// TODO: Refactor this logic to also collect wildcards
let target_res = interactor::collect_residues(partners);
let block = interactor.create_block(target_res);
tbl.push_str(&block);
Expand Down
2 changes: 0 additions & 2 deletions src/interactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,6 @@ pub fn format_atom_string(atoms: &Option<Vec<String>>) -> String {
}
}

// pub fn format_oneline_assign_string()

#[cfg(test)]
mod tests {

Expand Down
43 changes: 21 additions & 22 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,22 @@ enum Commands {
},

Z {
#[arg(help = "Input file")]
#[arg(required = true, help = "Input file")]
input: String,
#[arg(
required = true,
help = "Filename of the output shape beads to be used in Z-restraints"
)]
output: String,
#[arg(long, required = true, help = "Group of residue indexes (can be specified multiple times)", value_parser = parse_residues, number_of_values = 1)]
residues: Vec<Vec<isize>>,
#[arg(help = "Spacing between two beads in Angstrom", default_value = "2.0")]
#[arg(
required = true,
help = "Spacing between two beads in Angstrom",
default_value = "2.0"
)]
grid_spacing: f64,
#[arg(help = "Size in xy dimension", default_value = "10")]
#[arg(required = true, help = "Size in xy dimension", default_value = "10")]
grid_size: usize,
},
}
Expand Down Expand Up @@ -90,11 +99,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
Commands::Z {
input,
output,
residues,
grid_size,
grid_spacing,
} => {
let _ = generate_z_restraints(input, residues, grid_size, grid_spacing);
let _ = generate_z_restraints(input, output, residues, grid_size, grid_spacing);
}
}

Expand Down Expand Up @@ -241,6 +251,7 @@ fn list_interface(input_file: &str, cutoff: &f64) -> Result<(), Box<dyn Error>>

fn generate_z_restraints(
input_file: &str,
output_file: &str,
selections: &[Vec<isize>],
grid_size: &usize,
grid_spacing: &f64,
Expand Down Expand Up @@ -273,19 +284,10 @@ fn generate_z_restraints(
(atoms1, atoms2) = structure::find_furthest_selections(selections, &pdb);
} else {
atoms1 = structure::get_atoms_from_resnumbers(&pdb, &selections[0]);
atoms2 = vec![pdbtbx::Atom::new(
false, // hetero
1, // serial_number
"CA", // atom_name
0.0, // x
0.0, // y
0.0, // z
1.0, // occupancy
0.0, // b_factor
"C", // element
0, // charge
)
.expect("Failed to create atom")];
atoms2 = vec![
pdbtbx::Atom::new(false, 1, "CA", 0.0, 0.0, 0.0, 1.0, 0.0, "C", 0)
.expect("Failed to create atom"),
];
}

// let z_axis = structure::calculate_z_axis(&atoms1, &atoms2);
Expand Down Expand Up @@ -326,7 +328,8 @@ fn generate_z_restraints(
all_beads.extend(grid_beads2);
// all_beads.extend(grid_beads3);

structure::write_beads_pdb(&all_beads, "z_beads.pdb")?;
// Write the beads to a PDB file
structure::write_beads_pdb(&all_beads, output_file)?;

let mut interactors: Vec<Interactor> = Vec::new();
let mut counter = 0;
Expand Down Expand Up @@ -363,10 +366,6 @@ fn generate_z_restraints(
});
});

// interactors.iter().for_each(|interactor| {
// println!("Interactor: {:?}", interactor);
// });

let air = Air::new(interactors);
let tbl = air.gen_tbl().unwrap();

Expand Down

0 comments on commit 855e910

Please sign in to comment.