Skip to content

Commit

Permalink
Merge pull request #34 from GabeAl/master
Browse files Browse the repository at this point in the history
0.91: added option to strip at first underscore
  • Loading branch information
GabeAl authored Jan 27, 2017
2 parents c07ac58 + 4cd4c5a commit 5f586c1
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 4 deletions.
8 changes: 7 additions & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
Copyright (c) 2016, GabeAl
Copyright (c) 2016, KnightsLab
Individual software components are subject to their own licenses, and
these supercede the terms of this license where appropriate.

Trimmomatic: GPLv3, FLASH: GPLv3
GPLv3 license: https://github.com/timflutre/trimmomatic/blob/master/distSrc/LICENSE


Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 15 additions & 3 deletions shi7/shi7.py → bin/shi7.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def convert_t_or_f(value):
def make_arg_parser():
# TODO: Preset modes will get precedence over default values, but lose to explicit settings from user
parser = argparse.ArgumentParser(description='This is the commandline interface for shi7',
usage='shi7 -i <input> -o <output> ...')
usage='shi7 v0.91 -i <input> -o <output> ...')
parser.add_argument('--gotta_split', help='Split one giant fastq (or one pair of R1/R2) into 1 fastq per sample', dest='split', choices=[True,False], default='False', type=convert_t_or_f)
parser.add_argument('--gotta_split_output', help='output directory for the newly-split fastqs')
parser.add_argument('--gotta_split_r1', help='r1 to split')
Expand Down Expand Up @@ -93,9 +93,21 @@ def run_command(cmd, shell=False):

def format_basename(filename):
if t_f_values[STRIP]:
return '.'.join(re.sub('[^0-9a-zA-Z]+', '.', re.sub('_L001', '', re.sub('_001', '', (os.path.basename(filename)).split('_')[0]))).split('.')[:-1])
parts = os.path.basename(filename).split('_')
if len(parts) == 1:
return re.sub('[^0-9a-zA-Z]+', '.', '.'.join(parts[0].split('.')[:-1]))
else:
appendage = ''
for section in parts[1:]:
if section.find("R1") != -1:
appendage = 'R1'
elif section.find("R2") != -1:
appendage = 'R2'
return re.sub('[^0-9a-zA-Z]+', '.', parts[0])+appendage
else:
return '.'.join(re.sub('[^0-9a-zA-Z]+', '.', re.sub('_L001', '', re.sub('_001', '', os.path.basename(filename)))).split('.')[:-1])
return re.sub('[^0-9a-zA-Z]+', '.', '.'.join(os.path.basename(filename).split('.')[:-1]))

#return '.'.join(re.sub('[^0-9a-zA-Z]+', '.', re.sub('_L001', '', re.sub('_001', '', os.path.basename(filename)))).split('.')[:-1])

def whitelist(dir, whitelist):
for root, subdirs, files in os.walk(dir):
Expand Down

0 comments on commit 5f586c1

Please sign in to comment.