TheEvergreenStateCollege / bioinformatics

Plant genome sequencing
2 stars 2 forks source link

Visualize suffix links from duplicate edges #37

Open learner-long-life opened 2 months ago

learner-long-life commented 2 months ago

In constructing the following tree:

image

The edge going from 6 to 2, which string bxac, and the edge going from 1 to 4, with the same string, are stored as duplicate edges in the database.

model Edge {
  id         Int                  @id @default(autoincrement())
  parentId   Int
  childId    Int
  startIndex Int
  endIndex   Int
//  edgeString EdgeStringFragment[]
}

// One row per character of input string 
model InputCharacters {
  id        Int    @id @default(autoincrement())
  character String
}

How to denote that these two edges are suffix links of identical subtrees, for purposes of visual rendering? (And possibly some other purpose).

learner-long-life commented 2 months ago

Working with @pointmeathesky , adding a new table to the schema may be on the way to solving this

model Edge {
  id         Int      @id @default(autoincrement())
  parentId   Int
  childId    Int
  startIndex Int
  endIndex   Int
  //  edgeString EdgeStringFragment[]
  SubTree    SubTree? @relation(fields: [subTreeId], references: [id])
  subTreeId  Int?
}

// One row per character of input string 
model InputCharacters {
  id        Int    @id @default(autoincrement())
  character String
}

model SubTree {
  id    Int    @id @default(autoincrement())
  edges Edge[]
}

running npx prisma format and npx prisma validate to add the opposite relation between Edge and SubTree. There may be a better name than SubTree.