# Path: ob_pipelines/s3.py
# SCRATCH_DIR = os.environ.get('SCRATCH_DIR') or '/tmp'
# def csv_to_s3(df, s3_path, **kwargs):
# def create_tmp_from_key(key): 
# def path_to_bucket_and_key(path):
# def key_exists(bucket, key):
# def download_folder(bucket, prefix, folder):
# def upload_folder(folder, bucket, prefix):
# def upload_prefix(local_prefix, s3_prefix, fpath_templates):
# def download_file_or_folder(s3_path, local_path):
# def upload_file_or_folder(s3_path, local_path):
# def remove_file_or_folder(fpath):
# def swap_args(args, rm_local_outpath=False):
# def s3args(rm_local_outpath=False):
#     def s3args_decorator(f):
#         def local_fn(*args, **kwargs):
# def s3wrap():
#     def sync_and_run(*cmds):


from ob_pipelines import s3
import pysam
import sys


@s3.s3args()
def dedupe_by_pos_strand(infile, outfile):

    infile = pysam.AlignmentFile(infile, 'rb')
    outfile = pysam.AlignmentFile(outfile, 'wb', template=infile)
    
    pos_list = set()
    for aln in infile:

# Path: ob_pipelines/s3.py
# SCRATCH_DIR = os.environ.get('SCRATCH_DIR') or '/tmp'
# def csv_to_s3(df, s3_path, **kwargs):
# def create_tmp_from_key(key): 
# def path_to_bucket_and_key(path):
# def key_exists(bucket, key):
# def download_folder(bucket, prefix, folder):
# def upload_folder(folder, bucket, prefix):
# def upload_prefix(local_prefix, s3_prefix, fpath_templates):
# def download_file_or_folder(s3_path, local_path):
# def upload_file_or_folder(s3_path, local_path):
# def remove_file_or_folder(fpath):
# def swap_args(args, rm_local_outpath=False):
# def s3args(rm_local_outpath=False):
#     def s3args_decorator(f):
#         def local_fn(*args, **kwargs):
# def s3wrap():
#     def sync_and_run(*cmds):


# Path: ob_pipelines/apps/pysam/dedupe.py
from ob_pipelines import s3
import pysam
import sys



@s3.s3args()
def dedupe_by_pos_strand(infile, outfile):

    infile = pysam.AlignmentFile(infile, 'rb')
    outfile = pysam.AlignmentFile(outfile, 'wb', template=infile)
    
    pos_list = set()
    for aln in infile:

        pos_strand = (aln.reference_start, aln.is_reverse)