Skip to content

Commit

Permalink
Merge pull request #6 from Ferlab-Ste-Justine/fix/cqdg-757_ncit_terms
Browse files Browse the repository at this point in the history
fix: CQDG-757 fix ncit terms
  • Loading branch information
adipaul1981 authored May 29, 2024
2 parents bac3ee9 + d2fca95 commit 26cc34b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/scala/bio/ferlab/transform/DownloadTransformer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import scala.util.{Failure, Success, Try}
import scala.xml.{Node, NodeSeq, XML}

object DownloadTransformer {
val patternId = "id: ([A-Z]+:[0-9]+)".r
val patternId = "^id: ([A-Z]+:[A-Z?0-9]+)$".r
val patternName = "name: (.*)".r
val patternIsA = "is_a: ([A-Z]+:[0-9]+) (\\{.*})? ?! (.*)".r
val patternAltId = "^alt_id: (HP:[0-9]+|MONDO:[0-9]+)$".r
val patternIsA = "^is_a: ([A-Z]+:[A-Z?0-9]+) (\\{.*})? ?! (.*)$".r
val patternAltId = "^alt_id: (HP:[0-9]+|MONDO:[0-9]+|NCIT:A-Z?[0-9]+)$".r

def using[A](r: BufferedSource)(f: BufferedSource => A): A =
try {
Expand All @@ -28,7 +28,7 @@ object DownloadTransformer {
val file = readTextFileWithTry(fileBuffer)
file match {
case Success(lines) => lines.foldLeft(List.empty[OntologyTerm]) { (current, line) =>
if (line.trim == "[Term]") {
if (line.trim == "[Term]" || line.trim == "[Typedef]") {
OntologyTerm("", "") :: current
} else if (line.matches(patternId.regex)) {
val patternId(id) = line
Expand Down

0 comments on commit 26cc34b

Please sign in to comment.