From 8ff88529a71144e15b701b75ed6b24d31b5995a0 Mon Sep 17 00:00:00 2001 From: farahzk Date: Wed, 5 Mar 2014 02:29:16 -0600 Subject: [PATCH] Create NeedlemanWunsch.py This version takes two input files along with a similarity score matrix and gap penalty through terminal/command line --- NeedlemanWunsch.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 NeedlemanWunsch.py diff --git a/NeedlemanWunsch.py b/NeedlemanWunsch.py new file mode 100644 index 0000000..b0fa863 --- /dev/null +++ b/NeedlemanWunsch.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +import sys, string +import alignment #import the file with the functions + +# Command-line arguments for 3 files and one integer. +f1 = open(sys.argv[1], 'r') #first fasta/txt file +f1.readline() +seq1 = '' +for line in f1: + seq1 += string.strip(line) + +f2 = open(sys.argv[2], 'r') #second fasta/txt file +seq2 = '' +f2.readline() +for line in f2: + seq2 += string.strip(line) + +alignment.needleWunsch(seq1, seq2, sys.argv[3], int(sys.argv[4])) +# sys.argv[3]=substitution matrix file +# sys.argv[4]=gap_penalty.