From 01926ede0825c3ddfd70305871a9e992eea9a2ae Mon Sep 17 00:00:00 2001 From: Aron Skaftason Date: Fri, 12 Jan 2018 11:48:31 +0100 Subject: [PATCH] now possible to run bed files in csv files --- .idea/workspace.xml | 56 ++++++++++++++++++++------------------- smallerbams/smallerbam.py | 5 ++++ 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 051bc91..abb2e4b 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -24,17 +24,17 @@ - + - + - - + + @@ -42,7 +42,7 @@ - + @@ -72,14 +72,16 @@ - @@ -313,10 +315,10 @@ - - + + - + @@ -353,36 +355,36 @@ + + + + + + + + + + + + + - + - - + + - - - - - - - - - - - - - \ No newline at end of file diff --git a/smallerbams/smallerbam.py b/smallerbams/smallerbam.py index 36684e1..46c89cf 100644 --- a/smallerbams/smallerbam.py +++ b/smallerbams/smallerbam.py @@ -12,10 +12,15 @@ def __init__(self): def runbams(self, bamfile, region, outputfile): """run samtools view""" + if str(region).endswith('.bed'): + region = '-L ' + region + else: + pass sp.call(['{}'.format(self.bashscript), '{}'.format(bamfile), '{}'.format(region), '{}'.format(outputfile)]) + def runmultiple(self, csv): file = pd.read_csv(csv, header=None) for i, r in file.iterrows():