| 1 | =head1 NAME | ||
| 2 | |||
| 3 | CLIPSeqTools::Role::Option::Transcripts - Role to enable reading a GTF file with transcripts from the command line | ||
| 4 | |||
| 5 | =head1 SYNOPSIS | ||
| 6 | |||
| 7 | Role to enable reading a GTF file with transcripts from the command line | ||
| 8 | |||
| 9 | Defines options. | ||
| 10 | -gtf <Str> GTF file for transcripts. | ||
| 11 | |||
| 12 | Provides attributes. | ||
| 13 | transcript_collection the collection of transcripts that is read from the GTF | ||
| 14 | |||
| 15 | =cut | ||
| 16 | |||
| 17 | |||
| 18 | package CLIPSeqTools::Role::Option::Transcripts; | ||
| 19 | $CLIPSeqTools::Role::Option::Transcripts::VERSION = '1.0.0'; | ||
| 20 | |||
| 21 | ####################################################################### | ||
| 22 | ####################### Load External modules ##################### | ||
| 23 | ####################################################################### | ||
| 24 | use Modern::Perl; | ||
| 25 | use MooseX::App::Role; | ||
| 26 | |||
| 27 | |||
| 28 | ####################################################################### | ||
| 29 | ######################## Load GenOO modules ####################### | ||
| 30 | ####################################################################### | ||
| 31 | use GenOO::TranscriptCollection::Factory; | ||
| 32 | |||
| 33 | |||
| 34 | ####################################################################### | ||
| 35 | ####################### Command line options ###################### | ||
| 36 | ####################################################################### | ||
| 37 | option 'gtf' => ( | ||
| 38 | is => 'rw', | ||
| 39 | isa => 'Str', | ||
| 40 | required => 1, | ||
| 41 | documentation => 'GTF file with transcripts', | ||
| 42 | ); | ||
| 43 | |||
| 44 | |||
| 45 | ####################################################################### | ||
| 46 | ###################### Interface Attributes ####################### | ||
| 47 | ####################################################################### | ||
| 48 | has 'transcript_collection' => ( | ||
| 49 | is => 'rw', | ||
| 50 | builder => '_read_transcript_collection', | ||
| 51 | lazy => 1, | ||
| 52 | ); | ||
| 53 | |||
| 54 | |||
| 55 | ####################################################################### | ||
| 56 | ######################## Interface Methods ######################## | ||
| 57 | ####################################################################### | ||
| 58 | sub validate_args {} | ||
| 59 | |||
| 60 | |||
| 61 | ####################################################################### | ||
| 62 | ######################### Private Methods ######################### | ||
| 63 | ####################################################################### | ||
| 64 | sub _read_transcript_collection { | ||
| 65 | my ($self) = @_; | ||
| 66 | |||
| 67 | return GenOO::TranscriptCollection::Factory->create('GTF', { | ||
| 68 | file => $self->gtf | ||
| 69 | })->read_collection; | ||
| 70 | } | ||
| 71 | |||
| 72 | 1; |