-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsort.py
More file actions
26 lines (26 loc) · 756 Bytes
/
sort.py
File metadata and controls
26 lines (26 loc) · 756 Bytes
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
# #!/bin/bash
#
# FILES=/data/khandekara2/cancer_WGBS/raw_data/*_WGBS.bed
# SUFFIX=sorted
# for f in $FILES
# do
# if [[$f == MALY_tumor_*]];
# then
# bedtools sort -i $f > temp.bed
# mv temp.bed $f$SUFFIX
# fi
#
# done
import os
import pybedtools
for file in os.listdir('/data/khandekara2/cancer_WGBS/raw_data'):
if file.startswith('MALY_tumor_') and file.endswith('_WGBS.bed'):
a = pybedtools.BedTool(file)
a.sort().saveas(file + '.sorted')
import os
import pybedtools
for file in os.listdir('/data/khandekara2/imputation'):
if file.endswith('.sorted'):
a = pybedtools.BedTool(file)
b = pybedtools.BedTool('/data/khandekara2/bed_CpGs/cds_canonical.bed')
a.intersect(b).saveas(file + '.cds')