comparison lib/CPT/Parameter/File/Input.pm @ 1:d724f34e671d draft default tip

planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
author cpt
date Mon, 05 Jun 2023 02:50:07 +0000
parents
children
comparison
equal deleted inserted replaced
0:e4de0a0e90c8 1:d724f34e671d
1 package CPT::Parameter::File::Input;
2 use Moose;
3 with 'CPT::Parameter';
4
5 has 'format' => ( is => 'rw', isa => 'Str' );
6 has 'file_format' => ( is => 'rw', isa => 'ArrayRef' );
7
8 # Format is something like "fastq", "bam", etc.
9 # This means when you write the parameter string it'll be
10 # ['file|f=s', 'Input Bam File', { required => 1, format=> 'file/input/bam'} ]
11 # Which will specify that you require a BAM file.
12
13
14 sub galaxy_input {
15 my ( $self, $xml_writer ) = @_;
16 $self->handle_possible_galaxy_input_repeat_start($xml_writer);
17 my %params = $self->get_default_input_parameters('data');
18 if( defined $self->file_format() ){
19 $params{format} = join( ',', @{$self->file_format()} );
20 }
21 $xml_writer->startTag(
22 'param',
23 %params
24 );
25 $xml_writer->endTag('param');
26 $self->handle_possible_galaxy_input_repeat_end($xml_writer);
27 }
28
29
30 sub galaxy_output {
31 my ($self, $xml_writer) = @_;
32 return $xml_writer;
33 }
34
35
36 sub validate_individual {
37 my ($self, $val) = @_;
38
39 # Maybe do format validation here? Maybe?
40 if ( -e $val ) {
41 return 1;
42 }else{
43 push(@{$self->errors()}, sprintf( "File [%s] supplied to option %s does not exist", $val,$self->name()));
44 return 0;
45 }
46 }
47
48
49 sub getopt_format {
50 return '=s';
51 }
52
53 no Moose;
54 1;
55
56 __END__
57
58 =pod
59
60 =encoding UTF-8
61
62 =head1 NAME
63
64 CPT::Parameter::File::Input
65
66 =head1 VERSION
67
68 version 1.99.4
69
70 =head2 galaxy_input
71
72 $file_param->galaxy_input($xml_writer); # where $file_param is a CPT::Parameter::*
73
74 Utilises the $xml_writer to add a <data> block in the <output> section
75
76 =head2 galaxy_output
77
78 $file_param->galaxy_output($xml_writer); # where $file_param is a CPT::Parameter::*
79
80 Utilises the $xml_writer to add a <data> block in the <output> section
81
82 =head2 getopt_format
83
84 Returns the format character for a given CPT::Parameter::* type
85
86 =head1 AUTHOR
87
88 Eric Rasche <rasche.eric@yandex.ru>
89
90 =head1 COPYRIGHT AND LICENSE
91
92 This software is Copyright (c) 2014 by Eric Rasche.
93
94 This is free software, licensed under:
95
96 The GNU General Public License, Version 3, June 2007
97
98 =cut