compare腳本

最近因為運行軟件腳本丟失,所以決定以后存到網(wǎng)上,此腳本是比較fastq文件是否相同的行數(shù)序列相同

import gzip

from datetime import datetime

count=1

list1=[]

list2=[]

print("開始。。。。。")

print(datetime.now().strftime('%Y-%m-%d %H:%M:%S'))

f1=gzip.open("/home/huilin_hu/Arabidopsis/fastq/57.fq.gz.split/57.R1.0001.fq.gz","rb")

f2=gzip.open("/home/huilin_hu/Arabidopsis/fastq/57.fq.gz.split/57.R2.0001.fq.gz","rb")

while 1:

? ? line1=f1.readline()

? ? line2=f2.readline()

? # print(line1)

? ? if count%4==1:

? ? ? ? #print(line1)

? ? ? ? id1=str(line1.decode().lstrip("@").split())

? ? ? ? list1=(id1.replace("/1",""))

? ? ? # print(list1)

? ? ? ? id2=str(line2.decode().lstrip("@").split())

? ? ? ? list2=(id2.replace("/2",""))

? ? ? ? #print(list2)

? ? ? ? if list1==list2:

? ? ? ? ? l=list1

? ? ? ? #? print("第%d行內(nèi)容是相同的,內(nèi)容為:%s"%(count,list1))

? ? ? ? else:

? ? ? ? ? print("第%d行內(nèi)容是不同的,內(nèi)容為:%s"%(count,list1))

? ? count+=1

? ? if line1==b'':

? ? ? ? break

print("結(jié)束。。。。。")

print(datetime.now().strftime('%Y-%m-%d %H:%M:%S'))

最后編輯于
?著作權歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

友情鏈接更多精彩內(nèi)容