File: interleave-fasta.py

package info (click to toggle)
ray 2.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,128 kB
  • ctags: 6,125
  • sloc: cpp: 49,973; sh: 325; makefile: 278; python: 168
file content (34 lines) | stat: -rwxr-xr-x 771 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/python
# encoding:utf8
# author: Sébastien Boisvert
# part of Ray distribution
"""This script takes two fasta files and interleaves them

Usage:
    interleave-fasta.py fasta_file1 fasta_file2
"""

# Importing modules
import sys

# Main
if __name__ == '__main__':
    try:
        file1 = sys.argv[1]
        file2 = sys.argv[2]
    except:
        print __doc__
        sys.exit(1)
    
    with open(file1) as f1:
        with open(file2) as f2:
            while True:
                line = f1.readline()
                if line.strip() == "":
                    break
                
                print line.strip()
                print f1.readline().strip()
                print f2.readline().strip()
                print f2.readline().strip()