32#include <odsstream/tsvreader.h>
33#include <odsstream/odsexception.h>
44 const QString &sage_json_file)
77 const QString &sequence_in)
79 QString accession = description_in.split(
" ", Qt::SkipEmptyParts).at(0);
82 const PsmProtein &psm_protein =
mp_self->m_psmProteinMap.getByAccession(accession);
83 psm_protein.
protein_sp.get()->setSequence(sequence_in);
84 psm_protein.
protein_sp.get()->setDescription(description_in);
92 const PsmProtein &psm_protein =
mp_self->m_psmProteinMap.getByAccession(accession);
93 psm_protein.
protein_sp.get()->setSequence(sequence_in);
94 psm_protein.
protein_sp.get()->setDescription(description_in);
116 QFileInfo tsv_file_info(tsv_url.toLocalFile());
117 if(!tsv_url.isLocalFile())
124 TsvReader tsv_reader(handler);
126 QFile tsv_file(tsv_file_info.absoluteFilePath());
127 tsv_reader.parse(tsv_file);
130 catch(OdsException &error_ods)
133 .arg(tsv_file_info.absoluteFilePath())
134 .arg(error_ods.qwhat()));
142 reader.
parse(fastaFile);
155 catch(OdsException &error_ods)
158 .arg(tsv_file_info.absoluteFilePath())
159 .arg(error_ods.qwhat()));
169 QJsonObject sage_object = json_doc.object();
170 QJsonValue json_mzml_path_list = sage_object.value(
"mzml_paths");
171 if(json_mzml_path_list.isUndefined())
177 for(
auto path_mzml : json_mzml_path_list.toArray())
188 if(file_path.endsWith(file_msrun))
192 QObject::tr(
"MS run %1 not found in Sage json document").append(file_msrun));
200 QJsonObject sage_object = json_doc.object();
201 QJsonValue output_path = sage_object.value(
"output_paths");
202 if(output_path.isUndefined())
207 if(!output_path.isArray())
211 for(
auto element : output_path.toArray())
213 if(element.isString())
215 if(element.toString().endsWith(
".tsv"))
217 path = element.toString();
228 QJsonObject sage_object = json_doc.object();
229 QJsonValue database = sage_object.value(
"database");
230 if(database.isUndefined())
234 path = database.toObject().value(
"fasta").toString();
243std::vector<pappso::cbor::psm::SageReader::SageModification>
246 std::vector<SageReader::SageModification> list;
248 QJsonValue database = sage_object.value(
"database");
249 if(database.isUndefined())
254 QJsonValue static_mods = database.toObject().value(
"static_mods");
255 if(static_mods.isUndefined())
259 for(QString residue_str : static_mods.toObject().keys())
262 modif.
residue = residue_str.at(0);
265 static_mods.toObject().value(residue_str).toDouble());
267 QString::number(static_mods.toObject().value(residue_str).toDouble(),
'f', 6);
280 list.push_back(modif);
285std::vector<pappso::cbor::psm::SageReader::SageModification>
288 std::vector<SageReader::SageModification> list;
290 QJsonValue database = sage_object.value(
"database");
291 if(database.isUndefined())
296 QJsonValue var_mods = database.toObject().value(
"variable_mods");
297 if(var_mods.isUndefined())
301 for(QString residue_str : var_mods.toObject().keys())
304 modif.
residue = residue_str.at(0);
305 for(QJsonValue one_mass : var_mods.toObject().value(residue_str).toArray())
322 list.push_back(modif);
333 QJsonValue database = sage_object.value(
"database");
334 if(database.isUndefined())
338 path = database.toObject().value(
"decoy_tag").toString();
pappso_double getMass() const
void parse(QFile &fastaFile)
static AaModificationP guessAaModificationPbyMonoisotopicMassDelta(Enums::AminoAcidChar aa, pappso_double mass)
overrides QCborStreamWriter base class to provide convenient functions
void setSequence(const QString &description_in, const QString &sequence_in) override
FastaSeq(SageReader *self)
PsmProteinMap m_psmProteinMap
const QString & getMzmlPath(const QString &file_msrun) const
SageReader(pappso::UiMonitorInterface *p_monitor, pappso::cbor::CborStreamWriter *p_output, const SageFileReader &sage_file_reader, const QString &sage_json_file)
std::vector< SageModification > getStaticModificationList() const
QStringList m_mzmlPathList
pappso::cbor::CborStreamWriter * mp_cborWriter
const QString & getmJsonAbsoluteFilePath() const
void extractMzmlPathList(const QJsonDocument &json_doc)
pappso::cbor::CborStreamWriter & getCborStreamWriter() const
QString m_jsonAbsoluteFilePath
const SageFileReader & m_sageFileReader
std::vector< SageModification > getVariableModificationList() const
QString getFastaFilePath(const QJsonDocument &json_doc)
QString getDecoyTag() const
const SageFileReader & getSageFileReader() const
QString getTsvFilePath(const QJsonDocument &json_doc)
pappso::UiMonitorInterface * mp_monitor
std::shared_ptr< Protein > protein_sp
pappso::AaModificationP modification