Skip to content

Commit

Permalink
feat: add seqinfo to gi if pairs format is 4dn
Browse files Browse the repository at this point in the history
  • Loading branch information
js2264 committed Oct 4, 2023
1 parent 3807f49 commit 3232261
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions R/parse-pairs.R
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,21 @@

# -- Add pairdist
gi$distance <- InteractionSet::pairdist(gi)

# -- Add seqinfo
if (.fmt == '4dn') {
chrs <- fileComments |>
grep('#chromsize: ', x = _, value = TRUE) |>
gsub("#chromsize: ", "", x = _)
si <- gsub(".* ", "", chrs)
names(si) <- gsub(" .*", "", chrs)
GenomeInfoDb::seqlevels(gi) <- names(si)
GenomeInfoDb::seqinfo(gi) <- GenomeInfoDb::Seqinfo(
names(si),
as.numeric(si)
)
}

return(gi)
}

Expand Down

0 comments on commit 3232261

Please sign in to comment.