31#include "../../../../utils.h"
32#include "../../../../pappsoexception.h"
33#include "../../../../processing/project/projectparameters.h"
34#include "../../../../exception/exceptionnotrecognized.h"
42 const QFileInfo &sage_json_file)
43 : m_sageJsonFile(sage_json_file)
55 QDir::setCurrent(sage_json_file.absolutePath());
64 QObject::tr(
"reading Sage json file %1").arg(sage_json_file.absoluteFilePath()));
90 .arg(other_err.
qwhat()));
103 QFile mfile(m_sageJsonFile.absoluteFilePath());
104 if(!mfile.open(QFile::ReadOnly))
107 QObject::tr(
"Unable to read Sage JSON file %1").arg(m_sageJsonFile.absoluteFilePath()));
109 QByteArray iContents = mfile.readAll();
111 QJsonParseError parseError;
112 m_jsonData = QJsonDocument::fromJson(iContents, &parseError);
113 if(parseError.error != QJsonParseError::NoError)
116 .arg(m_sageJsonFile.absoluteFilePath())
117 .arg(parseError.offset)
118 .arg(parseError.errorString()));
121 QJsonValue mzml_value = m_jsonData.object().value(
"mzml_paths");
123 if(mzml_value.isNull())
126 QObject::tr(
"Sage JSON file %1 does not contain mzml_paths")
127 .arg(m_sageJsonFile.absoluteFilePath()));
129 for(
const QJsonValue &value : m_jsonData.object().value(
"mzml_paths").toArray())
131 qDebug() << value.toString();
134 m_mapFilePath2MsRunSp.insert(
135 {QFileInfo(value.toString()).fileName(), QFileInfo(value.toString()).absoluteFilePath()});
139 m_sageVersion = m_jsonData.object().value(
"version").toString();
142 QJsonObject sage_object = m_jsonData.object();
145 QJsonObject database = sage_object.value(
"database").toObject();
147 m_decoyTag = database.value(
"decoy_tag").toString();
148 m_generateDecoy = database.value(
"generate_decoy").toBool();
149 m_targetFastaFile << database.value(
"fasta").toString();
162 auto it = m_mapFilePath2MsRunSp.find(msrun_filename);
163 if(it != m_mapFilePath2MsRunSp.end())
excetion to use when an item type is not recognized
virtual const QString & qwhat() const
virtual void setStatus(const QString &status)=0
current status of the process
static QString getVersion()
void writeInformations(const QString &software_name, const QString &software_version, const QString &type, const QString &operation)
void writeArray(const std::vector< std::size_t > &int_list)
SageFileReader(pappso::UiMonitorInterface *p_monitor, pappso::cbor::CborStreamWriter *p_output, const QFileInfo &sage_json_file)
pappso::cbor::CborStreamWriter * mp_cborWriter
QStringList m_targetFastaFile
QString getMsRunSpWithFileName(const QString &msrun_filename) const
const QJsonDocument & getJsonDocument() const
virtual ~SageFileReader()
const QFileInfo m_sageJsonFile