diff --git a/.idea/BamSegmegments.iml b/.idea/BamSegmegments.iml
new file mode 100644
index 0000000..6711606
--- /dev/null
+++ b/.idea/BamSegmegments.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/markdown-navigator.xml b/.idea/markdown-navigator.xml
new file mode 100644
index 0000000..3efe9d6
--- /dev/null
+++ b/.idea/markdown-navigator.xml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/markdown-navigator/profiles_settings.xml b/.idea/markdown-navigator/profiles_settings.xml
new file mode 100644
index 0000000..57927c5
--- /dev/null
+++ b/.idea/markdown-navigator/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..472bec8
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..4bbaca5
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..27e3bbd
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,367 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1515661531113
+
+
+ 1515661531113
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Readme.md b/Readme.md
new file mode 100644
index 0000000..23f4bdf
--- /dev/null
+++ b/Readme.md
@@ -0,0 +1,7 @@
+
+
+
+##### this is a simple wrapper around samtools to subset bam files to later view in Igv for less command line literate people
+
+additional objects are for the writer to improve software documentasion as well as use click to manage inputs
+
diff --git a/samtools_view.sh b/samtools_view.sh
new file mode 100755
index 0000000..78b3560
--- /dev/null
+++ b/samtools_view.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+input=$1
+region=$2
+outputfile=$3
+
+samtools view -h -b $input $region > $outputfile
+samtools index $outputfile
\ No newline at end of file
diff --git a/smallerbam.py b/smallerbam.py
new file mode 100644
index 0000000..218ce9f
--- /dev/null
+++ b/smallerbam.py
@@ -0,0 +1,38 @@
+import subprocess as sp
+import os
+import click
+
+
+class StClass():
+ """Main class for stuff """
+ p = os.path.dirname(os.path.realpath(__file__))
+ bashscript = str(p)+'/samtools_view.sh'
+
+ def runbams(self, bamfile, region, outputfile):
+ """run samtools view"""
+ sp.call(['{}'.format(self.bashscript),
+ '{}'.format(bamfile),
+ '{}'.format(region),
+ '{}'.format(outputfile)])
+
+
+@click.command()
+@click.option(
+ '--region', '-r',
+ help='give region to subset. Example : 6:30919168-30919391',
+)
+@click.option(
+ '--inputfile', '-i',
+ help='inputfile',
+)
+@click.option(
+ '--outputfile', '-o',
+ help='outputfile',
+)
+def main(inputfile, region, outputfile):
+ sc = StClass()
+ sc.runbams(inputfile, region, outputfile)
+
+
+if __name__ == '__main__':
+ main()