Skip to content

Commit

Permalink
converted it
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandunn committed Feb 13, 2021
1 parent 91041f6 commit 745c94a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions scripts/convert_gmt_to_json.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env groovy
import groovy.json.JsonBuilder
import groovy.json.JsonOutput

def file = new File("9606-go_tcga-bp-all_converted.gmt")

//def builder = new JsonBuilder()

StringBuilder stringBuilder =new StringBuilder()
List entries = []
file.splitEachLine("\t"){ List<String> columns ->
Map map = new HashMap([golabel:columns[0],goid:columns[1],gene:columns.subList(2,columns.size())])
entries.add(map)
// def output = JsonOutput.toJson(map)
// println output
// stringBuilder.append(output)
}


def outputFile = new File("tgac.json")
outputFile.write(JsonOutput.toJson(entries))
Loading

0 comments on commit 745c94a

Please sign in to comment.