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

dependency cycle #70

Closed
1 of 2 tasks
targos opened this issue Mar 1, 2022 · 5 comments · Fixed by #260
Closed
1 of 2 tasks

dependency cycle #70

targos opened this issue Mar 1, 2022 · 5 comments · Fixed by #260
Assignees

Comments

@targos
Copy link
Member

targos commented Mar 1, 2022

  • emdb -> ms-spectrum -> emdb
    • add back { "path": "../emdb" } to the tsconfig.json of ms-spectrum when fixed
  • mf-parser -> mf-utilities -> mf-parser
@tpoisseau tpoisseau self-assigned this Dec 19, 2024
@tpoisseau
Copy link
Collaborator

tpoisseau commented Dec 19, 2024

https://github.com/acrazing/dpdm

% npx dpdm --no-warning --no-tree circular packages/emdb/src/index.js
✔ [156/156] Analyze done!
• Circular Dependencies
  1) packages/ms-spectrum/lib/src/index.js -> packages/ms-spectrum/lib/src/Spectrum.js -> packages/ms-spectrum/lib/src/getFragmentPeaks.js -> packages/emdb/lib/src/index.js
% find ./packages/*/src -type f -name 'index.*' -depth 1 -print0 | tr '\n' '\0' | xargs -0 -t -n1 npx dpdm --no-warning --no-tree circular
npx dpdm --no-warning --no-tree circular ./packages/atom-sorter/src/index.ts
✔ [1/1] Analyze done!
• Circular Dependencies
  ✅ Congratulations, no circular dependency was found in your project.

npx dpdm --no-warning --no-tree circular ./packages/chemical-elements/src/index.ts
✔ [12/12] Analyze done!
• Circular Dependencies
  ✅ Congratulations, no circular dependency was found in your project.

npx dpdm --no-warning --no-tree circular ./packages/chemical-groups/src/index.js
✔ [4/4] Analyze done!
• Circular Dependencies
  ✅ Congratulations, no circular dependency was found in your project.

npx dpdm --no-warning --no-tree circular ./packages/emdb/src/index.js
✔ [156/156] Analyze done!
• Circular Dependencies
  1) packages/ms-spectrum/lib/src/index.js -> packages/ms-spectrum/lib/src/Spectrum.js -> packages/ms-spectrum/lib/src/getFragmentPeaks.js -> packages/emdb/lib/src/index.js

npx dpdm --no-warning --no-tree circular ./packages/isotopic-distribution/src/index.js
✔ [62/62] Analyze done!
• Circular Dependencies
  ✅ Congratulations, no circular dependency was found in your project.

npx dpdm --no-warning --no-tree circular ./packages/mass-fragmentation/src/index.js
✔ [56/56] Analyze done!
• Circular Dependencies
  ✅ Congratulations, no circular dependency was found in your project.

npx dpdm --no-warning --no-tree circular ./packages/mass-tools/src/index.js
✔ [199/199] Analyze done!
• Circular Dependencies
  1) packages/emdb/lib/src/index.js -> packages/ms-spectrum/lib/src/index.js -> packages/ms-spectrum/lib/src/Spectrum.js -> packages/ms-spectrum/lib/src/getFragmentPeaks.js
  2) packages/emdb/lib/src/index.js -> packages/ms-spectrum/lib/src/index.js -> packages/ms-spectrum/lib/src/jsgraph/index.js -> packages/ms-spectrum/lib/src/jsgraph/getPeaksAnnotation.js

npx dpdm --no-warning --no-tree circular ./packages/mf-finder/src/index.js
✔ [63/63] Analyze done!
• Circular Dependencies
  ✅ Congratulations, no circular dependency was found in your project.

npx dpdm --no-warning --no-tree circular ./packages/mf-from-atomic-ratio/src/index.js
✔ [62/62] Analyze done!
• Circular Dependencies
  ✅ Congratulations, no circular dependency was found in your project.

npx dpdm --no-warning --no-tree circular ./packages/mf-from-ea/src/index.js
✔ [47/47] Analyze done!
• Circular Dependencies
  ✅ Congratulations, no circular dependency was found in your project.

npx dpdm --no-warning --no-tree circular ./packages/mf-from-google-sheet/src/index.js
✔ [62/62] Analyze done!
• Circular Dependencies
  ✅ Congratulations, no circular dependency was found in your project.

npx dpdm --no-warning --no-tree circular ./packages/mf-generator/src/index.js
✔ [60/60] Analyze done!
• Circular Dependencies
  ✅ Congratulations, no circular dependency was found in your project.

npx dpdm --no-warning --no-tree circular ./packages/mf-global/src/index.js
✔ [155/155] Analyze done!
• Circular Dependencies
  1) packages/emdb/lib/src/index.js -> packages/ms-spectrum/lib/src/index.js -> packages/ms-spectrum/lib/src/Spectrum.js -> packages/ms-spectrum/lib/src/getFragmentPeaks.js
  2) packages/emdb/lib/src/index.js -> packages/ms-spectrum/lib/src/index.js -> packages/ms-spectrum/lib/src/jsgraph/index.js -> packages/ms-spectrum/lib/src/jsgraph/getPeaksAnnotation.js

npx dpdm --no-warning --no-tree circular ./packages/mf-matcher/src/index.js
✔ [58/58] Analyze done!
• Circular Dependencies
  ✅ Congratulations, no circular dependency was found in your project.

npx dpdm --no-warning --no-tree circular ./packages/mf-parser/src/index.ts
✔ [49/49] Analyze done!
• Circular Dependencies
  ✅ Congratulations, no circular dependency was found in your project.

npx dpdm --no-warning --no-tree circular ./packages/mf-utilities/src/index.ts
✔ [54/54] Analyze done!
• Circular Dependencies
  ✅ Congratulations, no circular dependency was found in your project.

npx dpdm --no-warning --no-tree circular ./packages/mfs-deconvolution/src/index.js
✔ [74/74] Analyze done!
• Circular Dependencies
  ✅ Congratulations, no circular dependency was found in your project.

npx dpdm --no-warning --no-tree circular ./packages/ms-report/src/index.js
✔ [90/90] Analyze done!
• Circular Dependencies
  ✅ Congratulations, no circular dependency was found in your project.

npx dpdm --no-warning --no-tree circular ./packages/ms-spectrum/src/index.js
✔ [152/152] Analyze done!
• Circular Dependencies
  1) packages/emdb/lib/src/index.js -> packages/ms-spectrum/lib/src/index.js -> packages/ms-spectrum/lib/src/Spectrum.js -> packages/ms-spectrum/lib/src/getFragmentPeaks.js
  2) packages/emdb/lib/src/index.js -> packages/ms-spectrum/lib/src/index.js -> packages/ms-spectrum/lib/src/jsgraph/index.js -> packages/ms-spectrum/lib/src/jsgraph/getPeaksAnnotation.js

npx dpdm --no-warning --no-tree circular ./packages/nucleotide/src/index.js
✔ [64/64] Analyze done!
• Circular Dependencies
  ✅ Congratulations, no circular dependency was found in your project.

npx dpdm --no-warning --no-tree circular ./packages/number-treemap/src/index.js
✔ [2/2] Analyze done!
• Circular Dependencies
  ✅ Congratulations, no circular dependency was found in your project.

npx dpdm --no-warning --no-tree circular ./packages/octochemdb/src/index.js
✔ [172/172] Analyze done!
• Circular Dependencies
  1) packages/ms-spectrum/lib/src/index.js -> packages/ms-spectrum/lib/src/Spectrum.js -> packages/ms-spectrum/lib/src/getFragmentPeaks.js -> packages/emdb/lib/src/index.js

npx dpdm --no-warning --no-tree circular ./packages/peptide/src/index.js
✔ [64/64] Analyze done!
• Circular Dependencies
  ✅ Congratulations, no circular dependency was found in your project.

@tpoisseau
Copy link
Collaborator

So it seems we need to solve this last circular deps between emdb and ms-spectrum

@tpoisseau
Copy link
Collaborator

tpoisseau commented Dec 19, 2024

Is it OK if I move packages/emdb/src/from/fromMonoisotopicMass.js to packages/ms-spectrum/src/fromMonoisotopicMass ?

ms-spectrum depend on emdb only to do emdb.fromMonoisotopicMass

emdb depend on ms-spectrum to do experimentalSpectrum.normedY(), this.experimentalSpectrum = new Spectrum(data, { threshold }), get experimentalSpectrum.dataandexperimentalSpectrum.sumY()`

I can keep fromMonoisotopicMass in EMDB prototype, but calling ms-spectrum#fromMonoisotopicMass.
Like that, emdb depend on ms-spectrum but ms-spectrum do not depend on emdb

@targos
Copy link
Member Author

targos commented Dec 19, 2024

@lpatiny wdyt?

@lpatiny
Copy link
Member

lpatiny commented Dec 19, 2024

Yes seems ok to me as long as the API does not change and all the tests continue to pass (you will need somehow to duplicate some tests to test fromMonoisotopicMass in ms-spectrum and in emdb)

tpoisseau added a commit that referenced this issue Dec 20, 2024
moved from `emdb` package to remove circular dependency between `emdb` and `ms-spectrum`

it was internal, method was accessible through `EMDB.prototype.fromMonoisotopicMass`

Closes: #70
@tpoisseau tpoisseau linked a pull request Dec 20, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants