#!/usr/bin/env python
##coding=utf-8
import re
import os
import sys
import argparse
import gzip
parser = argparse.ArgumentParser(description="pipeline")
parser.add_argument('-i', '--input', help = 'the pathway of the input fastq file ', required = True)
parser.add_argument('-id', '--input_id', help = 'the pathway of the input id file ', required = True)
parser.add_argument('-o', '--output', help = 'the pathway of the output vcf file,filter vcf', required = True)
argv = vars(parser.parse_args())
ifile = os.path.abspath(argv['input'].strip())
ofile = os.path.abspath(argv['output'].strip())
idf = os.path.abspath(argv['input_id'].strip())
def creatlist(inputfile):
idlist=[]
with open(inputfile,'rb') as v:
for vi in v:
vic = vi.strip().split('\n')
idlist.append(str(vic[0]))
return idlist
def trimfq(inputfile,outfile,idList):
oc=open(outfile,'w')
with gzip.open(inputfile,'rb') as v:
i=0
idn=-1
for vi in v:
i=i+1
vic = vi.strip().split('\n')
vicon=vic[0]
if str(vicon).startswith('@'):
vcid=str(vicon).replace('@','')
if vcid in idList:
print("vcid : "+str(vcid))
idn=i
idr=vcid
elif int(i)==idn+1:
idseq=str(vicon)
oc.write(">"+str(idr)+"\n"+str(idseq)+"\n")
oc.close
idL=creatlist(idf)
trimfq(ifile,ofile,idL)
python38
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 要编译人脸特征识别的代码,必须要用到dlib,然而,python3.8的dlib编译好的轮子太难找了,下面这个编译...
- 注:本文所有代码均经过Python 3.7实际运行检验,保证其严谨性。 Python基础练习题37:0的组合 给定...
- 七、公共操作 公共操作指的就是所学过的数据序列基本上都支持的操作。 以下是总结内容: (一)运算符 运算符描述支持...