Mercurial > repos > jowong > prince_galaxy
changeset 8:63f3743c2ae4 draft
planemo upload
author | jowong |
---|---|
date | Tue, 13 Nov 2018 12:19:53 -0500 |
parents | 0032da940600 |
children | 5b816b501285 |
files | filler.py filler.xml prince.xml prince_postprocess.py prince_postprocess.xml |
diffstat | 5 files changed, 25 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/filler.py Mon Oct 29 08:30:06 2018 -0400 +++ b/filler.py Tue Nov 13 12:19:53 2018 -0500 @@ -7,7 +7,7 @@ description="produce filler collection to deal with galaxy handling") input = parser.add_argument_group('Input', '') -input.add_argument('-i', '--input', nargs=1, required=True, help="Paths to forward reads") +input.add_argument('-i', '--input', nargs=1, required=True, help="Paths to (forward) reads") input.add_argument('-o', '--output', nargs=1, required=True, help="output") if len(sys.argv) == 0:
--- a/filler.xml Mon Oct 29 08:30:06 2018 -0400 +++ b/filler.xml Tue Nov 13 12:19:53 2018 -0500 @@ -1,12 +1,12 @@ -<tool id="filler" name="Filler" version="1.0.0"> +<tool id="filler" name="Filler" version="1.0.1"> <description>Filler Function to deal with paired collection</description> <command interpreter="python"><![CDATA[ filler.py #if str( $data_input.data_selector ) == "paired" - -i $data_input.input1.forward.element_identifier + -i $data_input.input1.forward #end if #if str( $data_input.data_selector ) == "single" - -i "$data_input.input2.element_identifier" + -i "$data_input.input2" #end if -o $output
--- a/prince.xml Mon Oct 29 08:30:06 2018 -0400 +++ b/prince.xml Tue Nov 13 12:19:53 2018 -0500 @@ -1,7 +1,7 @@ -<tool id="prince" name="VNTR copy number approximation" version="1.0.1"> +<tool id="prince" name="VNTR copy number approximation" version="1.1.0"> <description>Calculates CNV of genomic data based on template</description> <requirements> - <requirement type="package" version="1.0">prince</requirement> + <requirement type="package" version="1.2">prince</requirement> </requirements> <command detect_errors="exit_code"><![CDATA[ prince -tf "$input1" -to "$output1"
--- a/prince_postprocess.py Mon Oct 29 08:30:06 2018 -0400 +++ b/prince_postprocess.py Tue Nov 13 12:19:53 2018 -0500 @@ -8,8 +8,8 @@ input = parser.add_argument_group('Input', '') input.add_argument('-i', '--input', nargs=1, required=True, help="PRINCE OUTPUT") -input.add_argument('-s', '--sample', nargs='*', required=True, help="Sample names") - +input.add_argument('-s', '--sample', nargs='+', required=True, help="Sample names") +input.add_argument('-f', '--file', nargs='+', required=True, help="File of forward reads in galaxy convention") if len(sys.argv) == 0: parser.print_usage() sys.exit(1) @@ -18,6 +18,19 @@ #print(args.input) #sample_name = re.sub('(_1.fastq(.gz)*|_2.fastq(.gz)*|.fastq(.gz)*)', '', args.label.rstrip().lstrip()) +sample_dict={} +path_index = 0 +for path in args.file: + with open(path) as f: + for line in f: + sample_dict[re.sub(".*/","",line)] = sample[path_index] + path_index += 1 + + + + + + with open(args.input[0]) as prince_output: with open('prince_postprocess_output.txt', 'w') as output: @@ -25,8 +38,9 @@ index = 0 for line in prince_output: if x%2 == 0: - sample = re.sub('(_1.fastq(.gz)*|_2.fastq(.gz)*|.fastq(.gz)*)', '', args.sample[index]) - output.write(re.sub('.*.dat', sample, line)) + entries =line.rstrip().split(',') + sample = re.sub('(_1.fastq(.gz)*|_2.fastq(.gz)*|.fastq(.gz)*)', '', sample_dict[entries[0]]) + output.write(re.sub(entries[0], sample, line)) index += 1 else: output.write(line)
--- a/prince_postprocess.xml Mon Oct 29 08:30:06 2018 -0400 +++ b/prince_postprocess.xml Tue Nov 13 12:19:53 2018 -0500 @@ -1,7 +1,7 @@ <tool id="prince_postprocess" name="Prince Postprocess" version="1.0.0"> <description>Postprocess PRINCE galaxy output</description> <command interpreter="python"><![CDATA[ - prince_postprocess.py -i $prince_output -s #for $path in $paths# $path.element_identifier #end for# + prince_postprocess.py -i $prince_output -s #for $path in $paths# $path.element_identifier #end for# -f #for $path in $paths# $path #end for# ]]></command> <inputs> <param name="paths" type="data" format="data" label="Collection of files" help="" optional="False" multiple="True"/>