Skip to content

Commit

Permalink
GSvar: added 'urgent' flag for processed samples (processed sample ta…
Browse files Browse the repository at this point in the history
…b, sequencing run tab, batch import dialog)
  • Loading branch information
marc-sturm committed Jan 28, 2025
1 parent 588f9a6 commit 46cb0ae
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 38 deletions.
4 changes: 2 additions & 2 deletions src/GSvar/ImportDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ void ImportDialog::setupGUI()
{
setWindowTitle("Import processed samples");
ui_.label->setText("Batch import of processed samples (paste tab-separated data to table)");
labels << "sample" << "project" << "run name" << "lane" << "mid1 name" << "mid2 name" << "operator" << "processing system" << "processing input [ng]" << "molarity [nM]" << "comment" << "normal processed sample" << "processing modus" << "batch number";
labels << "sample" << "project" << "run name" << "lane" << "mid1 name" << "mid2 name" << "operator" << "processing system" << "processing input [ng]" << "molarity [nM]" << "comment" << "normal processed sample" << "processing modus" << "batch number" << "urgent";
db_table_ = "processed_sample";
db_fields_ << "sample_id" << "project_id" << "sequencing_run_id" << "lane" << "mid1_i7" << "mid2_i5" << "operator_id" << "processing_system_id" << "processing_input" << "molarity" << "comment" << "normal_id" << "processing_modus" << "batch_number";
db_fields_ << "sample_id" << "project_id" << "sequencing_run_id" << "lane" << "mid1_i7" << "mid2_i5" << "operator_id" << "processing_system_id" << "processing_input" << "molarity" << "comment" << "normal_id" << "processing_modus" << "batch_number" << "urgent";
db_extra_fields_ << "process_id";
}
else if (type_==MIDS)
Expand Down
1 change: 1 addition & 0 deletions src/GSvar/ProcessedSampleWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ void ProcessedSampleWidget::updateGUI()
ancestry_details << "SAS (South asian): " + db.getValue("SELECT score_sas FROM processed_sample_ancestry WHERE processed_sample_id="+ps_id_, true).toString();
ancestry_details << "EAS (East asian): " + db.getValue("SELECT score_eas FROM processed_sample_ancestry WHERE processed_sample_id="+ps_id_, true).toString();
ui_->ancestry->setToolTip(ancestry_details.join("\n"));
ui_->urgent->setText(ps_data.urgent ? "<font color=red>yes</font>" : "");

//#### sample details ####
QString s_id = db.getValue("SELECT sample_id FROM processed_sample WHERE id='" + ps_id_ + "'").toString();
Expand Down
72 changes: 43 additions & 29 deletions src/GSvar/ProcessedSampleWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -438,35 +438,6 @@
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>comments:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="QLabel" name="comments_processed_sample">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_25">
<property name="text">
Expand Down Expand Up @@ -519,6 +490,49 @@
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QLabel" name="comments_processed_sample">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>comments:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="label_36">
<property name="text">
<string>urgent:</string>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="QLabel" name="urgent">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand Down
7 changes: 4 additions & 3 deletions src/GSvar/SequencingRunWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,17 @@ void SequencingRunWidget::updateRunSampleTable()
{
headers << "sample comments";
}
headers << "urgent";
headers << "resequencing";
NGSD db;
DBTable samples = db.createTable("processed_sample", "SELECT ps.id, ps.lane, ps.quality, CONCAT(s.name,'_',LPAD(ps.process_id,2,'0')), s.name_external, s.tumor, s.ffpe, s.gender, s.sample_type, (SELECT CONCAT(name, ' (', type, ')') FROM project WHERE id=ps.project_id), (SELECT CONCAT(name, ' (', sequence, ')') FROM mid WHERE id=ps.mid1_i7), (SELECT CONCAT(name, ' (', sequence, ')') FROM mid WHERE id=ps.mid2_i5), sp.name, sys.name_manufacturer, sys.type as sys_type, ps.processing_input, ps.molarity, (SELECT name FROM user WHERE id=ps.operator_id), ps.processing_modus, ps.batch_number, ps.comment" + QString(ui_->show_sample_comment->isChecked() ? ", s.comment as sample_comment" : "") + " ,ps.scheduled_for_resequencing "+
DBTable samples = db.createTable("processed_sample", "SELECT ps.id, ps.lane, ps.quality, CONCAT(s.name,'_',LPAD(ps.process_id,2,'0')), s.name_external, s.tumor, s.ffpe, s.gender, s.sample_type, (SELECT CONCAT(name, ' (', type, ')') FROM project WHERE id=ps.project_id), (SELECT CONCAT(name, ' (', sequence, ')') FROM mid WHERE id=ps.mid1_i7), (SELECT CONCAT(name, ' (', sequence, ')') FROM mid WHERE id=ps.mid2_i5), sp.name, sys.name_manufacturer, sys.type as sys_type, ps.processing_input, ps.molarity, (SELECT name FROM user WHERE id=ps.operator_id), ps.processing_modus, ps.batch_number, ps.comment" + QString(ui_->show_sample_comment->isChecked() ? ", s.comment as sample_comment" : "") + " ,ps.urgent, ps.scheduled_for_resequencing "+
" FROM processed_sample ps, sample s, processing_system sys, species sp WHERE sp.id=s.species_id AND ps.processing_system_id=sys.id AND ps.sample_id=s.id AND ps.sequencing_run_id='" + run_id_ + "' "
" ORDER BY ps.lane ASC, "+ (ui_->sort_by_ps_id->isChecked() ? "ps.id" : "ps.processing_system_id ASC, s.name ASC, ps.process_id"));
//format columns
samples.formatBooleanColumn(samples.columnIndex("tumor"));
samples.formatBooleanColumn(samples.columnIndex("ffpe"));
samples.formatBooleanColumn(samples.columnIndex("scheduled_for_resequencing"));
samples.formatBooleanColumn(samples.columnIndex("urgent"), true);
samples.formatBooleanColumn(samples.columnIndex("scheduled_for_resequencing"), true);

// determine QC parameter based on sample types
QSet<QString> sample_types = samples.extractColumn(samples.columnIndex("sample_type")).toSet();
Expand Down Expand Up @@ -214,7 +216,6 @@ void SequencingRunWidget::updateRunSampleTable()
QStringList quality_values = samples.takeColumn(samples.columnIndex("quality"));
ui_->samples->setData(samples);
ui_->samples->setQualityIcons("sample", quality_values);
ui_->samples->setColumnWidth(ui_->samples->columnIndex("comments"), 350);

//colors
QColor orange = QColor(255,150,0,125);
Expand Down
4 changes: 2 additions & 2 deletions src/cppNGSD/DBTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ bool DBTable::columnIsNumeric(int c) const
return true;
}

void DBTable::formatBooleanColumn(int c)
void DBTable::formatBooleanColumn(int c, bool empty_if_no)
{
//init
static QString s_yes = "yes";
Expand All @@ -197,7 +197,7 @@ void DBTable::formatBooleanColumn(int c)
}
else if (value=="0")
{
rows_[r].setValue(c, s_no);
rows_[r].setValue(c, empty_if_no ? "" : s_no);
}
else if (!value.isEmpty())
{
Expand Down
2 changes: 1 addition & 1 deletion src/cppNGSD/DBTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class CPPNGSDSHARED_EXPORT DBTable
bool columnIsNumeric(int c) const;

///Replace 0/1 in boolean column by yes/no
void formatBooleanColumn(int c);
void formatBooleanColumn(int c, bool empty_if_no = false);

///Removes rows that don't contain the given text.
void filterRows(QString text, Qt::CaseSensitivity cs = Qt::CaseInsensitive);
Expand Down
3 changes: 2 additions & 1 deletion src/cppNGSD/NGSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ ProcessedSampleData NGSD::getProcessedSampleData(const QString& processed_sample
{
//execute query
SqlQuery query = getQuery();
query.exec("SELECT CONCAT(s.name,'_',LPAD(ps.process_id,2,'0')) as ps_name, sys.name_manufacturer as sys_name, sys.type as sys_type, ps.quality, ps.comment, p.name as p_name, p.type as p_type, r.name as r_name, ps.normal_id, s.gender, ps.operator_id, ps.processing_input, ps.molarity, ps.processing_modus, ps.batch_number, ps.scheduled_for_resequencing FROM sample s, project p, processing_system sys, processed_sample ps LEFT JOIN sequencing_run r ON ps.sequencing_run_id=r.id WHERE ps.sample_id=s.id AND ps.project_id=p.id AND ps.processing_system_id=sys.id AND ps.id=" + processed_sample_id);
query.exec("SELECT CONCAT(s.name,'_',LPAD(ps.process_id,2,'0')) as ps_name, sys.name_manufacturer as sys_name, sys.type as sys_type, ps.quality, ps.comment, p.name as p_name, p.type as p_type, r.name as r_name, ps.normal_id, s.gender, ps.operator_id, ps.processing_input, ps.molarity, ps.processing_modus, ps.batch_number, ps.scheduled_for_resequencing, ps.urgent FROM sample s, project p, processing_system sys, processed_sample ps LEFT JOIN sequencing_run r ON ps.sequencing_run_id=r.id WHERE ps.sample_id=s.id AND ps.project_id=p.id AND ps.processing_system_id=sys.id AND ps.id=" + processed_sample_id);
if (query.size()==0)
{
THROW(ProgrammingException, "Invalid 'id' for table 'processed_sample' given: '" + processed_sample_id + "'");
Expand Down Expand Up @@ -752,6 +752,7 @@ ProcessedSampleData NGSD::getProcessedSampleData(const QString& processed_sample
output.molarity = query.value("molarity").toString().trimmed();
output.ancestry = getValue("SELECT `population` FROM `processed_sample_ancestry` WHERE `processed_sample_id`=:0", true, processed_sample_id).toString();
output.scheduled_for_resequencing = query.value("scheduled_for_resequencing").toBool();
output.urgent = query.value("urgent").toBool();

return output;

Expand Down
1 change: 1 addition & 0 deletions src/cppNGSD/NGSD.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ struct CPPNGSDSHARED_EXPORT ProcessedSampleData
QString molarity;
QString ancestry;
bool scheduled_for_resequencing;
bool urgent;
};

///Processing system information.
Expand Down
1 change: 1 addition & 0 deletions src/cppNGSD/resources/NGSD_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ CREATE TABLE IF NOT EXISTS `processed_sample`
`folder_override` TEXT NULL DEFAULT NULL COMMENT 'Override for sample folder',
`folder_override_client` TEXT NULL DEFAULT NULL COMMENT 'Override for sample folder used in GSvar client',
`scheduled_for_resequencing` BOOLEAN NOT NULL DEFAULT FALSE,
`urgent` BOOLEAN NOT NULL DEFAULT FALSE,
PRIMARY KEY (`id`),
UNIQUE INDEX `sample_psid_unique` (`sample_id` ASC, `process_id` ASC),
INDEX `fk_processed_sample_samples1` (`sample_id` ASC),
Expand Down

0 comments on commit 46cb0ae

Please sign in to comment.