Skip to content

Commit

Permalink
better spectral library support
Browse files Browse the repository at this point in the history
  • Loading branch information
vdemichev committed Dec 18, 2019
1 parent ba89480 commit ba96b62
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
Binary file modified DIA-NN GUI manual.pdf
Binary file not shown.
Binary file modified DIA-NN-Setup.msi
Binary file not shown.
Binary file modified DiaNN.exe
Binary file not shown.
14 changes: 9 additions & 5 deletions src/diann.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3071,7 +3071,7 @@ class Library {
std::vector<std::string> genes;
int skipped = 0;
double iRT_min = 0.0, iRT_max = 0.0;
bool fragment_info = false, gen_decoys = true, gen_charges = true, infer_proteotypicity = true, from_speclib = false;
bool gen_decoys = true, gen_charges = true, infer_proteotypicity = true, from_speclib = false;

std::map<std::string, int> eg;
std::vector<int> elution_groups; // same length as entries, indices of the elution groups
Expand Down Expand Up @@ -3796,7 +3796,7 @@ class Library {
}

int i, cnt = 0;
bool ftw = false, flw = false;
bool ftw = false, flw = false, fragment_info = false, fragment_type = false;
std::map<std::string, Entry> map;
Entry e; e.lib = this;

Expand Down Expand Up @@ -3843,6 +3843,7 @@ class Library {
if (jt->find(words[i]) != std::string::npos) {
int ind = std::distance(library_headers.begin(), jt);
if (colInd[ind] < 0) colInd[ind] = i;
else if (words[colInd[ind]].size() < words[i].size()) colInd[ind] = i;
break;
}
}
Expand All @@ -3854,20 +3855,23 @@ class Library {
if (colInd[libPT] >= 0) infer_proteotypicity = false;
if (colInd[libFrCharge] >= 0) {
gen_charges = false;
if (colInd[libFrType] >= 0 && colInd[libFrNumber] >= 0 && colInd[libFrLoss] >= 0) fragment_info = true;
if (colInd[libFrType] >= 0) {
fragment_type = true;
if (colInd[libFrNumber] >= 0 && colInd[libFrLoss] >= 0) fragment_info = true;
}
}
continue;
}

Product p(std::stof(words[colInd[libFrMz]]), std::stof(words[colInd[libFrI]]), (!gen_charges ? std::stof(words[colInd[libFrCharge]]) : 1));
if (fragment_info) {
if (fragment_type) {
auto &wt = words[colInd[libFrType]];
if (wt.size()) {
if (wt[0] == 'y') p.type = type_y;
else if (wt[0] == 'b') p.type = type_b;
else if (!ftw) ftw = true, std::cout << "WARNING: unknown fragment type " << wt << "\n";
}
if (p.type > type_unknown) {
if (p.type > type_unknown && fragment_info) {
p.index = std::stoi(words[colInd[libFrNumber]]);
if (p.type != type_b) p.index = peptide_length(words[colInd[libPr]]) - p.index;
auto &wl = words[colInd[libFrLoss]];
Expand Down

0 comments on commit ba96b62

Please sign in to comment.