Commits

Brent Pedersen committed a8ceeac

fix up docs, prep for upload to pypi.

  • Participants
  • Parent commits 4b7e1b9
  • Tags nwalign-0.3.0

Comments (0)

Files changed (3)

File nwalign/nwalign/__init__.py

 sequence alignment using the `Needleman-Wunsch` algorithm. It uses `cython`_ 
 and numpy for speed.
 
-Example Command-Line Usage 
-==========================
-
-
+Command-Line Usage 
+==================
 the nwalign executable is installed to the PATH by setuptools
 ::
 
     AS-FF
 
 
-Usage as a python module
-========================
+Python Usage
+============
+Alignment
+---------
 ::
 
     >>> import nwalign as nw
     >>> nw.global_align("CEELECANTH", "PELICAN", matrix='PAM250')
     ('CEELE-CANTH', '-PEL-ICAN--')
 
+    # with a specified penalty for open and extend.
+    >>> nw.global_align("CEELECANTH", "PELICAN", gap_open=-10, gap_extend=-4, matrix='PAM250')
+    ('CEELECANTH', '-PELICAN--')
 
-the matrix is specified as the full path to an `scoring matrix`_ as
+
+the `matrix` is specified as the full path to an `scoring matrix`_ as
 is distributed with the NCBI toolset.
+
+Scoring
+-------
+get the score of an alignment. (the first 2 args are from an alignment
+and must have the same length.
+::
+
+    >>> nw.score_alignment('CEELECANTH', '-PELICAN--', gap_open=-5,
+    ...                     gap_extend=-2, matrix='PAM250')
+    11
+
+    >>> nw.score_alignment('CEELE-CANTH', '-PEL-ICAN--', gap_open=-5,
+    ...                     gap_extend=-2, matrix='PAM250')
+    6
+
+
 """
 from cnwalign import global_align, global_align_no_matrix, score_alignment
 

File nwalign/nwclient.py

 PORT = 1233
 CHUNK = 32768 * 8
 
-client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-client_socket.connect(('localhost', PORT))
+def main():
+    client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+    client_socket.connect(('localhost', PORT))
 
-for i in xrange(100000):
-    client_socket.send('ASDFFFG ADFFFFG')
-    a = client_socket.recv(CHUNK)
+    for i in xrange(100000):
+        client_socket.send('ASDFFFG ADFFFFG')
+        a = client_socket.recv(CHUNK)
 
-client_socket.close()
+    client_socket.close()
 
-s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-s.connect(('localhost', PORT))
-print "DONE"
+    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+    s.connect(('localhost', PORT))
+    print "DONE"
 
-for i in xrange(100):
-    s.send("--matrix PAM250 --gap_open -10 ASDFFFG ADFFFFGZ")
-    a = s.recv(CHUNK)
-    #print a
+    for i in xrange(100):
+        s.send("--matrix PAM250 --gap_open -10 ASDFFFG ADFFFFGZ")
+        a = s.recv(CHUNK)
+        #print a
 
-s.send('ASDF')
-print s.recv(CHUNK)
-s.send('ASDFFFG ADFFFFGZ')
-print s.recv(CHUNK)
+    s.send('ASDF')
+    print s.recv(CHUNK)
+    s.send('ASDFFFG ADFFFFGZ')
+    print s.recv(CHUNK)
 
-s.send('a')
-print s.recv(CHUNK)
+    s.send('a')
+    print s.recv(CHUNK)
 
-s.send('EXIT')
+    s.send('EXIT')
+
+if __name__ == "__main__":
+    main()

File nwalign/setup.py

 from distutils.extension import Extension
 #from Cython.Distutils import build_ext
 
-version = '0.2.2'
+version = '0.3.0'
 import numpy
 np_include = numpy.get_include()
 try:
       ext_modules=[ Extension("nwalign/cnwalign",
                       sources=["nwalign/cnwalign.c"],
                       include_dirs=[np_include, "nwalign"])],
-      keywords='bioinformatics alignment needleman-wunsch',
+      keywords='sequence bioinformatics alignment needleman-wunsch',
       url='http://bitbucket.org/brentp/biostuff/',
       #download_url='http://bitbucket.org/brentp/biostuff/get/tip.tar.gz',
       author='brentp',