Skip to content
New issue

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

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

Already on GitHub? # to your account

Vue2 templates #99

Open
thedam opened this issue May 17, 2024 · 1 comment
Open

Vue2 templates #99

thedam opened this issue May 17, 2024 · 1 comment

Comments

@thedam
Copy link

thedam commented May 17, 2024

Hey, I'd like to run Genoverese with Vue2 (Django backend)
I have such base code:

<template>
	<div class="container">
		<br> <br>
		<div ref="genoverseContainer" style="width: 800px; height: 400px;">
		</div>
	</div>
</template>

<script>
import Genoverse from 'genoverse';

export default {
	name: 'GenoverseComponent',
	mounted() {

		this.genoverse = new Genoverse({
			container: this.$refs.genoverseContainer,
			genome: 'grch37',
			chr: 1,
			start: 1,
			end: 1000000,
			// url=https://rest.ensembl.org/sequence/region/human/1:1-2000000?content-type=application/json
			plugins: ['controlPanel', 'trackControls'],
			tracks: [
				Genoverse.Track.Scalebar,
				Genoverse.Track.Gene
			]

		});
	},
	beforeDestroy() {
		if (this.genoverse) {
			this.genoverse.destroy();
		}
	}
};
</script>


If I hit "http://localhost:8080/dam37/#/genoverse" in the browser, nothing appears.
But when I modify somtething in .js source code (for example if I add space button somewhere and save it, then tracks appears in the browser. Looks like the displaying finishes, before Genoverse is fully loaded. How to overcome it? I've tried with this.$nextTick( etc, but nothing works.

However, when I run code with such Tracks:

			tracks: [
				// Genoverse.Track.Scalebar,
				// Genoverse.Track.Gene,
				Genoverse.Track.extend({
					name: 'test',
					height: 100,
					featureHeight: 10,
					url: "http://localhost:8080/api/sequence/region/human/1:1-2000000?content-type=application/json",
					featureColor: '#1f77b4',
					bump: true
				}),
			],

Then in the browser after hitting url, immediately apperas the Genoverse track (with
GET http://localhost:8080/api/sequence/region/human/1:1-2000000?content-type=application/json 404 (Not Found), but this is another problem)

How to properly configure it in Vue?

@thedam
Copy link
Author

thedam commented May 17, 2024

ok, I had to add:
Genoverse.configure({}); before new Genoverse

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant