Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
1
  • Loading branch information
lindechun committed Sep 7, 2018
1 parent e18b387 commit 4371aeb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions bin/codonAlign.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env python
# coding=utf-8

__author__ = "Lin Dechun"
__copyright__ = "Copyright 2016, BGI Research."
__credits__ = ["Lin Dechun"]
__version__ = "0.0.1"
__maintainer__ = "Lin Dechun"
__email__ = "[email protected]"

from glob import glob
from subprocess import Popen,PIPE
from Bio import SeqIO
import sys,os

if len(sys.argv) != 3:
sys.exit("Usage: python {0} < the path of raw fasta, dir: *.fa> <output path>".format(sys.argv[0]))

for i in glob(sys.argv[1]+'/*.fa'):
filename=os.path.basename(i)
Ofile=sys.argv[2]+'/'+filename

os.system('megacc -a '+os.path.dirname(os.path.realpath(__file__))+'/clustal_align_coding.mao -d '+i+' -o '+Ofile+' -f Fasta -n')
os.system('mv '+Ofile.replace('.fa','.fasta')+' '+Ofile)

record=[]
for line in SeqIO.parse(Ofile,'fasta'):
record.append(line)
SeqIO.write(record,open(Ofile,'w'),"fasta")
Binary file added test/.DS_Store
Binary file not shown.

0 comments on commit 4371aeb

Please sign in to comment.