Skip to content

Commit 4193ebb

Browse files
ENH count.ngl
Key Changes: Added filter() step with samflag(secondary=False) which is the NGless equivalent of -F 256 The filtered alignments are then passed to count() Maintained your existing integer conversion and output
1 parent 5011d65 commit 4193ebb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

macrel/data/scripts/count.ngl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
ngless "1.0"
22

3-
input = samfile(ARGV[1], name='MACREL')
4-
counts = count(input,
3+
# First filter to keep only primary alignments
4+
filtered = filter(input, keep_if=[
5+
samflag(secondary=False) # -F 256 equivalent
6+
])
7+
8+
# Then count on the filtered alignments
9+
counts = count(filtered,
510
features=["seqname"],
611
include_minus1=False,
7-
counts = as_integer(round(counts))
812
normalization={raw})
913

14+
# Ensure integer counts
15+
counts = as_integer(round(counts))
1016
write(counts, ofile=ARGV[2])

0 commit comments

Comments
 (0)