API access to primer3 calculations
I'm writing a custom plugin for designing primers. Is it possible to call primer3 through the Geneious API?
In particular I'd like access to the Tm calculation, but some of the other calculations might be useful also.
0
-
Here's a method you can copy which calls our primer3 plugin:
/**
* Calls the same operation as "Characteristics for Selection..." to calculate Tm using primer3
* @param sequence
* @return the melting temperature or -1 if the sequence is empty
* @throws DocumentOperationException e.g. if sequence is too long for primer3 (over 36bp)
*/
private static double calculateMeltingTemperature(CharSequence sequence) throws DocumentOperationException {
if (sequence == null || sequence.length() == 0) return -1;
if (sequence.length() > 36) throw new DocumentOperationException("Sequence too long for primer3");
SequenceAnnotationGenerator generator = PluginUtilities.getSequenceAnnotationGenerator("com.biomatters.plugins.primerDesign.CharacteristicsAnnotationGenerator");
if (generator == null) throw new DocumentOperationException("The primer design plugin is not enabled.");
AnnotatedPluginDocument apdDoc = DocumentUtilities.createAnnotatedPluginDocument(new DefaultNucleotideSequence("temp", sequence));
SequenceAnnotationGenerator.SelectionRange selectionRange = new SequenceAnnotationGenerator.SelectionRange(0, 0, 0, sequence.length() - 1);
List<List<SequenceAnnotation>> characteristicAnnotations;
Options annealingCharacteristicOptions = generator.getOptions(new AnnotatedPluginDocument[] {apdDoc}, selectionRange);
characteristicAnnotations = generator.generateAnnotations(selectionRange, ProgressListener.EMPTY, annealingCharacteristicOptions, apdDoc);
String tm = characteristicAnnotations.get(0).get(0).getQualifierValue("Tm");
//other characteristics such as hairpin can be retrieved here
return Double.parseDouble(tm.split("-")[0]);
}0
Please sign in to leave a comment.
Comments
1 comment