public LayerMapView(DataSetLayerOverview dataSetLayerOverview) { String[] chromosomes = new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "X" }; List<String> validNames = Arrays.asList(new String[] {"positionPeakBP", "geneStartBP"}); selectedPositionColumnX = validNames.get(0); selectedPositionColumnY = validNames.get(1); expressionQtlTrackX = new ExpressionQtlTrack("eQTL", dataSetLayerOverview.layerKey, selectedPositionColumnX); expressionQtlTrackY = new ExpressionQtlTrack("eQTL", dataSetLayerOverview.layerKey, selectedPositionColumnY); final GenomeDisplayTrack<?>[] tracksX = new GenomeDisplayTrack[] { new BasepairPositionTrack(), new ChromosomeBandTrack(), new ContigTrack(), new TranscriptTrack(), expressionQtlTrackX }; this.scrollerX = new GenomeDisplayScroller(tracksX, chromosomes[0], false, "scrollX"); final GenomeDisplayTrack<?>[] tracksY = new GenomeDisplayTrack[] { new BasepairPositionTrack(), new ChromosomeBandTrack(), new ContigTrack(), new TranscriptTrack(), expressionQtlTrackY }; this.scrollerY = new GenomeDisplayScroller(tracksY, chromosomes[0], true, "scrollY"); contents = new GenomeDisplayScroller2D(dataSetLayerOverview, "scroll2d"); contents.selectedPositionColumnX = selectedPositionColumnX; contents.selectedPositionColumnY = selectedPositionColumnY; initWidget(uiBinder.createAndBindUi(this)); for (String string : chromosomes) { if (string.equals("X")) chromosome.addItem("X Chromosome", string); else chromosome.addItem("Chromosome " + string, string); } for (String columName : dataSetLayerOverview.columns) { if (validNames.contains(columName)) { positionColumnX.addItem(columName); positionColumnY.addItem(columName); } } positionColumnX.setSelectedIndex(0); positionColumnY.setSelectedIndex(1); }
@UiHandler("positionColumnY") public void onChangePositionColumnY(ChangeEvent event) { selectedPositionColumnY = positionColumnX.getValue(positionColumnY.getSelectedIndex()); contents.selectedPositionColumnY = selectedPositionColumnY; expressionQtlTrackY.setPositionColumn(selectedPositionColumnY); // force refresh onChangeChromosome(null); }
@UiHandler("scrollerY") public void onScrollY(ValueChangeEvent<GenomeRange> event) { contents.rangeY.pixelLength = contents.getElement().getClientHeight(); contents.rangeY.update(event.getValue()); }
@UiHandler("scrollerX") public void onScrollX(ValueChangeEvent<GenomeRange> event) { contents.rangeX.pixelLength = contents.getElement().getClientWidth(); contents.rangeX.update(event.getValue()); }