comparison libs/compare_and_change_two_fastq_id.py @ 0:6895de35a263 draft

planemo upload commit 844a891e4eaf732830043204ac636907eefb011d-dirty
author charles_s_test
date Thu, 19 Oct 2017 18:16:51 -0400
parents
children 3d6680af0bec
comparison
equal deleted inserted replaced
-1:000000000000 0:6895de35a263
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)