Skip to content

Commit

Permalink
Merge pull request #13 from pcvolkmer/features/9_hrd-score
Browse files Browse the repository at this point in the history
feat: add HRD/GIM score
  • Loading branch information
pcvolkmer authored Dec 19, 2024
2 parents 9160472 + 08f5c91 commit 339ead2
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
8 changes: 4 additions & 4 deletions resources/prefix-data_clinical_sample.tsv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Patient Identifier Sample Identifier Lokalisation Tumorprobe Bezug Primarius Gewinnung der Tumorprobe Ort der Gewebeentnahme Alter der Gewebeprobe Tumorzellgehalt Sequenzierung DNA Panel Sequenzierung DNA Plattform Fusionsanalyse RNA panel Sequenzierung RNA Plattform TMB Score TPS ICS CPS MSI Immun Graphen MSI aus PCR MSI aus panel Her2 Fish Andere Untersuchung Andere IHC Dako Score Fusionen Splice Varianten Mutationen Copy Number Variations
#Patient identifier Sample identifier Lokalisation Tumorprobe Bezug Primarius Gewinnung der Tumorprobe Ort der Gewebeentnahme Alter der Gewebeprobe Tumorzellgehalt Sequenzierung DNA Panel Sequenzierung DNA Plattform Fusionsanalyse RNA panel Sequenzierung RNA Plattform TMB Score TPS ICS CPS MSI Immun Graphen MSI aus PCR MSI aus panel Her2 Fish Andere Untersuchung Andere IHC Dako Score Fusionen Splice Varianten Mutationen Copy Number Variations
#STRING STRING STRING STRING STRING NUMBER NUMBER STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING
#1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#Patient Identifier Sample Identifier Lokalisation Tumorprobe Bezug Primarius Gewinnung der Tumorprobe Ort der Gewebeentnahme Alter der Gewebeprobe Tumorzellgehalt Sequenzierung DNA Panel Sequenzierung DNA Plattform Fusionsanalyse RNA panel Sequenzierung RNA Plattform TMB Score TPS ICS CPS MSI Immun Graphen MSI aus PCR MSI aus panel Her2 Fish Andere Untersuchung Andere IHC Dako Score Fusionen Splice Varianten Mutationen Copy Number Variations GIM Score HRD Score
#Patient identifier Sample identifier Lokalisation Tumorprobe Bezug Primarius Gewinnung der Tumorprobe Ort der Gewebeentnahme Alter der Gewebeprobe Tumorzellgehalt Sequenzierung DNA Panel Sequenzierung DNA Plattform Fusionsanalyse RNA panel Sequenzierung RNA Plattform TMB Score TPS ICS CPS MSI Immun Graphen MSI aus PCR MSI aus panel Her2 Fish Andere Untersuchung Andere IHC Dako Score Fusionen Splice Varianten Mutationen Copy Number Variations GIM Score HRD Score
#STRING STRING STRING STRING STRING NUMBER NUMBER STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING
#1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
37 changes: 37 additions & 0 deletions samples.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,15 @@ func fetchSamplesForDisease(patientID string, diseaseID string, ocaPlusOnly bool

// TMB_SCORE aus neuem Formular "OS.Molekulargenetik" ab rev 81
data = *tmb(fmt.Sprint(id), &data)

// GIM_/HRD_SCORE
data.GimScore = "NA"
data.HrdScore = "NA"
if panelCode, err := panelCode.Value(); err == nil && panelCode == "OCAPlus" {
data.GimScore, _ = hrd(fmt.Sprint(id))
} else {
data.HrdScore, _ = hrd(fmt.Sprint(id))
}
}

data.Her2Fish = "NA"
Expand Down Expand Up @@ -311,6 +320,28 @@ func msi(prozedurID string, sampleData *SampleData) *SampleData {
return sampleData
}

// Ermittelt den HRD Score für angegebene Hauptprozedur
func hrd(prozedurID string) (string, error) {
query := `SELECT score FROM prozedur_prozedur pp
JOIN dk_molekulargenetik ON pp.prozedur1 = dk_molekulargenetik.id
JOIN dk_molekluargenmsi ON pp.prozedur2 = dk_molekluargenmsi.id
WHERE pp.prozedur1 = ? AND komplexerbiomarker = 'HRD'`

var score sql.NullString

if rows, err := db.Query(query, prozedurID); err == nil {
for rows.Next() {
if err := rows.Scan(&score); err == nil {
if score.Valid {
return score.String, nil
}
}
}
}

return "NA", fmt.Errorf("No HRD Score entry found")
}

func tmb(prozedurID string, sampleData *SampleData) *SampleData {
query := `SELECT tumormutationalburden FROM dk_molekluargenmsi
JOIN prozedur_prozedur pp ON pp.prozedur2 = dk_molekluargenmsi.id
Expand Down Expand Up @@ -372,6 +403,8 @@ type SampleData struct {
SpliceVariants string `csv:"SPLICE_VARIANTS"`
Mutations string `csv:"MUTATIONS"`
Cnv string `csv:"CNV"`
GimScore string `csv:"GIM_SCORE"`
HrdScore string `csv:"HRD_SCORE"`
}

func SampleDataHeaders() []string {
Expand Down Expand Up @@ -402,6 +435,8 @@ func SampleDataHeaders() []string {
"SPLICE_VARIANTS",
"MUTATIONS",
"CNV",
"GIM_SCORE",
"HRD_SCORE",
}
}

Expand Down Expand Up @@ -433,5 +468,7 @@ func (data *SampleData) AsStringArray() []string {
data.SpliceVariants,
data.Mutations,
data.Cnv,
data.GimScore,
data.HrdScore,
}
}

0 comments on commit 339ead2

Please sign in to comment.