File: interleave-fastq.py

package info (click to toggle)
ray 2.3.1-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,008 kB
  • sloc: cpp: 49,973; sh: 339; makefile: 281; python: 168
file content (36 lines) | stat: -rwxr-xr-x 827 bytes parent folder | download | duplicates (2)
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
35
36
#!/usr/bin/python3
# encoding:utf8
# author: Sébastien Boisvert
# part of Ray distribution
"""This script takes two fastq 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())
                
                for i in range(3):
                    print(f1.readline().strip())
                
                for i in range(4):
                    print(f2.readline().strip())