-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
42fe071
commit f553ae4
Showing
3 changed files
with
51 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
FROM quay.io/biocontainers/bedtools:2.31.1--hf5e1c6e_2 AS bedtools | ||
FROM python:3.9.19 | ||
FROM python:3.13.0 | ||
|
||
COPY --from=bedtools /usr/local/bin/ /usr/local/bin/ | ||
COPY --from=scripts --chmod=777 hic/filter_hic.py /usr/local/bin/filter_hic.py | ||
|
||
ENTRYPOINT [ "bash" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
from collections import defaultdict | ||
import argparse | ||
|
||
def get_args(): | ||
parser = argparse.ArgumentParser( | ||
description="Filter Hi-C data.") | ||
parser.add_argument( | ||
"--prefix", type=str, help="Prefix for output file.") | ||
parser.add_argument( | ||
"--all_valid_pairs", type=str, help="All valid pairs file.") | ||
parser.add_argument( | ||
"--filter_pairs", type=str, help="Filter pairs file.") | ||
|
||
args = parser.parse_args() | ||
return args | ||
|
||
if __name__ == "__main__": | ||
args = get_args() | ||
|
||
f=open(args.filter_pairs) | ||
blackID=defaultdict(int) | ||
while True: | ||
line=f.readline() | ||
if not line: | ||
break | ||
cols=line.strip().split("\t") | ||
ID=cols[0] | ||
blackID[ID]=1 | ||
|
||
f2=open(args.all_valid_pairs) | ||
outfile1=args.prefix + ".allValidPairs.filtered" | ||
outfile2=args.prefix + ".allValidPairs.removed" | ||
of1=open(outfile1,'w') | ||
of2=open(outfile2,'w') | ||
while True: | ||
line=f2.readline() | ||
if not line: | ||
break | ||
cols=line.strip().split("\t") | ||
id=cols[0] | ||
if id in blackID: | ||
of2.write(line) | ||
else: | ||
of1.write(line) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters