-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
6,954 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
include config | ||
|
||
UNAME := $(shell uname) | ||
ifeq ($(UNAME), Darwin) | ||
libt=-dynamiclib | ||
else | ||
libt=-shared | ||
endif | ||
copy: libPrimer3.so | ||
-(cp libPrimer3.so dist/) | ||
libPrimer3.so: thal.o oligotm.o | ||
gcc $(libt) -o $@ edu_msu_cme_rdp_primerdesign_utils_Primer3Wrapper.c thal.o oligotm.o -I$(java_jni_include) -I$(java_jni_include_os) -I. -lm | ||
#gcc -shared -fPIC -o $@ edu_msu_cme_rdp_primerdesign_utils_Primer3Wrapper.c thal.o oligotm.o -I$(java_jni_include) -I$(java_jni_include_os) -I. -lm | ||
thal.o: | ||
gcc -c -Wall -fPIC -o $@ thal.c | ||
|
||
oligotm.o: | ||
gcc -c -Wall -fPIC -o $@ oligotm.c -lm | ||
|
||
clean: | ||
rm *.o | ||
rm *.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* | ||
* Copyright (C) 2015 RDPStaff gunturus at msu dot edu> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package edu.msu.cme.rdp.primerdesign.utils; | ||
|
||
/** | ||
* | ||
* @author gunturus | ||
*/ | ||
|
||
public class Primer3Wrapper { | ||
private double _mv = 50.0; | ||
private double _dv = 0.0; | ||
private double _dntp = 0.0; | ||
private double _dna = 50.0; | ||
private double _temp_c = 37; | ||
private int _max_loop = 30; | ||
private int _tm_method = 0; | ||
private int _salt_method = 0; | ||
|
||
public Primer3Wrapper() { | ||
System.load("/home/gunturus/PrimerDesign/jni/libPrimer3.so"); | ||
initThermoPath("/home/gunturus/PrimerDesign/jni/"); | ||
} | ||
|
||
private static native void initThermoPath(String path); | ||
private native double calcTm(String seq, double d, double mv, double dv, double n, int tm_method, int salt_method); | ||
private native double calcThermo(String seq1, String seq2, int maxLoop, double mv, double dv, double dntp, double dna_conc, double temp, int temponly, int dimer, int aligntype); | ||
|
||
public double calcTemp(String seq) { | ||
return calcTm(seq, _dna, _mv, _dv, _dntp, _tm_method, _salt_method); | ||
} | ||
|
||
public double calcSpecial(String seq1, String seq2, String type) { | ||
if (type.equals("HAIRPIN")) { | ||
return calcThermo(seq1, seq2, _max_loop, _mv, _dv, _dntp, _dna, _temp_c, 1, 0, 4); | ||
} | ||
else { | ||
return calcThermo(seq1, seq2, _max_loop, _mv, _dv, _dntp, _dna, _temp_c, 1, 0, 1); | ||
} | ||
} | ||
|
||
public double calcHairpinTm(String seq) { | ||
return calcSpecial(seq,seq,"HAIRPIN"); | ||
} | ||
|
||
public double calcHomodimerTm(String seq) { | ||
return calcSpecial(seq,seq,"ANY"); | ||
} | ||
|
||
public double calcHetrodimerTm(String seq1, String seq2) { | ||
return calcSpecial(seq1, seq2, "ANY"); | ||
} | ||
|
||
public void setMv(int mv) { | ||
_mv = mv; | ||
} | ||
|
||
public void setDv(double dv) { | ||
_dv = dv; | ||
} | ||
|
||
public void setDntp(double dntp) { | ||
_dntp = dntp; | ||
} | ||
|
||
public void setDna(double dna) { | ||
_dna = dna; | ||
} | ||
|
||
public void setTemp(double temp) { | ||
_temp_c = temp; | ||
} | ||
|
||
public void setMaxLoop(int maxloop) { | ||
_max_loop = maxloop; | ||
} | ||
|
||
public static void main(String[] args) { | ||
|
||
Primer3Wrapper primer3 = new Primer3Wrapper(); | ||
|
||
double ret = primer3.calcHomodimerTm("GACGTAGAACAAGATCCGGAT"); | ||
System.out.println(ret); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#What is your operating system (options: mac or linux) | ||
os=mac | ||
#location of the Java JNI include directory | ||
java_jni_include=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/include/ | ||
#location of the Java JNI operating system specific directory. This will be in same directory as java_jni_include. | ||
java_jni_include_os=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/include/darwin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#include "edu_msu_cme_rdp_primerdesign_utils_Primer3Wrapper.h" | ||
#include "oligotm.h" | ||
#include "thal.h" | ||
#include <unistd.h> | ||
#include <string.h> | ||
|
||
JNIEXPORT void JNICALL Java_edu_msu_cme_rdp_primerdesign_utils_Primer3Wrapper_initThermoPath(JNIEnv *env, jclass obj, jstring path) { | ||
thal_results o; | ||
char *configpath = (char *)(*env)->GetStringUTFChars(env, path, 0); | ||
strcat(configpath,"/primer3_config/"); | ||
|
||
//printf("%s\n",configpath); | ||
int i = get_thermodynamic_values("/home/gunturus/PrimerDesign/jni/primer3_config/",&o); | ||
//printf("%s\n",o.msg); | ||
} | ||
|
||
JNIEXPORT jdouble JNICALL Java_edu_msu_cme_rdp_primerdesign_utils_Primer3Wrapper_calcTm(JNIEnv *env, jobject obj, jstring seq, jdouble d, jdouble mv, jdouble dv, jdouble dntp, jint tm_method, jint salt_method) { | ||
|
||
const char *sequence = (*env)->GetStringUTFChars(env, seq, 0); | ||
tm_method_type tm = tm_method; | ||
salt_correction_type salt = salt_method; | ||
|
||
double ret = oligotm(sequence, d, mv, dv, dntp, tm, salt); | ||
|
||
(*env)->ReleaseStringUTFChars(env, seq, sequence); | ||
|
||
return ret; | ||
} | ||
|
||
JNIEXPORT jdouble JNICALL Java_edu_msu_cme_rdp_primerdesign_utils_Primer3Wrapper_calcThermo(JNIEnv *env, jobject obj, jstring seq1, jstring seq2, jint maxloop, jdouble mv, jdouble dv, jdouble dntp, jdouble dna_conc, jdouble temp, jint temponly, jint dimer, jint aligntype) { | ||
|
||
|
||
const char *sequence1 = (*env)->GetStringUTFChars(env,seq1,0); | ||
const char *sequence2 = (*env)->GetStringUTFChars(env,seq2,0); | ||
|
||
thal_args a; | ||
|
||
a.debug = 0; | ||
a.type = (thal_alignment_type) aligntype; | ||
a.maxLoop = maxloop; | ||
a.mv = mv; | ||
a.dv = dv; | ||
a.dntp = dntp; | ||
a.dna_conc = dna_conc; | ||
a.temp = temp; | ||
a.temponly = temponly; | ||
a.dimer = dimer; | ||
|
||
thal_results o; | ||
|
||
thal(sequence1, sequence2, &a, &o); | ||
|
||
(*env)->ReleaseStringUTFChars(env, seq1, sequence1); | ||
(*env)->ReleaseStringUTFChars(env, seq2, sequence2); | ||
/* | ||
printf("%i\n",a.type); | ||
printf("%i\n",a.maxLoop); | ||
printf("%s\n",o.msg); | ||
printf("%f\n",o.temp); | ||
printf("%s\n",sequence1); | ||
printf("%s\n",sequence2); | ||
printf("%f\n",a.temp); | ||
printf("%f\n",a.mv); | ||
printf("%f\n",a.dv); | ||
printf("%f\n",a.dntp); | ||
printf("%f\n",a.dna_conc); | ||
printf("%i\n",a.temponly); | ||
printf("%i\n",a.dimer); | ||
*/ | ||
|
||
return o.temp; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.