| 1 |
// This file is part of A2Amapper. |
| 2 |
// Copyright (c) 2004 Applera Corporation |
| 3 |
// Author: Clark Mobarry |
| 4 |
// |
| 5 |
// This program is free software; you can redistribute it and/or modify |
| 6 |
// it under the terms of the GNU General Public License as published by |
| 7 |
// the Free Software Foundation; either version 2 of the License, or |
| 8 |
// (at your option) any later version. |
| 9 |
// |
| 10 |
// This program is distributed in the hope that it will be useful, |
| 11 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
// GNU General Public License for more details. |
| 14 |
// |
| 15 |
// You should have received (LICENSE.txt) a copy of the GNU General Public |
| 16 |
// License along with this program; if not, write to the Free Software |
| 17 |
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 |
|
| 19 |
#include <Python.h> |
| 20 |
#include "halign.H" |
| 21 |
|
| 22 |
H_Alignment_t aln = { 0, 0, 0, 0, 0, 0, 0, 0}; |
| 23 |
|
| 24 |
static PyObject * |
| 25 |
spam_halignStart(PyObject *self, PyObject *args) { |
| 26 |
char *seq1 = 0L; |
| 27 |
char *seq2 = 0L; |
| 28 |
|
| 29 |
if (!PyArg_ParseTuple(args, "ss", &seq1, &seq2)) |
| 30 |
return(NULL); |
| 31 |
|
| 32 |
halignStart(seq1, seq2, &aln); |
| 33 |
|
| 34 |
Py_INCREF(Py_None); |
| 35 |
return(Py_None); |
| 36 |
} |
| 37 |
|
| 38 |
static PyObject * |
| 39 |
spam_halignDedash( PyObject *self, PyObject *args) { |
| 40 |
int bgn1=0, bgn2=0, len1=0, len2=0, nmat=0; |
| 41 |
|
| 42 |
if (iterateUngappedAlignSharpEnds(&aln, bgn1, bgn2, len1, len2, nmat)) |
| 43 |
return(Py_BuildValue("(iiiii)", bgn1, bgn2, len1, len2, nmat)); |
| 44 |
|
| 45 |
Py_INCREF(Py_None); |
| 46 |
return(Py_None); |
| 47 |
} |
| 48 |
|
| 49 |
static |
| 50 |
PyMethodDef |
| 51 |
registration_table[] = { |
| 52 |
{"halignStart", spam_halignStart, METH_VARARGS, "initialize halign"}, |
| 53 |
{"halignDedash", spam_halignDedash, METH_VARARGS, "dedashed subalignment"}, |
| 54 |
{NULL, NULL, 0, NULL} |
| 55 |
}; |
| 56 |
|
| •57 |
static struct PyModuleDef cModMethods = |
| 58 |
{ |
| 59 |
PyModuleDef_HEAD_INIT, |
| 60 |
"halign", /* name of module */ |
| 61 |
"", /* module documentation, may be NULL */ |
| 62 |
-1, /* size of per-interpreter state of the module, or -1 if the module keeps state in global variables. */ |
| 63 |
registration_table |
| 64 |
}; |
| 65 |
|
| 66 |
extern "C" |
| •67 |
void PyInit_halign(void) { |
| 68 |
PyModule_Create(&cModMethods); |
| 69 |
} |