Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can you check which version of gos is compatible with given version of gosling? #141

Closed
sapoudel opened this issue Nov 20, 2023 · 4 comments

Comments

@sapoudel
Copy link

I am trying to use python gos to create specs that I can then plug into a react app. The react app uses gosling 0.9.30 and react ^18.2.0 and the python gos I am using is pip installed gosling-0.0.11. So far, I can create simple visualization that works perfectly within the app with this "hand made" spec:

  tracks: [
    {
      assembly: [["NC_010079.1", 2873728]],
      data: {
        url: "http://localhost:5000/gene",
        type: "csv",
        separator: "\t",
      },
      mark: "rect",
      x: { field: "start", type: "genomic" },
      color: { field: "start", type: "quantitative", legend: true },
      width: 600,
      height: 130,
    },
  ],
};

I can also create a visualization within jupyter notebook using gos and save it as a HTML file. But, when I plug in a spec created with gos into the react, I get all the components but none of the data is displayed. I tried upgrading the python gos to the latest version, but the exported spec from that causes the app to crash. So what is the best way to figure out compatible versions without trying all of them?

@sapoudel
Copy link
Author

sapoudel commented Nov 20, 2023

Was able to figure out the issues without changing any of the versions. My input looked like this:

mutation_data = gos.csv(
    url='http://localhost:5000/gene',
    chromosomeField="chrom:N",
    genomicFields=["start", "end"],
    separator=',',
)

Using this data works within jupyter notebook (and I can save as HTML) and creates the figures I want. When I export to json using .to_json() it keeps the :N field which breaks it when using it as the spec in react. The json looks like this:

data: {
                chromosomeField: "chrom:N",
                genomicFields: ["start", "end"],
                separator: ",",
                type: "csv",
                url: "http://localhost:5000/gene",
              }

Removing the :N from the original python input fixes it for both. I am not sure if this should be a bug or not.

Additionally, prettier was also changing seperator: "\t" to seperator: "\\t" which was also causing problems.

@manzt
Copy link
Member

manzt commented Nov 21, 2023

Hi there, we probably need to make a release of gos with the latest Gosling.js #143

@sapoudel
Copy link
Author

Perfect! I think the schema validation should throw an error if you add :N (or any other data type marker) field to chromosomeField since it breaks the code downstream. If don't think this is a bug, feel free to close this issue.

@manzt
Copy link
Member

manzt commented Nov 21, 2023

I think the schema validation should throw an error if you add :N (or any other data type marker) field to chromosomeField since it breaks the code downstream. If don't think this is a bug, feel free to close this issue.

This is not part of the schema that accepts the data type shorthand (e.g., :N or :Q). Instead this is part of the data definition and you are telling Gosling which header of the CSV corresponds to the chromosome names. There is no way for the Python library to validate this is a column name in your CSV, since the CSV parsing is done in the front end (after the schema has been compiled).

@manzt manzt closed this as completed Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants