Skip to content
Permalink
c1e8495b8e
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
19 lines (16 sloc) 479 Bytes
#!/usr/bin/env python
import pybedtools
import pandas as pd
ps = pybedtools.BedTool(snakemake.input[0])
if '.pos.' in snakemake.input[0]:
strand='+'
elif '.neg.' in snakemake.input[0]:
strand='-'
if snakemake.params[0]=='':
df=ps
else:
frame_mf=pd.read_csv(snakemake.params[0],delimiter='\t',header=None)
frame_mf=frame_mf[frame_mf[5]==strand]
mf = pybedtools.BedTool.from_dataframe(frame_mf)
df = ps.subtract(mf)
df.moveto(snakemake.output[0])