Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
i2MassChroQ
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Admin message
A compter du 1er avril, attention à vos pipelines :
Nouvelles limitations de Docker Hub
Show more breadcrumbs
PAPPSO
i2MassChroQ
Commits
d52484ba
Commit
d52484ba
authored
7 years ago
by
Langella Olivier
Browse files
Options
Downloads
Patches
Plain Diff
new function to extract XIC
parent
be7fe69b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/utils/readspectrum.cpp
+69
-15
69 additions, 15 deletions
src/utils/readspectrum.cpp
src/utils/readspectrum.h
+2
-0
2 additions, 0 deletions
src/utils/readspectrum.h
src/utils/types.h
+9
-0
9 additions, 0 deletions
src/utils/types.h
with
80 additions
and
15 deletions
src/utils/readspectrum.cpp
+
69
−
15
View file @
d52484ba
...
...
@@ -47,6 +47,8 @@ pwiz::msdata::MSDataFile * getPwizMSDataFile(const QString & filename);
pappso
::
QualifiedSpectrum
getQualifiedSpectrumFromPwizMSDataFile
(
pwiz
::
msdata
::
MSDataFile
*
p_ms_data_file
,
unsigned
int
scan_num
);
void
getXicFromPwizMSDataFile
(
pwiz
::
msdata
::
MSDataFile
*
p_mzdata
,
pappso
::
Xic
*
p_xic
,
const
pappso
::
MassRange
&
mass_range
,
XixExtactMethod
method
);
pwiz
::
msdata
::
MSDataFile
*
getPwizMSDataFile
(
const
QString
&
filename
)
{
qDebug
()
<<
"getPwizMSDataFile opening file "
<<
filename
;
...
...
@@ -76,22 +78,62 @@ pwiz::msdata::MSDataFile * getPwizMSDataFile(const QString & filename) {
return
dataFile
;
}
/*
MzFormat getPwizMSDataFileFormat(pwiz::msdata::MSDataFile * p_ms_data_file) {
pwiz::msdata::CVID native_id_format = pwiz::msdata::MSData::getDefaultNativeIDFormat(*p_ms_data_file);
if (native_id_format == pwiz::cv::CVID::MS_Mascot_MGF_format) {
return MzFormat::MGF;
}
if (native_id_format == pwiz::cv::CVID::MS_mzML_format) {
return MzFormat::mzML;
}
if (native_id_format == pwiz::cv::CVID::MS_ISB_mzXML_format) {
return MzFormat::mzXML;
void
getXicFromPwizMSDataFile
(
pwiz
::
msdata
::
MSDataFile
*
p_ms_data_file
,
pappso
::
Xic
*
p_xic
,
const
pappso
::
MassRange
&
mass_range
,
XixExtactMethod
method
)
{
std
::
string
env
;
env
=
setlocale
(
LC_ALL
,
""
);
setlocale
(
LC_ALL
,
"C"
);
const
pwiz
::
msdata
::
SpectrumList
*
p_spectrum_list
=
p_ms_data_file
->
run
.
spectrumListPtr
.
get
();
std
::
size_t
spectrum_list_size
=
p_spectrum_list
->
size
();
pwiz
::
msdata
::
SpectrumPtr
spectrum
;
XicElement
peak
;
for
(
std
::
size_t
i
=
0
;
i
<
spectrum_list_size
;
i
++
)
{
spectrum
=
p_spectrum_list
->
spectrum
(
i
,
false
);
unsigned
int
ms_level
(
QString
(
spectrum
->
cvParam
(
pwiz
::
msdata
::
MS_ms_level
).
value
.
c_str
()).
toUInt
());
if
(
ms_level
==
1
)
{
spectrum
=
p_spectrum_list
->
spectrum
(
i
,
true
);
peak
.
rt
=
QString
(
spectrum
->
scanList
.
scans
[
0
].
cvParam
(
pwiz
::
msdata
::
MS_scan_start_time
).
value
.
c_str
()).
toDouble
();
peak
.
intensity
=
0
;
vector
<
pwiz
::
msdata
::
MZIntensityPair
>
pairs
;
spectrum
->
getMZIntensityPairs
(
pairs
);
// iterate through the m/z-intensity pairs
for
(
vector
<
pwiz
::
msdata
::
MZIntensityPair
>::
const_iterator
it
=
pairs
.
begin
(),
end
=
pairs
.
end
();
it
!=
end
;
++
it
)
{
//qDebug() << "it->mz " << it->mz << " it->intensity" << it->intensity;
if
(
mass_range
.
contains
(
it
->
mz
)){
if
(
method
==
XixExtactMethod
::
max
)
{
if
(
peak
.
intensity
<
it
->
intensity
)
{
peak
.
intensity
=
it
->
intensity
;
}
}
else
{
peak
.
intensity
+=
it
->
intensity
;
}
}
}
p_xic
->
push_back
(
peak
);
}
}
throw pappso::PappsoException(QObject::tr(" pwiz::msdata::CVID native_id_format %1 not found").arg(native_id_format));
return MzFormat::unknown;
setlocale
(
LC_ALL
,
env
.
c_str
());
}
*/
pappso
::
QualifiedSpectrum
getQualifiedSpectrumFromPwizMSDataFile
(
pwiz
::
msdata
::
MSDataFile
*
p_ms_data_file
,
unsigned
int
scan_num
)
{
unsigned
int
precursor_charge_state
=
0
;
...
...
@@ -273,7 +315,7 @@ void SpectrumStore::checkMsRunStatistics(MsRunSp msrun) {
unsigned
int
msLevel
(
QString
(
spectrum
->
cvParam
(
pwiz
::
msdata
::
MS_ms_level
).
value
.
c_str
()).
toUInt
());
count_mslevel
[
msLevel
]
++
;
}
msrun
.
get
()
->
setMsRunStatistics
(
MsRunStatistics
::
total_spectra
,
(
unsigned
int
)
spectrum_list_size
);
msrun
.
get
()
->
setMsRunStatistics
(
MsRunStatistics
::
total_spectra_ms1
,
(
unsigned
int
)
count_mslevel
[
1
]);
msrun
.
get
()
->
setMsRunStatistics
(
MsRunStatistics
::
total_spectra_ms2
,
(
unsigned
int
)
count_mslevel
[
2
]);
...
...
@@ -324,3 +366,15 @@ pappso::SpectrumSp SpectrumStore::getSpectrumSpFromMsRunSp(MsRunSp msrun, unsign
return
spectrum
.
getOriginalSpectrumSp
();
}
pappso
::
XicSp
SpectrumStore
::
getXicSpFromMsRunSp
(
MsRunSp
msrun
,
const
pappso
::
MassRange
&
mass_range
,
XixExtactMethod
method
)
{
pwiz
::
msdata
::
MSDataFile
*
p_msdatafile
=
findPwizMSDataFile
(
msrun
);
XicSp
xic_sp
;
if
(
p_msdatafile
==
nullptr
)
{
Xix
xic
;
getXicFromPwizMSDataFile
(
p_msdatafile
,
&
xic
,
mass_range
,
method
);
xic_sp
=
xic
.
makeXicSp
();
}
return
(
xic_sp
);
}
This diff is collapsed.
Click to expand it.
src/utils/readspectrum.h
+
2
−
0
View file @
d52484ba
...
...
@@ -26,6 +26,7 @@
#include
<QString>
#include
<pappsomspp/spectrum/qualifiedspectrum.h>
#include
<pappsomspp/xic/xic.h>
#include
<map>
#include
"../core/msrun.h"
...
...
@@ -42,6 +43,7 @@ class MSDataFile;
class
SpectrumStore
{
public:
static
pappso
::
SpectrumSp
getSpectrumSpFromMsRunSp
(
MsRunSp
msrun
,
unsigned
int
scan_num
);
static
pappso
::
XicSp
getXicSpFromMsRunSp
(
MsRunSp
msrun
,
const
pappso
::
MassRange
&
mass_range
,
XixExtactMethod
method
);
/** @brief try to find MS run statistics
*/
static
void
checkMsRunStatistics
(
MsRunSp
msrun
);
...
...
This diff is collapsed.
Click to expand it.
src/utils/types.h
+
9
−
0
View file @
d52484ba
...
...
@@ -88,6 +88,15 @@ enum class MsRunStatistics: std::int8_t {
/** \def XixExtactMethod method to extract Xic
*
*/
enum
class
XixExtactMethod
{
sum
,
///< sum of intensities
max
///< maximum of intensities
};
/** \def ProjectMode separate each samples or combine all
*
*/
...
...
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