comparison SeqSero/libs/compare_and_change_two_fastq_id.py @ 0:c577b57b7c74 draft

Uploaded
author estrain
date Wed, 06 Dec 2017 15:59:29 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c577b57b7c74
1 #!/usr/bin/env python
2
3 import os,sys
4 file1=sys.argv[1]
5 file2=sys.argv[2]
6
7
8 def compare_and_change_two_fastq_id(file1,file2):
9 a=os.popen("head "+file1).read().split("\n")
10 b=os.popen("head "+file2).read().split("\n")
11 for x in a:
12 if x.startswith("@"):
13 a_title=x.split(" ")[0]
14 for x in b:
15 if x.startswith("@"):
16 b_title=x.split(" ")[0]
17 if a_title==b_title:
18 pass
19 else:
20 print "changing the title of two seperated fastq files..."
21 print a_title,b_title
22 os.system("sed "+"-i 's/.1 / /g' "+file1)
23 print "finished file1"
24 os.system("sed "+"-i 's/.2 / /g' "+file2)
25 print "finished file2"
26
27 compare_and_change_two_fastq_id(file1,file2)