Skip to content

Commit ca0a073

Browse files
authored
Merge pull request #301 from ProgrammingLife2017/rip-annotations
R.I.P. annotations
2 parents 1a3f3f0 + db19522 commit ca0a073

File tree

9 files changed

+12
-632
lines changed

9 files changed

+12
-632
lines changed

src/main/java/programminglife/gui/controller/GuiController.java

+1-56
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@
2929
import programminglife.gui.Alerts;
3030
import programminglife.gui.NumbersOnlyListener;
3131
import programminglife.gui.ResizableCanvas;
32-
import programminglife.model.Feature;
3332
import programminglife.model.GenomeGraph;
3433
import programminglife.model.drawing.DrawableEdge;
3534
import programminglife.model.drawing.DrawableNode;
3635
import programminglife.model.drawing.DrawableSegment;
37-
import programminglife.parser.AnnotationParser;
3836
import programminglife.parser.GraphParser;
3937
import programminglife.parser.ProgressCounter;
4038
import programminglife.utility.Console;
@@ -45,7 +43,6 @@
4543
import java.io.File;
4644
import java.io.IOException;
4745
import java.nio.charset.Charset;
48-
import java.util.Map;
4946
import java.util.Observable;
5047
import java.util.Observer;
5148
import java.util.Random;
@@ -61,13 +58,11 @@ public class GuiController implements Observer {
6158

6259
//FXML imports.
6360
@FXML private MenuItem btnOpenGFA;
64-
@FXML private MenuItem btnOpenGFF;
6561
@FXML private MenuItem btnQuit;
6662
@FXML private MenuItem btnBookmarks;
6763
@FXML private MenuItem btnAbout;
6864
@FXML private MenuItem btnInstructions;
6965
@FXML private Menu menuRecentGFA;
70-
@FXML private Menu menuRecentGFF;
7166

7267
@FXML private RadioMenuItem btnSNP;
7368
@FXML private RadioMenuItem btnConsole;
@@ -97,12 +92,9 @@ public class GuiController implements Observer {
9792
private double scale;
9893
private GraphController graphController;
9994
private RecentFileController recentFileControllerGFA;
100-
private RecentFileController recentFileControllerGFF;
10195
private MiniMapController miniMapController;
10296
private File file;
103-
private final File recentFileGFA = new File("RecentGFA.txt");
104-
private final File recentFileGFF = new File("RecentGFF.txt");
105-
private Map<String, Feature> features;
97+
private File recentFileGFA = new File("RecentGFA.txt");
10698
private Thread parseThread;
10799

108100
private final ExtensionFilter extFilterGFF = new ExtensionFilter("GFF files (*.gff)", "*.GFF");
@@ -124,8 +116,6 @@ private void initialize() {
124116

125117
this.recentFileControllerGFA = new RecentFileController(this.recentFileGFA, this.menuRecentGFA);
126118
this.recentFileControllerGFA.setGuiController(this);
127-
this.recentFileControllerGFF = new RecentFileController(this.recentFileGFF, this.menuRecentGFF);
128-
this.recentFileControllerGFF.setGuiController(this);
129119
initMenuBar();
130120
initBookmarkMenu();
131121
initLeftControlpanelScreenModifiers();
@@ -168,29 +158,6 @@ public GraphParser openFile(File file) {
168158
return null;
169159
}
170160

171-
/**
172-
* Open and parse a GFF file.
173-
*
174-
* @param file The {@link File} to open.
175-
* @return AnnotationParser to be notified when finished.
176-
*/
177-
private AnnotationParser openAnnotationFile(File file) {
178-
AnnotationParser annotationParser = null;
179-
if (file != null) {
180-
Console.println("Opening annotation " + file);
181-
annotationParser = new AnnotationParser(file);
182-
annotationParser.addObserver(this);
183-
annotationParser.getProgressCounter().addObserver(this);
184-
185-
if (this.parseThread != null) {
186-
this.parseThread.interrupt();
187-
}
188-
this.parseThread = new Thread(annotationParser);
189-
this.parseThread.start();
190-
}
191-
return annotationParser;
192-
}
193-
194161
@Override
195162
public void update(Observable o, Object arg) {
196163
if (o instanceof GraphParser) {
@@ -208,11 +175,6 @@ public void update(Observable o, Object arg) {
208175
String msg = (String) arg;
209176
Platform.runLater(() -> ProgrammingLife.getStage().setTitle(msg));
210177
}
211-
} else if (o instanceof AnnotationParser) {
212-
if (arg instanceof Map) {
213-
Console.println("[%s] Annotations parsed.", Thread.currentThread().getName());
214-
this.setFeatures(((AnnotationParser) o).getFeatures());
215-
}
216178
} else if (o instanceof ProgressCounter) {
217179
progressBar.setVisible(true);
218180
ProgressCounter progress = (ProgressCounter) o;
@@ -268,12 +230,6 @@ private void fileChooser(ExtensionFilter filter, boolean isGFA) {
268230
File recentFileGFA = recentFileControllerGFA.getRecentFile();
269231
recentFileControllerGFA.updateRecent(recentFileGFA, file);
270232
});
271-
} else {
272-
this.openAnnotationFile(file);
273-
Platform.runLater(() -> {
274-
File recentFileGFF = recentFileControllerGFA.getRecentFile();
275-
recentFileControllerGFF.updateRecent(recentFileGFF, file);
276-
});
277233
}
278234
}
279235
}
@@ -286,8 +242,6 @@ private void fileChooser(ExtensionFilter filter, boolean isGFA) {
286242
private void initMenuBar() {
287243
btnOpenGFA.setOnAction((ActionEvent event) -> fileChooser(extFilterGFA, true));
288244
btnOpenGFA.setAccelerator(new KeyCodeCombination(KeyCode.O, KeyCodeCombination.CONTROL_DOWN));
289-
btnOpenGFF.setOnAction((ActionEvent event) -> fileChooser(extFilterGFF, false));
290-
btnOpenGFF.setAccelerator(new KeyCodeCombination(KeyCode.P, KeyCodeCombination.CONTROL_DOWN));
291245

292246
btnQuit.setOnAction(event -> Alerts.quitAlert());
293247
btnQuit.setAccelerator(new KeyCodeCombination(KeyCode.Q, KeyCodeCombination.CONTROL_DOWN));
@@ -584,7 +538,6 @@ private void initRightSearchTab() {
584538
searchTab.setDisable(true);
585539
searchTab.setOnSelectionChanged(event -> {
586540
highlightController.initGenome();
587-
highlightController.initAnnotations();
588541
highlightController.initMinMax();
589542
});
590543
} catch (IOException e) {
@@ -790,14 +743,6 @@ public void setFile(File file) {
790743
this.file = file;
791744
}
792745

793-
private void setFeatures(Map<String, Feature> features) {
794-
this.features = features;
795-
}
796-
797-
Map<String, Feature> getFeatures() {
798-
return this.features;
799-
}
800-
801746
GraphController getGraphController() {
802747
return this.graphController;
803748
}

src/main/java/programminglife/gui/controller/HighlightController.java

+1-33
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
import javafx.scene.paint.Color;
88
import programminglife.gui.AutoCompleteTextField;
99
import programminglife.gui.NumbersOnlyListener;
10-
import programminglife.model.Annotation;
11-
import programminglife.model.Feature;
12-
13-
import java.util.LinkedHashSet;
14-
import java.util.Set;
15-
import java.util.stream.Collectors;
1610

1711
/**
1812
* Controller class for the highlights.
@@ -25,7 +19,6 @@ public class HighlightController {
2519

2620
@FXML private Button btnHighlight;
2721
@FXML private AutoCompleteTextField txtGenome;
28-
@FXML private AutoCompleteTextField txtAnnotations;
2922
@FXML private TextField txtMin;
3023
@FXML private TextField txtMax;
3124
@FXML private CheckBox checkMin;
@@ -67,31 +60,6 @@ public void initGenome() {
6760
txtGenome.getEntries().addAll(graphController.getGraph().getGenomeNames());
6861
}
6962

70-
/**
71-
* Initializes the annotations.
72-
*/
73-
public void initAnnotations() {
74-
txtAnnotations.getEntries().clear();
75-
if (guiController.getFeatures() != null) {
76-
txtAnnotations.getEntries().addAll(guiController.getFeatures().keySet());
77-
78-
Set<Set<Annotation>> c = guiController.getFeatures()
79-
.values()
80-
.stream()
81-
.map(Feature::getAnnotations)
82-
.collect(Collectors.toSet());
83-
84-
Set<String> search = new LinkedHashSet<>();
85-
86-
c.forEach(setOfAnno -> setOfAnno.forEach(anno -> anno.getTextFields().forEach((key, value) -> {
87-
search.add(key);
88-
search.addAll(value);
89-
})));
90-
91-
txtAnnotations.getEntries().addAll(search);
92-
}
93-
}
94-
9563
/**
9664
* Initializes the Min and Max field + checkbox.
9765
*/
@@ -144,7 +112,7 @@ void setGraphController(GraphController graphController) {
144112
this.graphController = graphController;
145113
}
146114

147-
public void setGUIController(GuiController guiController) {
115+
void setGUIController(GuiController guiController) {
148116
this.guiController = guiController;
149117
}
150118
}

src/main/java/programminglife/model/Annotation.java

-163
This file was deleted.

0 commit comments

Comments
 (0)