#!/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的组合 给定...
- 七、公共操作 公共操作指的就是所学过的数据序列基本上都支持的操作。 以下是总结内容: (一)运算符 运算符描述支持...