YUANya

导航

 
#!/usr/bin/python

from subprocess import check_call
import subprocess
import gzip
'''
$ zcat 160121_I133_FCH5LL5BBXX_L8_RSZADPI007179-107_2.fq.gz |head -4 >o3
$ cat o3
@K00133:143:H5LL5BBXX:8:1101:1194:1103 2:N:0:NCGCCGTG
NAAGGAGAAGTTCCCATAGCAACAGCACCATTTTTTCCAGGGAAAAGGAGGAAAGAATCAAGGATGCGAAAGAGGGAATCAAAGCAGCTTAAGGGATATAAAAAAAACAGGGATTGTTCATGAATTATGGACAAGGCAGCTGAGAATTCC
+
#AAFFJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJA-<7-77A<7AJJF<AJJJJJF7JFAJF7AJJFJJJJJJJFF-AFJFJJJJJ--FFJJJJJJAAJFF<AJJJJJF777-----<-7F7-<--<<<<<7F<--7)--A7FF--<7

'''
p1=subprocess.Popen('cat o3',shell=True,stdout=subprocess.PIPE)
p2=subprocess.Popen('head -4',shell=True,stdin=p1.stdout,stdout=subprocess.PIPE)
print 'oneline:',p2.stdout.readline()
print 'oneline:',p2.stdout.readline()
print 'onefile:',p2.stdout.read()

'''
oneline: @K00133:143:H5LL5BBXX:8:1101:1194:1103 2:N:0:NCGCCGTG

oneline: NAAGGAGAAGTTCCCATAGCAACAGCACCATTTTTTCCAGGGAAAAGGAGGAAAGAATCAAGGATGCGAAAGAGGGAATCAAAGCAGCTTAAGGGATATAAAAAAAACAGGGATTGTTCATGAATTATGGACAAGGCAGCTGAGAATTCC

onefile: +
#AAFFJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJA-<7-77A<7AJJF<AJJJJJF7JFAJF7AJJFJJJJJJJFF-AFJFJJJJJ--FFJJJJJJAAJFF<AJJJJJF777-----<-7F7-<--<<<<<7F<--7)--A7FF--<7

'''

'''
$ zcat 1.txt.gz
111111111111111
yyyyyyyyyyyyyyyyyyyyyyy
jjjjjjjjjjjjjjjjjj
nnnnnnnnnnnn
111111111111111111
'''
check_call('zcat 1.txt.gz |head -4',shell=True)

'''
111111111111111
yyyyyyyyyyyyyyyyyyyyyyy
jjjjjjjjjjjjjjjjjj
nnnnnnnnnnnn
'''
f= gzip.open('1.txt.gz','rb')
line = f.readline()
print line

'''
111111111111111

'''

  

posted on 2019-07-11 15:33  YUANya  阅读(182)  评论(0编辑  收藏  举报