-
Notifications
You must be signed in to change notification settings - Fork 3
/
40.sv.cov.py
47 lines (40 loc) · 1.2 KB
/
40.sv.cov.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : 40.sv.cov.py
@Time : 2022/12/06 17:11:08
@Author : Lin Cheng
@Version : 1.0
@Contact : chenglin_solab@163.com
@License : (C)Copyright 2022-2023, CAAS ShenZhen
@Desc : python .py samtools_depth .file sv_bed sv_ft.bed
'''
import datetime, sys
# here put the import lib
print('***********************************************************')
print('Start Time: '+ str(datetime.datetime.now()))
print('***********************************************************')
infile=sys.argv[1]
infile1=sys.argv[2]
outfile=sys.argv[3]
f_in=open(infile,'r')
f_in1=open(infile1,'r')
f_out=open(outfile,'w')
dic={}
for line in f_in:
in_line=line.strip().split()
pos=in_line[0]+"_"+in_line[1]
if int(in_line[2]) >= 3:
dic[pos]=""
for line in f_in1:
in_line=line.strip().split()
pos1=in_line[0]+"_"+in_line[1]
pos2=in_line[0]+"_"+in_line[2]
if pos1 and pos2 in dic:
f_out.write(line)
f_in.close()
f_in1.close()
f_out.close()
print('***********************************************************')
print('Stop Time: '+ str(datetime.datetime.now()))
print('***********************************************************')