Skip to content

Commit 07953a8

Browse files
committed
* added --score switch to merge_bed.py, allowing to quickly get only the score columns
1 parent ad519e3 commit 07953a8

File tree

1 file changed

+14
-33
lines changed

1 file changed

+14
-33
lines changed

merge_bed.py

+14-33
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
parser.add_option("-f","--flank",dest="flank",type=int,default=0,help="add flanking nucleotides to define more fuzzy overlap (default=0)")
1717
parser.add_option("-s","--stats",dest="stats",default="",help="write statistics to this file (instead of stderr)")
1818
parser.add_option("-6","--bed6",dest="bed6",default=False,action="store_true",help="ignore all columns except the first six standard BED columns (default=False)")
19+
parser.add_option("","--score",dest="score",default=False,action="store_true",help="ignore all columns except the first six standard BED columns and only retain score column from 2nd, 3rd ... BED (default=False)")
1920
parser.add_option("-F","--format",dest="format",default="2",choices = ["1","1.2","2"],help="select the find_circ.py outout version (choices=['1','1.2','2'])")
2021
parser.add_option("-V","--verbatim",dest="verbatim",default=False,action="store_true",help="do not attempt to merge all columns. Simply join on coordinates, other columns reported in verbatim")
2122

@@ -151,6 +152,19 @@ def append_uniq(values):
151152

152153
print "\t".join(cols)
153154

155+
elif options.score:
156+
for pos in merge.keys():
157+
com = support[pos]
158+
comstr = "(%s)" % ",".join(com)
159+
cols = [comstr]
160+
for name in shorts:
161+
if not name in com:
162+
cols.append("0")
163+
else:
164+
cols.append(by_name[name][pos][4])
165+
166+
print "\t".join(cols)
167+
154168
else:
155169
for pos in merge.keys():
156170
com = support[pos]
@@ -159,36 +173,3 @@ def append_uniq(values):
159173
cols = [comstr] + consensus_cols(lines,comb)
160174

161175
print "\t".join(cols)
162-
163-
164-
#for names,inputs in zip(combinations(names
165-
166-
167-
#for circ,line in marv.items():
168-
#if circ in anna:
169-
#if len(sys.argv) > 3:
170-
#print "%s\t%s" % (anna[circ].split('\t')[3],line.split('\t')[3])
171-
#else:
172-
#print anna[circ]
173-
##print "M",line
174-
#N['overlap'] += 1
175-
#del anna[circ]
176-
#else:
177-
#N['input2_not_in_input1'] += 1
178-
##print len(anna.keys())
179-
180-
#for k,l in anna.items():
181-
##if "HEK" in l:
182-
#print "MISSING\t%s" % l
183-
#N['input1_not_in_input2'] += 1
184-
185-
#for k in sorted(N.keys()):
186-
#sys.stderr.write("%s\t%d\n" % (k,N[k]))
187-
188-
#found = N['overlap']
189-
#detected = N['unique_input2']
190-
#total = N['unique_input1']
191-
#fp = N['input2_not_in_input1']
192-
193-
#print "#sensitivity %d/%d = %.2f %%" % (found,total,float(found)/total*100)
194-
#print "#FDR %d/%d = %.2f %%" % (fp,detected,float(fp)/detected*100)

0 commit comments

Comments
 (0)