Skip to content

Commit

Permalink
Merge pull request #81 from mitobench/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Judith Neukamm committed Aug 16, 2020
2 parents f5d17f4 + ebd698b commit 8acaf5c
Show file tree
Hide file tree
Showing 133 changed files with 7,842 additions and 3,812 deletions.
Empty file modified README.md
100644 → 100755
Empty file.
72 changes: 33 additions & 39 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
group 'com.uni-tuebingen.de.it.mitobench'
version '1.6-beta'
version '1.7-beta'


apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'jacoco'
apply plugin: 'maven'
apply plugin: 'maven-publish'


sourceCompatibility = 1.8



repositories {
jcenter()
maven {
url "http://dl.bintray.com/apeltzer/Mitobench"
}
}

//plugins {
// id 'application'
// id 'org.openjfx.javafxplugin' version '0.0.8'
// id 'org.beryx.jlink' version '2.12.0'
//}
//
//
//repositories {
// mavenCentral()
// jcenter()
// maven {url 'https://oss.sonatype.org/content/repositories/snapshots'}
//}
//
//version '1.9-beta'

sourceSets {
main {
Expand All @@ -27,18 +42,13 @@ sourceSets {
srcDirs "src/main/resources"
}
}
test {
java {
srcDir 'test'
}
resources {
srcDir 'resources'
}
}
}



dependencies {
//runtimeOnly "org.openjfx:javafx-graphics:$javafx.version:linux"
//implementation 'org.controlsfx:controlsfx:9.0.1-SNAPSHOT'
compile 'org.slf4j:slf4j-simple:+'
compile 'org.apache.poi:poi-ooxml:3.15'
compile 'org.netbeans.html:net.java.html.boot.fx:1.4'
Expand All @@ -51,43 +61,27 @@ dependencies {
compile group: 'org.javafxdata', name: 'datafx-flow', version: '8.0b5'
compile group: 'guru.nidi', name: 'graphviz-java', version: '0.8.10'
compile group: 'org.ojalgo', name: 'ojalgo', version: '47.2.0'
//compile files('src/main/resources/jars/FstCalculator-0.1.20.jar')
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.1'
compile files('src/main/resources/jars/FstCalculator-0.1.21.jar')
compile files('src/main/resources/jars/PhylotreeParser-0.4.4.jar')
compile files('src/main/resources/jars/PGDSpider2.jar')
compile files('src/main/resources/jars/haplogrep-2.1.23.jar')
compile files('src/main/resources/jars/haplogrep-2.2.5.jar')
compile files('src/main/resources/jars/reverse-country-code.jar')

}

//javafx {
// version = "14"
// modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.graphics', 'javafx.base', 'javafx.media', 'javafx.swing','javafx.web']
//}

task copyTestResources(type: Copy) {
from "${projectDir}/src/test/resources"
into "${buildDir}/classes/test"
}
processTestResources.dependsOn copyTestResources

//Required for headless testing here!!
test {
if (!project.hasProperty("noHeadless")) {
jvmArgs = ["-Dheadless=true"]
} else {
jvmArgs = ["-Dheadless=false"]
}
}
//mainClassName = "Launcher"

jar {

manifest {
attributes("Implementation-Title": "MitoBench",
"Implementation-Version": version, "main-Class": "MitoBenchStarter")
attributes 'Main-Class': 'Launcher'
}
doFirst {
from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } }
}
}


jacocoTestReport {
reports {
xml.enabled true
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
Empty file modified docs/contents/database/database.rst
100644 → 100755
Empty file.
Empty file modified docs/contents/database/datacompleter.rst
100644 → 100755
Empty file.
Empty file modified docs/contents/database/template.csv
100644 → 100755
Empty file.
Empty file modified docs/contents/images/mitoBenchLogo.jpg
100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/contents/images/mitobenchMainWindow.png
100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/contents/jar/MitoBench-1.3-beta.jar
100644 → 100755
Empty file.
Empty file modified docs/contents/workbench/images/column_order.png
100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/contents/workbench/images/database_filtering.png
100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/contents/workbench/images/database_row_selection.png
100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/contents/workbench/images/dataselection.png
100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/contents/workbench/images/export_window.png
100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/contents/workbench/images/mitobench_search.png
100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/contents/workbench/workbench.rst
100644 → 100755
Empty file.
Empty file modified logo/mitoBenchLogo.jpg
100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions src/main/java/Launcher.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import javafx.application.Application;
import view.MitoBenchWindow;


public class Launcher {

public static void main(String[] args) {
new Thread(() -> Application.launch(MitoBenchWindow.class)).start();

}
}
20 changes: 0 additions & 20 deletions src/main/java/MitoBenchStarter.java

This file was deleted.

5 changes: 2 additions & 3 deletions src/main/java/analysis/FstCalculationRunner.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package analysis;

import analysis.fstcalculation.FstCalculator;
import Main.FstCalculator;
import javafx.collections.ObservableList;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.Tab;
Expand Down Expand Up @@ -114,8 +114,7 @@ public void run(boolean runSlatkin, boolean runReynolds, String field_level_miss
"Pairwise Difference",
numberOfPermutations,
gamma_a,
significance,
LOG
significance
);

fsts = fstCalculator.runCaclulations();
Expand Down
85 changes: 39 additions & 46 deletions src/main/java/analysis/HaplotypeCaller.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
import Logging.LogClass;
import genepi.haplogrep.main.Haplogrep;
import htsjdk.samtools.SAMException;
import io.Exceptions.HSDException;
import io.reader.HSDInput;
import io.reader.HSDParser;
import io.writer.MultiFastaWriter;
import org.apache.log4j.Logger;
import model.MTStorage;
import controller.TableControllerUserBench;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;


Expand All @@ -25,16 +23,23 @@ public class HaplotypeCaller {
private MTStorage mtStorage;
private Logger LOG;
private String phylotreeVersion = "17";
private String haplogrepversion = "2.2.5";


public HaplotypeCaller(TableControllerUserBench tableControllerUserBench, LogClass logClass){

this.mtStorage = tableControllerUserBench.getDataTable().getMtStorage();
this.tableController = tableControllerUserBench;
LOG = logClass.getLogger(this.getClass());


}


/**
* Run HaploGrep2.
*
* @param lineage Lineage parameter. Can be true or false (default = false). Creates dot file ('tree').
*/
public void call(String lineage) throws IOException {
String file = "multifasta.fasta";
//System.out.println("Writing fasta sequences to " + file);
Expand All @@ -44,30 +49,52 @@ public void call(String lineage) throws IOException {
MultiFastaWriter multiFastaWriter = new MultiFastaWriter(this.mtStorage, tableController.getSelectedRows(), true);
multiFastaWriter.writeData(file, tableController);

start(file, lineage);
// todo: error handling when task cancelled

String[] command = new String[] {
"classify",
"--format", "fasta",
"--in",file,
"--out", "haplogroups.hsd",
"--extend-report",
lineage};

try {
Haplogrep haplogrep = new Haplogrep(command);
haplogrep.start();

LOG.info("Calculate Haplogroups with Phylotree version " + phylotreeVersion + " and haplogrep-" + haplogrepversion);
System.out.println("Haplogrep finished");
} catch (SAMException e){
System.err.println("Task cancelled");
}
}


/**
* Parse HaploGrep2 output file and update data.
*/
public void update() {

//HSDReaderIntern hsd_reader = new HSDReaderIntern("haplogroups.hsd", LOG, "Haplogroup Phylotree17", "Haplotype Phlyotree17");
HSDInput hsdInput = null;
HSDParser hsdInput;

try {
if(new File("haplogroups.hsd").exists()){
hsdInput = new HSDInput("haplogroups.hsd", LOG);
hsdInput = new HSDParser("haplogroups.hsd", LOG, null);
tableController.updateTable(hsdInput.getCorrespondingData());
} else {
LOG.info("Haplogrep did not run properly");
LOG.info("HaploGrep2 did not run properly, 'haplogroups.hsd' does not exists.");
}
} catch (IOException e) {
e.printStackTrace();
} catch (HSDException e) {
} catch (Exception e) {
System.out.println("HaploGrep2 did not run properly, 'haplogroups.hsd' does not exists.");
e.printStackTrace();
}

}

/**
* Delete all temporary files that were created while running HaploGrep2
*/
public void deleteTmpFiles() {

try {
Expand All @@ -87,38 +114,4 @@ public void deleteTmpFiles() {

}


private void start(String f, String lineage) {
// todo: error handling when task cancelled

String[] command = new String[] {
"--format", "fasta",
"--in",f,
"--out", "haplogroups.hsd",
"--extend-report",
lineage};


Haplogrep haplogrep = new Haplogrep(command);
try {
haplogrep.start();

LOG.info("Calculate Haplogroups with Phylotree version " + phylotreeVersion + " and haplogrep-2.1.18");
} catch (SAMException e){
System.err.println("Task cancelled");

}

// delete all temporary files

if(new File(f).exists()) {
try {
Files.delete(new File(f).toPath());
} catch (IOException e) {
e.printStackTrace();
}
}

}

}
Empty file modified src/main/java/analysis/PCA_Analysis.java
100644 → 100755
Empty file.

0 comments on commit 8acaf5c

Please sign in to comment.