Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
xtpcpp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PAPPSO
xtpcpp
Commits
15873227
Commit
15873227
authored
7 years ago
by
Langella Olivier
Browse files
Options
Downloads
Patches
Plain Diff
preparing PTM spectra sheet
parent
4679a827
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/output/ods/ptm/ptmspectrasheet.cpp
+145
-21
145 additions, 21 deletions
src/output/ods/ptm/ptmspectrasheet.cpp
src/output/ods/ptm/ptmspectrasheet.h
+11
-4
11 additions, 4 deletions
src/output/ods/ptm/ptmspectrasheet.h
with
156 additions
and
25 deletions
src/output/ods/ptm/ptmspectrasheet.cpp
+
145
−
21
View file @
15873227
...
...
@@ -28,32 +28,156 @@
******************************************************************************/
#include
"ptmspectrasheet.h"
#include
<tuple>
#include
<pappsomspp/utils.h>
PtmSpectraSheet
::
PtmSpectraSheet
(
OdsExport
*
p_ods_export
,
CalcWriterInterface
*
p_writer
,
const
Project
*
p_project
,
const
QString
&
sheet_name
)
:
_p_project
(
p_project
)
{
_p_ods_export
=
p_ods_export
;
_p_writer
=
p_writer
;
p_writer
->
writeSheet
(
sheet_name
);
std
::
vector
<
IdentificationGroup
*>
identification_list
=
p_project
->
getIdentificationGroupList
();
for
(
IdentificationGroup
*
p_ident
:
identification_list
)
{
//writeHeaders(p_ident);
writeIdentificationGroup
(
p_ident
);
}
}
PtmSpectraSheet
::
PtmSpectraSheet
(
OdsExport
*
p_ods_export
,
CalcWriterInterface
*
p_writer
,
const
Project
*
p_project
)
:
PtmSpectraSheet
(
p_ods_export
,
p_writer
,
p_project
,
QString
(
"PTM spectra"
))
{
}
void
PtmSpectraSheet
::
writeCellHeader
(
PeptideListColumn
column
)
{
qDebug
()
<<
__FILE__
<<
" "
<<
__FUNCTION__
<<
" "
<<
__LINE__
;
_p_writer
->
setCellAnnotation
(
PeptideTableModel
::
getDescription
(
column
));
_p_writer
->
writeCell
(
PeptideTableModel
::
getTitle
(
column
));
qDebug
()
<<
__FILE__
<<
" "
<<
__FUNCTION__
<<
" "
<<
__LINE__
;
}
void
PtmSpectraSheet
::
writeHeaders
(
IdentificationGroup
*
p_ident
)
{
// Group ID Peptide ID Sample Scan Rt (minutes) Sequence (top) Modifs (top) Number of subgroups Sub-groups Ids Best E-value Best hyperscore m/z Obs Charge MH+ Obs MH+ theo DeltaMH+ Delta-ppm
//MS Sample : 20120906_balliau_extract_1_A01_urnb-1
const
std
::
vector
<
MsRunSp
>
msrun_list
=
p_ident
->
getMsRunSpList
();
if
(
msrun_list
.
size
()
==
1
)
{
_p_writer
->
writeCell
(
"sample"
);
_p_writer
->
writeLine
();
_p_writer
->
writeCell
(
msrun_list
[
0
].
get
()
->
getSampleName
());
_p_writer
->
writeLine
();
}
_p_writer
->
writeLine
();
_p_writer
->
writeCell
(
"Group ID"
);
_p_writer
->
writeCell
(
"Peptide ID"
);
_p_writer
->
setCellAnnotation
(
"MS sample name (MS run)"
);
_p_writer
->
writeCell
(
"Sample"
);
_p_writer
->
writeCell
(
"Scan"
);
_p_writer
->
setCellAnnotation
(
"retention time in seconds"
);
_p_writer
->
writeCell
(
"Rt (seconds)"
);
_p_writer
->
setCellAnnotation
(
"experimental precursor m/z"
);
_p_writer
->
writeCell
(
"Precursor m/z"
);
_p_writer
->
setCellAnnotation
(
"peptide sequence (best match)"
);
_p_writer
->
writeCell
(
"Sequence (top)"
);
_p_writer
->
setCellAnnotation
(
"peptide charge (best match)"
);
_p_writer
->
writeCell
(
"Charge (top)"
);
_p_writer
->
setCellAnnotation
(
"peptide modifications (best match)"
);
_p_writer
->
writeCell
(
"Modifs (top)"
);
if
(
_p_project
->
getLabelingMethodSp
().
get
()
!=
nullptr
)
{
_p_writer
->
setCellAnnotation
(
"peptide label (best match)"
);
_p_writer
->
writeCell
(
"Label (top)"
);
}
_p_writer
->
writeCell
(
"Best E-value"
);
_p_writer
->
writeCell
(
"Best hyperscore"
);
writeCellHeader
(
PeptideListColumn
::
delta_mhplus
);
}
void
PtmSpectraSheet
::
writeBestPeptideEvidence
(
const
GroupingGroup
*
p_group
,
const
PeptideEvidence
*
p_peptide_evidence
)
{
_p_writer
->
writeLine
();
unsigned
int
group_number
=
p_peptide_evidence
->
getGrpPeptideSp
().
get
()
->
getGroupNumber
();
unsigned
int
rank_number
=
p_peptide_evidence
->
getGrpPeptideSp
().
get
()
->
getRank
();
_p_ods_export
->
setEvenOrOddStyle
(
group_number
,
_p_writer
);
_p_writer
->
writeCell
(
pappso
::
Utils
::
getLexicalOrderedString
(
group_number
));
_p_ods_export
->
setEvenOrOddStyle
(
rank_number
,
_p_writer
);
_p_writer
->
writeCell
(
p_peptide_evidence
->
getGrpPeptideSp
().
get
()
->
getGroupingId
());
_p_writer
->
clearTableCellStyleRef
();
_p_writer
->
writeCell
(
p_peptide_evidence
->
getMsRunP
()
->
getSampleName
());
_p_writer
->
writeCell
(
p_peptide_evidence
->
getScan
());
_p_writer
->
writeCell
(
p_peptide_evidence
->
getRetentionTime
());
_p_writer
->
writeCell
(
p_peptide_evidence
->
getExperimentalMz
());
_p_writer
->
writeCell
(
p_peptide_evidence
->
getPeptideXtpSp
().
get
()
->
getSequence
());
_p_writer
->
writeCell
(
p_peptide_evidence
->
getCharge
());
_p_writer
->
writeCell
(
p_peptide_evidence
->
getPeptideXtpSp
().
get
()
->
getModifString
());
if
(
_p_project
->
getLabelingMethodSp
().
get
()
!=
nullptr
)
{
const
Label
*
p_label
=
p_peptide_evidence
->
getPeptideXtpSp
().
get
()
->
getLabel
();
if
(
p_label
!=
nullptr
)
{
_p_writer
->
writeCell
(
p_label
->
getXmlId
());
}
else
{
_p_writer
->
writeEmptyCell
();
}
}
_p_writer
->
writeCell
(
p_peptide_evidence
->
getEvalue
());
_p_writer
->
writeCell
(
p_peptide_evidence
->
getParam
(
PeptideEvidenceParam
::
tandem_hyperscore
).
toDouble
());
_p_writer
->
writeCell
(
p_peptide_evidence
->
getDeltaMass
());
PtmSpectraSheet
::
PtmSpectraSheet
(
OdsExport
*
p_ods_export
,
CalcWriterInterface
*
p_writer
,
const
Project
*
p_project
)
:
SpectraSheet
(
p_ods_export
,
p_writer
,
p_project
,
QString
(
"PTM spectra"
))
{
qDebug
()
<<
"PtmSpectraSheet::PtmSpectraSheet begin"
;
qDebug
()
<<
"PtmSpectraSheet::PtmSpectraSheet end"
;
}
void
PtmSpectraSheet
::
writeIdentificationGroup
(
IdentificationGroup
*
p_ident
)
{
qDebug
()
<<
__FILE__
<<
" "
<<
__FUNCTION__
<<
" "
<<
__LINE__
;
_p_ptm_grouping_experiment
=
p_ident
->
getPtmGroupingExperiment
();
qDebug
()
<<
"PtmIslandSheet::writeIdentificationGroup getPtmIslandList"
;
std
::
vector
<
PtmIslandSp
>
ptm_island_list
;
for
(
auto
ptm_island_sp
:
_p_ptm_grouping_experiment
->
getPtmIslandList
()
)
{
qDebug
()
<<
"PtmIslandSheet::writeIdentificationGroup getPtmIslandList copy"
;
ptm_island_list
.
push_back
(
ptm_island_sp
);
}
qDebug
()
<<
"PtmIslandSheet::writeIdentificationGroup sort"
;
std
::
sort
(
ptm_island_list
.
begin
(),
ptm_island_list
.
end
(),
[](
PtmIslandSp
&
a
,
PtmIslandSp
&
b
)
{
return
a
.
get
()
->
getGroupingId
()
<
b
.
get
()
->
getGroupingId
();
});
qDebug
()
<<
"PtmIslandSheet::writeIdentificationGroup 2"
;
for
(
auto
&
ptm_island
:
ptm_island_list
)
{
writeOnePtmIsland
(
ptm_island
);
writeHeaders
(
p_ident
);
for
(
const
std
::
pair
<
unsigned
int
,
GroupingGroupSp
>
&
group_pair
:
p_ident
->
getGroupStore
().
getGroupMap
())
{
std
::
vector
<
const
PeptideEvidence
*>
peptide_evidence_list
=
group_pair
.
second
.
get
()
->
getPeptideEvidenceList
();
std
::
sort
(
peptide_evidence_list
.
begin
(),
peptide_evidence_list
.
end
(),
[](
const
PeptideEvidence
*
a
,
const
PeptideEvidence
*
b
)
{
unsigned
int
arank
=
a
->
getGrpPeptideSp
().
get
()
->
getRank
();
unsigned
int
ascan
=
a
->
getScan
();
unsigned
int
brank
=
b
->
getGrpPeptideSp
().
get
()
->
getRank
();
unsigned
int
bscan
=
b
->
getScan
();
return
std
::
tie
(
arank
,
a
->
getMsRunP
()
->
getSampleName
(),
ascan
)
<
std
::
tie
(
brank
,
b
->
getMsRunP
()
->
getSampleName
(),
bscan
);
});
const
PeptideEvidence
*
p_best_peptide_evidence
=
nullptr
;
for
(
auto
&
peptide_evidence
:
peptide_evidence_list
)
{
if
(
p_best_peptide_evidence
==
nullptr
)
{
p_best_peptide_evidence
=
peptide_evidence
;
}
//change spectra :
unsigned
int
arank
=
p_best_peptide_evidence
->
getGrpPeptideSp
().
get
()
->
getRank
();
unsigned
int
ascan
=
p_best_peptide_evidence
->
getScan
();
unsigned
int
brank
=
peptide_evidence
->
getGrpPeptideSp
().
get
()
->
getRank
();
unsigned
int
bscan
=
peptide_evidence
->
getScan
();
if
(
std
::
tie
(
arank
,
p_best_peptide_evidence
->
getMsRunP
()
->
getSampleName
(),
ascan
)
!=
std
::
tie
(
brank
,
peptide_evidence
->
getMsRunP
()
->
getSampleName
(),
bscan
))
{
//write p_best_peptide_match
writeBestPeptideEvidence
(
group_pair
.
second
.
get
(),
p_best_peptide_evidence
);
p_best_peptide_evidence
=
peptide_evidence
;
}
else
{
if
(
p_best_peptide_evidence
->
getEvalue
()
>
peptide_evidence
->
getEvalue
())
{
p_best_peptide_evidence
=
peptide_evidence
;
}
}
}
if
(
p_best_peptide_evidence
!=
nullptr
)
{
writeBestPeptideEvidence
(
group_pair
.
second
.
get
(),
p_best_peptide_evidence
);
}
}
_p_writer
->
writeLine
();
_p_writer
->
writeLine
();
qDebug
()
<<
__FILE__
<<
" "
<<
__FUNCTION__
<<
" "
<<
__LINE__
;
}
This diff is collapsed.
Click to expand it.
src/output/ods/ptm/ptmspectrasheet.h
+
11
−
4
View file @
15873227
...
...
@@ -36,16 +36,23 @@
#include
"../odsexport.h"
#include
"../spectrasheet.h"
class
PtmSpectraSheet
:
public
SpectraSheet
class
PtmSpectraSheet
{
public
:
PtmSpectraSheet
(
OdsExport
*
p_ods_export
,
CalcWriterInterface
*
p_writer
,
const
Project
*
p_project
);
protected
:
void
writeIdentificationGroup
(
IdentificationGroup
*
p_ident
);
PtmSpectraSheet
(
OdsExport
*
p_ods_export
,
CalcWriterInterface
*
p_writer
,
const
Project
*
p_project
,
const
QString
&
sheet_name
);
virtual
void
writeIdentificationGroup
(
IdentificationGroup
*
p_ident
);
void
writeHeaders
(
IdentificationGroup
*
p_ident
);
void
writeBestPeptideEvidence
(
const
GroupingGroup
*
p_group
,
const
PeptideEvidence
*
p_peptide_evidence
);
void
writeCellHeader
(
PeptideListColumn
column
);
protected:
protected
:
OdsExport
*
_p_ods_export
;
const
PtmGroupingExperiment
*
_p_ptm_grouping_experiment
;
const
Project
*
_p_project
;
CalcWriterInterface
*
_p_writer
;
};
#endif // PTMSPECTRASHEET_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment