Skip to content

feat: Implement logic for Chromosome.php, GenomicPosition.php and Gen…#76

Open
KingKong1213 wants to merge 9 commits intomasterfrom
chromosome-genomicPosition-genomicRegion
Open

feat: Implement logic for Chromosome.php, GenomicPosition.php and Gen…#76
KingKong1213 wants to merge 9 commits intomasterfrom
chromosome-genomicPosition-genomicRegion

Conversation

@KingKong1213
Copy link
Contributor

@KingKong1213 KingKong1213 commented Mar 3, 2026

GenomicRegion.php

  • Added automated tests
  • Documented for all relevant versions

Changes

Implement logic for Chromosome.php, GenomicPosition.php and GenomicRegion.php

Breaking changes

@KingKong1213 KingKong1213 requested a review from simbig March 3, 2026 11:52
Copy link
Contributor

@simbig simbig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gutes Fundament — die Value Objects sind sauber aufgebaut. Ein paar fachliche Punkte die ich vor dem Merge klären würde.

&& (
$this->positionIsBetweenStartAndEnd($genomicRegion->start)
|| $this->positionIsBetweenStartAndEnd($genomicRegion->end)
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Falsch bei vollständiger Überlappung

Wenn Region B die Region A komplett umschließt (z.B. A=chr11:20-30, B=chr11:10-40), liefert die Methode fälschlich false, weil weder B.start noch B.end innerhalb von A liegt.

Fix — die kanonische Intervall-Formel:

return $this->chromosome->equals($other->chromosome)
    && $this->start <= $other->end
    && $other->start <= $this->end;

? new ReferenzGenome(ReferenzGenome::HG_19)
: new ReferenzGenome(ReferenzGenome::GRCH_37);

$this->value = $matches[2];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Case und M/MT normalisieren

  • Die Regex ist case-insensitive, aber der gespeicherte Wert behält die Original-Schreibweise → chrx und chrX wären bei Vergleichen ungleich. Fix: strtoupper($matches[2])
  • M und MT bezeichnen beide das Mitochondrien-Chromosom, werden aber als unterschiedliche Werte gespeichert. chrMT ist zudem kein gültiger UCSC-Bezeichner (korrekt: chrM). Fix: MTM normalisieren.

return $position >= $this->start && $position <= $this->end;
}

public function toString(?ReferenzGenome $referenceGenome = null): string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to NamingConvention mit UCSC/ENSEMBL. also es geht ja drum mittels welcher namingConvention es serialisiert werden soll, oder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants