本文整理汇总了C++中adcontrols::MassSpectrum::getMass方法的典型用法代码示例。如果您正苦于以下问题:C++ MassSpectrum::getMass方法的具体用法?C++ MassSpectrum::getMass怎么用?C++ MassSpectrum::getMass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类adcontrols::MassSpectrum
的用法示例。
在下文中一共展示了MassSpectrum::getMass方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: of
static void
calibresult_validation( const adcontrols::MSCalibrateResult& res
, const adcontrols::MassSpectrum& centroid
, double threshold )
{
const adcontrols::MSReferences& ref = res.references();
const adcontrols::MSAssignedMasses& assigned = res.assignedMasses();
std::ofstream of( "massassign.txt" );
of << "#\tm/z(observed)\ttof(us)\tintensity\t\tformula,\tm/z(exact)\tm/z(calibrated)\terror(mDa)" << std::endl;
adcontrols::MSReferences::vector_type::const_iterator refIt = ref.begin();
for ( adcontrols::MSAssignedMasses::vector_type::const_iterator it = assigned.begin(); it != assigned.end(); ++it, ++refIt ) {
const adcontrols::MSAssignedMass& a = *it;
std::string formula = adportable::string::convert( a.formula() );
of << std::setprecision(8)
<< std::setw(4) << a.idMassSpectrum() << "\t" // id
<< std::setw(15) << std::fixed << centroid.getMass( a.idMassSpectrum() ) << "\t" // m/z(observed)
<< std::scientific << centroid.getTime( a.idMassSpectrum() ) << "\t" // tof
<< std::fixed << std::setprecision( 0 ) << centroid.getIntensity( a.idMassSpectrum() ) << "\t" // intensity
<< formula << "\t"
<< std::setprecision(8) << std::fixed << it->exactMass() << "\t" // mass(exact)
<< std::fixed << a.mass() << "\t" // m/z(calibrated)
<< std::setprecision(1) << ( a.mass() - it->exactMass() ) * 1000 << "\t" // error(mDa)
<< ( it->enable() ? "used" : "not used" )
<< std::endl;
}
const std::vector<double>& coeffs = res.calibration().coeffs();
of << "#--------------------------- Calibration coefficients: " << std::endl;
for ( size_t i = 0; i < coeffs.size(); ++i )
of << std::scientific << std::setprecision(14) << coeffs[i] << std::endl;
of << "#--------------------------- centroid peak list (#,mass,intensity)--------------------------" << std::endl;
adcontrols::MSReferences::vector_type::const_iterator it = res.references().begin();
for ( size_t i = 0; i < centroid.size(); ++i ) {
if ( centroid.getIntensity( i ) > threshold ) {
double mq = adcontrols::MSCalibration::compute( res.calibration().coeffs(), centroid.getTime( i ) );
double mass = mq * mq;
double error = 0;
if ( it != res.references().end() && std::abs( it->exactMass() - mass ) < 0.2 ) {
error = ( it->exactMass() - mass ) * 1000; // mDa
++it;
}
of << i << "\t"
<< std::setprecision(8) << std::fixed << centroid.getMass( i ) << "\t"
<< std::setprecision(8) << mass << "\t"
<< std::setprecision(1) << centroid.getIntensityArray()[i] << std::endl;
}
}
}
示例2: if
//virtual
bool
datafile::getSpectrum( int fcn, size_t pos, adcontrols::MassSpectrum& ms, uint32_t objId ) const
{
(void)fcn;
try {
EDAL::IMSSpectrumCollectionPtr pSpectra = pAnalysis_->GetMSSpectrumCollection();
EDAL::IMSSpectrumPtr pSpectrum = pSpectra->GetItem( long(pos) + 1 ); // 1-origin
if ( pSpectrum->Polarity == EDAL::SpectrumPolarity::IonPolarity_Negative )
ms.setPolarity( adcontrols::MS_POLARITY::PolarityNegative );
else if ( pSpectrum->Polarity == EDAL::SpectrumPolarity::IonPolarity_Positive )
ms.setPolarity( adcontrols::MS_POLARITY::PolarityPositive );
else
ms.setPolarity( adcontrols::MS_POLARITY::PolarityIndeterminate );
adcontrols::MSProperty prop = ms.getMSProperty();
prop.setTimeSinceInjection( static_cast< unsigned long >( pSpectrum->RetentionTime /* sec */ * 1.0e6 ) ); // usec
ms.setMSProperty( prop ); // <- end of prop set
_variant_t vMasses, vIntens;
if ( objId <= 1 ) {
pSpectrum->GetMassIntensityValues( EDAL::SpectrumType_Profile, &vMasses, &vIntens );
ms.setCentroid( adcontrols::CentroidNone ); // profile
} else { // objId should be 2
pSpectrum->GetMassIntensityValues( EDAL::SpectrumType_Line, &vMasses, &vIntens );
ms.setCentroid( adcontrols::CentroidNative );
}
SafeArray sa_masses( vMasses );
ms.resize( sa_masses.size() );
ms.setMassArray( reinterpret_cast< const double *>( sa_masses.p() ) );
SafeArray sa_intensities( vIntens );
ms.setIntensityArray( reinterpret_cast< const double *>( sa_intensities.p() ) );
ms.setAcquisitionMassRange( ms.getMass( 0 ), ms.getMass( ms.size() - 1 ) );
return true;
} catch(_com_error& ex ) {
ADERROR() << std::wstring( ex.ErrorMessage() );
return false;
}
return false;
}
示例3: find
bool
MSChromatogramExtractor::impl::doMSLock( adcontrols::lockmass::mslock& mslock
, const adcontrols::MassSpectrum& centroid
, const adcontrols::MSLockMethod& m )
{
// TODO: consider how to handle segmented spectrum -- current impl is always process first
adcontrols::MSFinder find( m.tolerance( m.toleranceMethod() ), m.algorithm(), m.toleranceMethod() );
for ( auto& msref : msrefs_ ) {
size_t idx = find( centroid, msref.second );
if ( idx != adcontrols::MSFinder::npos )
mslock << adcontrols::lockmass::reference( msref.first, msref.second, centroid.getMass( idx ), centroid.getTime( idx ) );
}
if ( mslock.fit() ) {
// mslock( centroid, true );
return true;
}
return false;
}
示例4:
adcontrols::translate_state
DataInterpreter::translate_profile( adcontrols::MassSpectrum& ms
, const char * data, size_t dsize
, const char * meta, size_t msize
, const adcontrols::MassSpectrometer& spectrometer
, size_t idData ) const
{
(void)idData;
adportable::debug(__FILE__, __LINE__) << "translate_profile( dsize=" << dsize << ", msize=" << msize << ")";
import_profile profile;
import_continuum_massarray ma;
const batchproc::MassSpectrometer* pSpectrometer = dynamic_cast< const batchproc::MassSpectrometer * >( &spectrometer );
if ( pSpectrometer == 0 )
return adcontrols::translate_error;
if ( adportable::bzip2::is_a( data, dsize ) ) {
std::string ar;
adportable::bzip2::decompress( ar, data, dsize );
adportable::debug(__FILE__, __LINE__) << "translate_profile deserialize import_profile w/ decompress";
if ( ! adportable::serializer< import_profile >::deserialize( profile, ar.data(), ar.size() ) )
return adcontrols::translate_error;
} else {
adportable::debug(__FILE__, __LINE__) << "translate_profile deserialize import_profile w/o decompress";
if ( ! adportable::serializer< import_profile >::deserialize( profile, data, dsize ) )
return adcontrols::translate_error;
}
if ( meta && msize ) {
if ( adportable::bzip2::is_a( meta, msize ) ) {
std::string ar;
adportable::bzip2::decompress( ar, meta, msize );
if ( ! adportable::serializer< import_continuum_massarray >::deserialize( ma, ar.data(), ar.size() ) )
return adcontrols::translate_error;
} else {
if ( ! adportable::serializer< import_continuum_massarray >::deserialize( ma, meta, msize ) )
return adcontrols::translate_error;
}
}
adportable::debug(__FILE__, __LINE__) << "translate_profile checkpoint 3";
const import_continuum_massarray& continuum_massarray = meta ? ma : pSpectrometer->continuum_massarray();
ms.setMSProperty( profile.prop_ );
ms.setPolarity( profile.polarity_ );
ms.resize( profile.intensities_.size() );
adportable::debug(__FILE__, __LINE__) << "translate_profile checkpoint 4";
ms.setMassArray( continuum_massarray.masses_.data() );
auto intens = profile.intensities_.data();
for ( size_t i = 0; i < ms.size(); ++i )
ms.setIntensity( i, *intens++ );
adportable::debug(__FILE__, __LINE__) << "translate_profile checkpoint 5";
ms.setAcquisitionMassRange( ms.getMass( 0 ), ms.getMass( ms.size() - 1 ) );
adportable::debug(__FILE__, __LINE__) << "translate_profile checkpoint 6";
return adcontrols::translate_complete;
}