Last active
July 23, 2024 13:20
-
-
Save mikelove/cefc1d83f6e596c5c931d8d85989c139 to your computer and use it in GitHub Desktop.
file to make JSON format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(jsonlite) | |
library(readr) | |
dat <- read_csv("IGVF MPRA FG designed sequence metadata - Sheet1.csv") | |
dat$constraints <- as.list(dat$constraints) | |
dat$constraints[[1]] <- list(required=TRUE) | |
dat$constraints[[2]] <- list(required=TRUE) | |
dat$constraints[[3]] <- list( | |
required=TRUE, | |
enum=strsplit(sub(".*enum: \\[(.*)\\]","\\1",dat$constraints[[3]]),", ")[[1]] | |
) | |
dat$constraints[[4]] <- list( | |
required=TRUE, | |
enum=strsplit(sub(".*enum: \\[(.*)\\]","\\1",dat$constraints[[4]]),", ")[[1]] | |
) | |
dat$constraints[[8]] <- list(minimum=0) | |
dat$constraints[[9]] <- list(minimum=1) | |
dat$constraints[[10]] <- list(enum=c("+","-")) | |
dat$constraints[[11]] <- list(enum=c("SNV","indel")) | |
dat$constraints[[12]] <- list(minimum=0) | |
dat$constraints[[14]] <- list(enum=c("ref","alt")) | |
write(toJSON(list(fields=dat, missingValues=c(NA, "")), pretty=4), file="designed_sequences.json") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment