Mercurial > repos > estrain > seqsero_v1
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SeqSero/libs/compare_and_change_two_fastq_id.py Wed Dec 06 15:59:29 2017 -0500 @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +import os,sys +file1=sys.argv[1] +file2=sys.argv[2] + + +def compare_and_change_two_fastq_id(file1,file2): + a=os.popen("head "+file1).read().split("\n") + b=os.popen("head "+file2).read().split("\n") + for x in a: + if x.startswith("@"): + a_title=x.split(" ")[0] + for x in b: + if x.startswith("@"): + b_title=x.split(" ")[0] + if a_title==b_title: + pass + else: + print "changing the title of two seperated fastq files..." + print a_title,b_title + os.system("sed "+"-i 's/.1 / /g' "+file1) + print "finished file1" + os.system("sed "+"-i 's/.2 / /g' "+file2) + print "finished file2" + +compare_and_change_two_fastq_id(file1,file2) \ No newline at end of file