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

A cyclic dependency between available-for-plugins.js and get-data-fetcher.js #1146

Open
sehilyi opened this issue Mar 8, 2023 · 1 comment

Comments

@sehilyi
Copy link
Member

sehilyi commented Mar 8, 2023

I am trying to figure out a way to refactor the higlass code in order to publish smaller packages (e.g., @higlass/core, @higlass/data-fetchers, etc) which will be helpful for other projects that use only a subset of higlass. But I found many cyclic events happening, especially on available-for-plugins.js, which makes it challenging to separate packages.

One example I found is that a getDataFetcher function (from get-data-fetcher.js) uses an AVAILABLE_FOR_PLUGINS object (from available-for-plugins), but AVAILABLE_FOR_PLUGINS itself also stores the getDataFetcher function.

  - configs
    - available-for-plugins.js
  - data-fetchers
    - get-data-fetchers.js
// configs/available-for-plugins.js
import getDataFetcher from '../data-fetchers/get-data-fetcher';
const dataFetchers = {
  getDataFetcher, ...
};
export default {
  dataFetchers, ...
}
// configs/index.js
export { default as AVAILABLE_FOR_PLUGINS } from './available-for-plugins';
// get-data-fetcher.js
import { AVAILABLE_FOR_PLUGINS } from '../configs';
const getDataFetcher = (
   ...,
   availableForPlugins = AVAILABLE_FOR_PLUGINS
)  {
   ...
};

export default getDataFetcher;

I am unsure if AVAILABLE_FOR_PLUGINS.getDataFetcher() is used at all from plugin tracks or data fetchers, but it is at least not used in the higlass/higlass repo. Several plugin repos under higlass (e.g., higlass/higlass-sequence) do not use it, too. I think we could remove getDataFetcher from AVAILABLE_FOR_PLUGINS if we are certain it is not used, or we will need to restructure them.

cc @manzt

@sehilyi
Copy link
Member Author

sehilyi commented Mar 8, 2023

Actually, AVAILABLE_FOR_PLUGINS.getDataFetcher() is used in a data fetcher implemented outside the higlass repo:

https://github.com/kundajelab/higlass-multi-tileset/blob/a6d89b4afbd9749d68b2f30b397dd0a07da63b6d/src/scripts/multi-tileset-fetcher.js#LL10C75-L10C89

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

1 participant