-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseqmask2fq.py
More file actions
25 lines (19 loc) · 737 Bytes
/
seqmask2fq.py
File metadata and controls
25 lines (19 loc) · 737 Bytes
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 9 10:44:16 2019
@author: Cristina
"""
import re
seqmaskfile = input("Introduce el nombre del fichero seqmask a transformar: ")
fqfile = input("Nombre del fichero fq a generar: ")
with open(seqmaskfile, 'r') as sfile:
with open(fqfile, 'w') as ffile:
for line in sfile.readlines():
if '>' in line:
line = line.replace('>', '@') #nuevo identificador
ffile.write(line) #escribimos el identificador
elif re.match('[ACTGN]+$', line.upper()):
#ACTG.. \n + \n ACTG...
string = line + '+' + '\n' + line
ffile.write(string)