Skip to content

Commit f93ce92

Browse files
committed
add parser
1 parent ea4d4e2 commit f93ce92

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

src-tauri/src/processor/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ mod aggregator;
1616
mod executor;
1717
mod helpers;
1818
mod peptide_isolator;
19+
mod parser;
1920

2021
pub async fn handle(
2122
should_remove_na_calculations: bool,

src-tauri/src/processor/parser.rs

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
use std::path::Path;
2+
use csv::ReaderBuilder;
3+
use tokio::fs;
4+
use tokio::fs::File;
5+
use tokio::io::{AsyncSeekExt, AsyncWriteExt};
6+
7+
8+
pub type Day = u64;
9+
10+
pub type Label = String;
11+
12+
pub struct Protein {
13+
pub name: String,
14+
pub peptide: String,
15+
pub charge_mass_ratio: f64,
16+
pub insensities: Vec<Option<u64>>,
17+
}
18+
19+
pub async fn parse(spreadsheet: &Path)
20+
-> Result<
21+
(Vec<Day>, Vec<Label>, Vec<Protein>),
22+
Box<dyn std::error::Error>
23+
>
24+
{
25+
let mut file = File::open(spreadsheet).await?;
26+
let mut rdr = ReaderBuilder::new()
27+
.has_headers(false)
28+
.from_reader(file.seek(1));
29+
30+
31+
}

0 commit comments

Comments
 (0)