-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2b33e8
commit 54d7f65
Showing
2 changed files
with
89 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,21 @@ | ||
// use rustdf::data::handle::TimsDataHandle; | ||
use std::env; | ||
use std::path::Path; | ||
use rusqlite::{Connection, Result}; | ||
use rustdf::data::meta::{FrameMeta}; | ||
use rustdf::data::meta::{read_dda_precursor_info}; | ||
|
||
fn main() -> Result<()> { | ||
|
||
fn main() { | ||
let _args: Vec<String> = env::args().collect(); | ||
|
||
let data_path = "/media/hd01/CCSPred/M210115_001_Slot1-1_1_850.d"; | ||
// Connect to the database | ||
let db_path = Path::new(data_path).join("analysis.tdf"); | ||
let conn = Connection::open(db_path)?; | ||
|
||
// prepare the query | ||
let rows: Vec<&str> = vec!["Id", "Time", "ScanMode", "Polarity", "MsMsType", "TimsId", "MaxIntensity", "SummedIntensities", | ||
"NumScans", "NumPeaks", "MzCalibration", "T1", "T2", "TimsCalibration", "PropertyGroup", "AccumulationTime", "RampTime"]; | ||
let query = format!("SELECT {} FROM Frames", rows.join(", ")); | ||
|
||
// execute the query | ||
let frames_rows: Result<Vec<FrameMeta>, _> = conn.prepare(&query)?.query_map([], |row| { | ||
Ok(FrameMeta { | ||
id: row.get(0)?, | ||
time: row.get(1)?, | ||
scan_mode: row.get(2)?, | ||
polarity: row.get(3)?, | ||
ms_ms_type: row.get(4)?, | ||
tims_id: row.get(5)?, | ||
max_intensity: row.get(6)?, | ||
sum_intensity: row.get(7)?, | ||
num_scans: row.get(8)?, | ||
num_peaks: row.get(9)?, | ||
mz_calibration: row.get(10)?, | ||
t_1: row.get(11)?, | ||
t_2: row.get(12)?, | ||
tims_calibration: row.get(13)?, | ||
property_group: row.get(14)?, | ||
accumulation_time: row.get(15)?, | ||
ramp_time: row.get(16)?, | ||
}) | ||
})?.collect(); | ||
let result = read_dda_precursor_info(data_path); | ||
|
||
for row in frames_rows? { | ||
println!("FrameMeta: {:?}", row); | ||
match result { | ||
Ok(precursors) => { | ||
println!("Precursors: {:?}", precursors); | ||
}, | ||
Err(e) => { | ||
println!("Error: {:?}", e); | ||
} | ||
} | ||
|
||
// return the frames | ||
Ok(()) | ||
} |