Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/master' into lrGS_Methyl…
Browse files Browse the repository at this point in the history
…artist
  • Loading branch information
leonschuetz committed Jan 14, 2025
2 parents 4f2fcd1 + 7462907 commit 77ee12e
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 40 deletions.
7 changes: 6 additions & 1 deletion src/GSvar/ProcessingSystemWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,17 @@ void ProcessingSystemWidget::updateGUI()
//###target region infos###
try
{
BedFile roi = GlobalServiceProvider::database().processingSystemRegions(sys_id_, false);
BedFile roi = GlobalServiceProvider::database().processingSystemRegions(sys_id_, true);
if (!roi.isEmpty())
{
ui_.roi_bases->setText(QString::number(roi.baseCount(), 'f', 0));
ui_.roi_regions->setText(QString::number(roi.count(), 'f', 0));
}
else
{
ui_.roi_bases->setText("n/a");
ui_.roi_regions->setText("n/a");
}
}
catch (Exception& e)
{
Expand Down
2 changes: 1 addition & 1 deletion src/cppNGSD-TEST/NGSD_Test.h
Original file line number Diff line number Diff line change
Expand Up @@ -2897,7 +2897,7 @@ private slots:

somatic_report_settings.sbs_signature = TESTDATA("data_in/somatic/Somatic_DNA123456_01-NA12878_03/snv_signatures/De_Novo_map_to_COSMIC_SBS96.csv");
somatic_report_settings.dbs_signature = TESTDATA("data_in/somatic/Somatic_DNA123456_01-NA12878_03/snv_signatures/De_Novo_map_to_COSMIC_DBS78.csv");
somatic_report_settings.id_signature = TESTDATA("data_in/somatic/Somatic_DNA123456_01-NA12878_03/snv_signatures/De_Novo_map_to_COSMIC_ID83.csv");
somatic_report_settings.id_signature = TESTDATA("data_in/somatic/Somatic_DNA123456_01-NA12878_03/snv_signatures/De_Novo_map_to_COSMIC_ID83.tsv");
somatic_report_settings.cnv_signature = TESTDATA("data_in/somatic/Somatic_DNA123456_01-NA12878_03/cnv_signatures/De_Novo_map_to_COSMIC_CNV48.csv");

S_EQUAL(db.processedSampleId("DNA123456_01"), "4004");
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
##L1 Error %: 64.56
##L2 Error %: 24.87
##KL Divergence: 0.947
##Cosine Similarity: 0.97
##Correlation: 0.97
#type signature value
De novo extracted Signature 83-A
Global NMF Signatures Signature ID1 15.04
Global NMF Signatures Signature ID2 47.28
Global NMF Signatures Signature ID12 37.68
6 changes: 3 additions & 3 deletions src/cppNGSD-TEST/data_out/somatic_report_tumor_normal_2.rtf
Original file line number Diff line number Diff line change
Expand Up @@ -4808,7 +4808,7 @@ Aetiologie
\ql
{
\fs18
F\u252;r die Mutationssignaturen des Typs SBS92 konnten keine COSMIC Signaturen identifieziert werden.
F\u252;r die Mutationssignaturen des Typs SBS92 konnten keine COSMIC Signaturen identifiziert werden.
}\cell}
\row
\trowd\trgraph180\trpaddb28\trpaddl28\trpaddr28\trpaddt28\clbrdrt\brdrw1\brdrhair\brdrcf4\clbrdrb\brdrw1\brdrhair\brdrcf4\clbrdrl\brdrw1\brdrhair\brdrcf4\clbrdrr\brdrw1\brdrhair\brdrcf4\cellx1500\clbrdrt\brdrw1\brdrhair\brdrcf4\clbrdrb\brdrw1\brdrhair\brdrcf4\clbrdrl\brdrw1\brdrhair\brdrcf4\clbrdrr\brdrw1\brdrhair\brdrcf4\cellx3000\clbrdrt\brdrw1\brdrhair\brdrcf4\clbrdrb\brdrw1\brdrhair\brdrcf4\clbrdrl\brdrw1\brdrhair\brdrcf4\clbrdrr\brdrw1\brdrhair\brdrcf4\cellx4500\clbrdrt\brdrw1\brdrhair\brdrcf4\clbrdrb\brdrw1\brdrhair\brdrcf4\clbrdrl\brdrw1\brdrhair\brdrcf4\clbrdrr\brdrw1\brdrhair\brdrcf4\cellx6500\clbrdrt\brdrw1\brdrhair\brdrcf4\clbrdrb\brdrw1\brdrhair\brdrcf4\clbrdrl\brdrw1\brdrhair\brdrcf4\clbrdrr\brdrw1\brdrhair\brdrcf4\cellx9922
Expand Down Expand Up @@ -4996,7 +4996,7 @@ Unknown
\ql
{
\fs18
F\u252;r die Mutationssignaturen des Typs DBS78 konnten keine COSMIC Signaturen identifieziert werden.
F\u252;r die Mutationssignaturen des Typs DBS78 konnten keine COSMIC Signaturen identifiziert werden.
}\cell}
\row
\trowd\trgraph180\trpaddb28\trpaddl28\trpaddr28\trpaddt28\clbrdrt\brdrw1\brdrhair\brdrcf4\clbrdrb\brdrw1\brdrhair\brdrcf4\clbrdrl\brdrw1\brdrhair\brdrcf4\clbrdrr\brdrw1\brdrhair\brdrcf4\cellx9922
Expand All @@ -5010,7 +5010,7 @@ F\u252;r die Mutationssignaturen des Typs DBS78 konnten keine COSMIC Signaturen
\ql
{
\fs18
F\u252;r die Mutationssignaturen des Typs CNV48 konnten keine COSMIC Signaturen identifieziert werden.
F\u252;r die Mutationssignaturen des Typs CNV48 konnten keine COSMIC Signaturen identifiziert werden.
}\cell}
\row
\trowd\trgraph180\trpaddb28\trpaddl28\trpaddr28\trpaddt28\cellx9922
Expand Down
101 changes: 68 additions & 33 deletions src/cppNGSD/SomaticReportHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1556,55 +1556,90 @@ void SomaticReportHelper::signatureTableHelper(RtfTable &table, QString file, co
{
VersatileFile stream(file);

if (file != "" && stream.exists() && stream.open(QIODevice::ReadOnly))
try
{
//file not present or cannot be opened
if (file=="" || !stream.exists() || !stream.open(QIODevice::ReadOnly)) THROW(Exception, "could not open file "+file);

//init
QList<int> cell_widths = {1500, 1500, 1500, 2000, 3422};
QByteArray cos_similarity;
QByteArray correlation;
QList<KeyValuePair> signatures;

QByteArray content = stream.readAll();
QByteArrayList lines = content.split('\n');
if (lines.count() < 2) return;
//parse content
QByteArrayList lines = stream.readAll().split('\n');
if (lines[0].startsWith("##")) //TSV format
{
foreach(QByteArray line, lines)
{
line = line.trimmed();
if (line.isEmpty()) continue;

// QByteArray header = lines[0];
QByteArray values = lines[1];
//header
if (line.startsWith("##Cosine Similarity:")) cos_similarity = line.mid(21).trimmed();
if (line.startsWith("##Correlation:")) correlation = line.mid(15).trimmed();
if (line.startsWith("#")) continue;

QByteArrayList parts = values.split(',');
//content
QByteArrayList parts = line.split('\t');
if (parts.count()!=3) continue;

QByteArray cos_similarity = parts[5];
QByteArray correlation = parts[6];
QByteArray sig_name = parts[1].replace("Signature ", "");
QByteArray sig_perc = parts[2];
signatures.append(KeyValuePair(sig_name, sig_perc));

//if there is only a single resulting signature it has no percentage after it.
if (parts[0].trimmed() == parts[1].trimmed())
{
RtfTableRow row;
row.addCell(doc_.maxWidth(), "Für die Mutationssignaturen des Typs " + type + " konnten keine COSMIC Signaturen identifieziert werden.");
table.addRow(row);
return;
}
}
else //CSV format
{
if (lines.count() < 2) THROW(Exception, "CNV format: not two lines");
QByteArrayList parts = lines[1].split(',');

QByteArrayList signatures = (parts[1] + "&").split('&');
cos_similarity = parts[5];
correlation = parts[6];

foreach (auto sig, signatures)
{
sig = sig.trimmed();
if (sig == "") continue;
sig.replace("Signature ", "");
//if there is only a single resulting signature it has no percentage after it.
if (parts[0].trimmed() != parts[1].trimmed())
{
foreach(QByteArray entry, parts[1].split('&'))
{
entry = entry.replace("Signature ", "").trimmed();
if (entry.isEmpty() || !entry.contains(' ')) continue;

QByteArray sig_name = sig.split(' ')[0];
QByteArray sig_perc = sig.split(' ')[1];
sig_perc.replace("(", "");
sig_perc.replace("%)", "");
QByteArray sig_name = entry.split(' ')[0];
QByteArray sig_perc = entry.split(' ')[1];
sig_perc.replace("(", "");
sig_perc.replace("%)", "");

RtfTableRow row;
row.addCell(cell_widths[0], sig_name);
row.addCell(cell_widths[1], sig_perc.replace(".", ",").trimmed());
row.addCell(cell_widths[2], correlation.replace(".", ",").trimmed());
row.addCell(cell_widths[3], cos_similarity.replace(".", ",").trimmed());
row.addCell(cell_widths[4], descriptions[sig_name]);
signatures.append(KeyValuePair(sig_name, sig_perc));
}
}
}

//create output table
if (signatures.isEmpty())
{
RtfTableRow row;
row.addCell(doc_.maxWidth(), "Für die Mutationssignaturen des Typs " + type + " konnten keine COSMIC Signaturen identifiziert werden.");
table.addRow(row);
}
else
{
foreach (auto sig, signatures)
{
RtfTableRow row;
row.addCell(cell_widths[0], sig.key.toLatin1());
row.addCell(cell_widths[1], sig.value.toLatin1().replace(".", ",").trimmed());
row.addCell(cell_widths[2], correlation.replace(".", ",").trimmed());
row.addCell(cell_widths[3], cos_similarity.replace(".", ",").trimmed());
row.addCell(cell_widths[4], descriptions[sig.key.toLatin1()]);

table.addRow(row);
}
}
}
else
catch (Exception& /*e*/)
{
RtfTableRow row;
row.addCell(doc_.maxWidth(), "Die Mutationssignaturen des Typs " + type + " konnten nicht berechnet werden.");
Expand Down

0 comments on commit 77ee12e

Please sign in to comment.