add --format tsv option to gen-prefix-map generator#451
Conversation
|
can you also add a test? |
0c4e3b9 to
39b3bad
Compare
|
there must be a way to pass in format as an argument - either in the constructor, or in the serialize method? |
|
@cmungall: I've added a test for the new |
|
Looks like all the checks went through Chris, this PR is probably ready to be merged. |
| if output: | ||
| with open(output, 'w') as outf: | ||
| outf.write(as_json(context)) | ||
| output_ext = output.split(".")[-1] |
There was a problem hiding this comment.
We should probably warn if this over-rides the users explicit choice
There was a problem hiding this comment.
Hm, so this isn't necessarily overriding anything. It just parses out the file extension from the filename that is supplied via the --output option.
| mapping[prefix] = self.namespaces[prefix] | ||
|
|
||
| for key, value in mapping.items(): | ||
| print(key, value, sep='\t') |
There was a problem hiding this comment.
ah I see, it's just a 2 column tsv so this is OK - but why not use this same simple form when writing to a file?
There was a problem hiding this comment.
I wanted to use csv.writer() to make sure the data is being correctly formatted and written to a tsv file rather than stringing the key and value together with a \t separator.
Per my understanding of issue #447, I have added support to
prefixmapgen.pyas in this following PR.Execute the following command to see it in action:
See the sample output from the above command below:
You can also redirect the tsv output into a
.tsvfile in the following way:CC: @cmungall