4
$\begingroup$

I'm confused why the GFA format doesn't have a standard JSON parser. It appears to be related to a decision made several years ago, here.

The objection appears to be "JSON isn't necessary, as it's just a simple linked list. Users could write their own". However, I would think this is a useful feature.

There are applications I could think of whereby a JSON would be necessary, or at least very convenient.

(1) Is there a standard way to convert GFA into JSON? Or do users write their own scripts?

(2) Is there a conceptual reason why GFA doesn't convert into JSON?

$\endgroup$
6
  • $\begingroup$ I thought the explanation Heng gave was pretty comprehensive: it’s overkill, and you can use JSON in tags. Of course you shouldn’t write your own parser, there are enough existing ones. $\endgroup$ May 20 '18 at 12:45
  • $\begingroup$ @KonradRudolph "there are enough existing ones." Do you have recommendations? Heng Li mentions his own in that thread, but there are others? $\endgroup$
    – EB2127
    May 22 '18 at 8:12
  • $\begingroup$ My recommendation is to use the standard library in whatever language you’re using. If that language doesn’t have a JSON parser in the standard library, use the most widely used implementation. $\endgroup$ May 22 '18 at 9:56
  • $\begingroup$ @KonradRudolph "use the most widely used implementation" What is this? $\endgroup$
    – EB2127
    May 24 '18 at 15:06
  • $\begingroup$ That’s the point: it depends on the programming language. A simple search of “JSON” + name of the programming language should have it as the first or second hit. $\endgroup$ May 24 '18 at 15:08
4
$\begingroup$

Short answer: no, there isn't a "standard" method, and there won't be.

Long answer: like TAB-delimited and XML, JSON alone is not a specific format. You have to define a schema to give meanings to data. However, unlike TAB-delimited "format" and XML, there is not an official way to define JSON schema. There have been various attempts but all of them are complicated and none of them are widely adopted. As you can't write down a JSON schema for GFA in the first place, there won't be a "standard" way to convert GFA to JSON. The best you can do is to roll out your own in-house solution, unfortunately.

$\endgroup$
3
  • $\begingroup$ Thanks. "There have been various attempts but all of them are complicated and none of them are widely adopted." Just to clarify though, why couldn't the community adopt a JSON scheme for GFA? If you encode all information of a GFA into one JSON format, it would be easy for others to modify this if they wish, right? $\endgroup$
    – EB2127
    May 22 '18 at 8:15
  • $\begingroup$ You are now asking a different question: why not use JSON to encode graphs? This question was answered in the thread you quoted. $\endgroup$
    – user172818
    May 22 '18 at 12:33
  • $\begingroup$ " in memory, a JSON object is also fatter, which can be a concern for huge graphs." This reason? $\endgroup$
    – EB2127
    May 24 '18 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.