# HG changeset patch # User jowong # Date 1540590753 14400 # Node ID 74a9f37e2bc91e8f318701ca052d24470e0be75e # Parent 492848eff35db4c81447b36df50582f07ca5617b planemo upload for repository https://github.com/jowong4/add_sample_name_as_first_line_of_file commit f3fe76f6cbf17b0ec4162065206483652a6519b7-dirty diff -r 492848eff35d -r 74a9f37e2bc9 add_sample_name_as_first_line.py --- a/add_sample_name_as_first_line.py Sun Oct 21 09:37:06 2018 -0400 +++ b/add_sample_name_as_first_line.py Fri Oct 26 17:52:33 2018 -0400 @@ -6,7 +6,7 @@ the_parser = argparse.ArgumentParser(description="add label to first line of file") the_parser.add_argument('--input', required=True, action="store", type=str, help="input file") the_parser.add_argument('--output', required=True, action="store", type=str, help="output file path") - the_parser.add_argument('--label', required=True, action="store", type=str, help="label to add in the first line") + the_parser.add_argument('--sample', required=True, action="store", type=str, help="label to add in the first line") args = the_parser.parse_args() return args @@ -17,7 +17,7 @@ #print >> output, args.label #print >> output, input -sample_name = re.sub('(_1.fastq.gz|_2.fastq.gz|.fastq.gz)', '', args.label.rstrip().lstrip()) +sample_name = re.sub('(_1.fastq(.gz)*|_2.fastq(.gz)*|.fastq(.gz)*)', '', args.label.rstrip().lstrip()) with open(args.input) as input: with open(args.output, 'w') as output: diff -r 492848eff35d -r 74a9f37e2bc9 add_sample_name_as_first_line.xml --- a/add_sample_name_as_first_line.xml Sun Oct 21 09:37:06 2018 -0400 +++ b/add_sample_name_as_first_line.xml Fri Oct 26 17:52:33 2018 -0400 @@ -1,4 +1,4 @@ - + to an existing tabular file add_sample_name_as_first_line.py --input "$input"