Skip to content

Commit

Permalink
fix: review comment updates
Browse files Browse the repository at this point in the history
vijay-gnanasambandan-bruker committed Dec 21, 2023
1 parent 08cc654 commit fbbbdd3
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/file_readers/common/sql_reader.rs
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ impl SqlReader {
self.get_data_from_sql(&query)
}

fn get_data_from_sql<T: rusqlite::types::FromSql + Default>(
pub fn get_data_from_sql<T: rusqlite::types::FromSql + Default>(
&self,
query: &String,
) -> Vec<T> {
2 changes: 0 additions & 2 deletions src/file_readers/common/sql_reader/tables/pasef_frame_msms.rs
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@ pub struct PasefFrameMsMsTable {
pub mz_width: Vec<f64>,
pub collision_energy: Vec<f64>,
pub precursor: Vec<usize>,
pub collision_energy_by_precursor: Vec<f64>,
}

impl ReadableFromSql for PasefFrameMsMsTable {
@@ -29,7 +28,6 @@ impl ReadableFromSql for PasefFrameMsMsTable {
.read_column_from_table("CollisionEnergy", table_name),
precursor: sql_reader
.read_column_from_table("Precursor", table_name),
collision_energy_by_precursor: sql_reader.get_data_from_sql(&"select CollisionEnergy from PasefFrameMsMsInfo group by Precursor".to_string()),
}
}
}
9 changes: 7 additions & 2 deletions src/file_readers/spectrum_readers/dda_reader/precursors.rs
Original file line number Diff line number Diff line change
@@ -23,13 +23,18 @@ pub struct PrecursorReader {

impl PrecursorReader {
pub fn new(tdf_reader: &TDFReader) -> Self {
let select_collision_energy_sql = String::from(
"SELECT CollisionEnergy FROM PasefFrameMsMsInfo GROUP BY Precursor",
);
let pasef_frames: PasefFrameMsMsTable =
PasefFrameMsMsTable::from_sql(&tdf_reader.tdf_sql_reader);
let im_reader: Scan2ImConverter = tdf_reader.im_converter;
let precursor_table: PrecursorTable =
PrecursorTable::from_sql(&tdf_reader.tdf_sql_reader);
let retention_times: Vec<f64> = tdf_reader.frame_table.rt.clone();
let collision_energy = &pasef_frames.collision_energy_by_precursor;
let collision_energies = tdf_reader
.tdf_sql_reader
.get_data_from_sql(&select_collision_energy_sql);
let precursors: Vec<Precursor> = (0..precursor_table.mz.len())
.into_par_iter()
.map(|index| {
@@ -43,7 +48,7 @@ impl PrecursorReader {
intensity: precursor_table.intensity[index],
index: index + 1, //TODO?
frame_index: frame_id,
collision_energy: collision_energy[index],
collision_energy: collision_energies[index],
}
})
.collect();

0 comments on commit fbbbdd3

Please sign in to comment.