|
14 | 14 | my $config; |
15 | 15 | my $opt_plus_strand = undef; |
16 | 16 | my $start_run = time(); |
17 | | -my $codonTable=1; |
18 | 17 |
|
19 | | -my $opt_gfffile; |
20 | | -my $opt_fastafile; |
21 | | -my $opt_output; |
| 18 | + |
22 | 19 | my $opt_AA=undef; |
23 | | -my $opt_help = 0; |
| 20 | +my $opt_alternative_start_codon = undef; |
| 21 | +my $opt_fastafile; |
| 22 | +my $opt_cdna=undef; |
| 23 | +my $opt_cleanFinalStop=undef; |
| 24 | +my $opt_cleanInternalStop=undef; |
| 25 | +my $opt_codonTable=1; |
| 26 | +my $opt_downRegion=undef; |
| 27 | +my $opt_extremity_only=undef; |
24 | 28 | my $opt_full=undef; |
25 | | -my $opt_split=undef; |
| 29 | +my $opt_gfffile; |
| 30 | +my $opt_help = 0; |
| 31 | +my $opt_keep_attributes = undef; |
| 32 | +my $opt_keep_parent_attributes = undef; |
26 | 33 | my $opt_merge=undef; |
27 | | -my $opt_extremity_only=undef; |
28 | | -my $opt_upstreamRegion=undef; |
29 | | -my $opt_downRegion=undef; |
30 | | -my $opt_cdna=undef; |
31 | 34 | my $opt_mrna=undef; |
32 | 35 | my $opt_OFS=undef; |
33 | | -my $opt_type = 'cds'; |
34 | | -my $opt_keep_attributes = undef; |
35 | | -my $opt_keep_parent_attributes = undef; |
36 | | -my $opt_cleanFinalStop=undef; |
37 | | -my $opt_cleanInternalStop=undef; |
38 | | -my $opt_remove_orf_offset = undef; |
39 | | -my $opt_quiet = undef; |
| 36 | +my $opt_output; |
40 | 37 | my $opt_plus_strand_only = undef; |
| 38 | +my $opt_quiet = undef; |
| 39 | +my $opt_remove_orf_offset = undef; |
41 | 40 | my $opt_revcomp=undef; |
| 41 | +my $opt_split=undef; |
| 42 | +my $opt_type = 'cds'; |
| 43 | +my $opt_upstreamRegion=undef; |
42 | 44 | my $opt_verbose=undef; |
43 | | -my $opt_alternative_start_codon = undef; |
44 | 45 |
|
45 | 46 | # OPTION MANAGMENT |
46 | 47 | my @copyARGV=@ARGV; |
47 | 48 | if ( !GetOptions( 'alternative_start_codon|asc!' => \$opt_alternative_start_codon, |
| 49 | + 'c|config=s' => \$config, |
48 | 50 | 'cdna!' => \$opt_cdna, |
49 | 51 | 'cfs|clean_final_stop!' => \$opt_cleanFinalStop, |
50 | 52 | 'cis|clean_internal_stop!' => \$opt_cleanInternalStop, |
|
53 | 55 | 'f|fa|fasta=s' => \$opt_fastafile, |
54 | 56 | 'full!' => \$opt_full, |
55 | 57 | 'g|gff=s' => \$opt_gfffile, |
56 | | - 'c|config=s' => \$config, |
57 | 58 | 'h|help!' => \$opt_help, |
| 59 | + 'keep_attributes!' => \$opt_keep_attributes, |
| 60 | + 'keep_parent_attributes!' => \$opt_keep_parent_attributes, |
58 | 61 | 'merge!' => \$opt_merge, |
59 | 62 | 'mrna|transcript!' => \$opt_mrna, |
60 | 63 | 'ofs=s' => \$opt_OFS, |
|
65 | 68 | 'remove_orf_offset|roo!' => \$opt_remove_orf_offset, |
66 | 69 | 'revcomp!' => \$opt_revcomp, |
67 | 70 | 'split!' => \$opt_split, |
68 | | - 'keep_attributes!' => \$opt_keep_attributes, |
69 | | - 'keep_parent_attributes!' => \$opt_keep_parent_attributes, |
70 | | - 'table|codon|ct=i' => \$codonTable, |
| 71 | + 'table|codon|ct=i' => \$opt_codonTable, |
71 | 72 | 't|type=s' => \$opt_type, |
72 | 73 | 'up|5|five|upstream=i' => \$opt_upstreamRegion, |
73 | 74 | 'verbose|v!' => \$opt_verbose ) ) |
|
97 | 98 | $config = get_agat_config({config_file_in => $config}); |
98 | 99 |
|
99 | 100 | # --- Check codon table |
100 | | -$codonTable = get_proper_codon_table($codonTable); |
| 101 | +$opt_codonTable = get_proper_codon_table($opt_codonTable); |
101 | 102 |
|
102 | 103 | # activate warnings limit |
103 | 104 | my %warnings; |
@@ -431,7 +432,7 @@ sub extract_sequences{ |
431 | 432 | # create object |
432 | 433 | my $seqObj = create_seqObj($sequence, $id_seq, $description, $minus, $info); |
433 | 434 | # print object |
434 | | - print_seqObj($ostream, $seqObj, $opt_AA, $codonTable, $phase); |
| 435 | + print_seqObj($ostream, $seqObj, $opt_AA, $opt_codonTable, $phase); |
435 | 436 | } |
436 | 437 | # -------------------------------------- |
437 | 438 |
|
@@ -497,7 +498,7 @@ sub extract_sequences{ |
497 | 498 | } |
498 | 499 |
|
499 | 500 | #print object |
500 | | - print_seqObj($ostream, $seqObj, $opt_AA, $codonTable, $phase); |
| 501 | + print_seqObj($ostream, $seqObj, $opt_AA, $opt_codonTable, $phase); |
501 | 502 | } |
502 | 503 | } |
503 | 504 | # -------------------------------------- |
@@ -577,7 +578,7 @@ sub extract_sequences{ |
577 | 578 | #create object |
578 | 579 | my $seqObj = create_seqObj($sequence, $id_seq, $description, $minus, $info); |
579 | 580 | #print object |
580 | | - print_seqObj($ostream, $seqObj, $opt_AA, $codonTable, $phase); |
| 581 | + print_seqObj($ostream, $seqObj, $opt_AA, $opt_codonTable, $phase); |
581 | 582 | } |
582 | 583 |
|
583 | 584 | # ---- Non spreaded feature extract them one by one |
@@ -626,7 +627,7 @@ sub extract_sequences{ |
626 | 627 | } |
627 | 628 |
|
628 | 629 | #print object |
629 | | - print_seqObj($ostream, $seqObj, $opt_AA, $codonTable, $phase); |
| 630 | + print_seqObj($ostream, $seqObj, $opt_AA, $opt_codonTable, $phase); |
630 | 631 | } |
631 | 632 | } |
632 | 633 | } |
@@ -767,18 +768,18 @@ sub create_seqObj{ |
767 | 768 |
|
768 | 769 | # Print the sequence object |
769 | 770 | sub print_seqObj{ |
770 | | - my($ostream, $seqObj, $opt_AA, $codonTable, $phase) = @_; |
| 771 | + my($ostream, $seqObj, $opt_AA, $opt_codonTable, $phase) = @_; |
771 | 772 |
|
772 | 773 |
|
773 | 774 | if($opt_AA){ #translate if asked |
774 | 775 |
|
775 | 776 | if ( length($seqObj->seq()) < 3 ){warn "Sequence to translate for ".$seqObj->id()." < 3 nucleotides! Skipped...\n"; return; } |
776 | 777 |
|
777 | | - my $transObj = $seqObj->translate(-CODONTABLE_ID => $codonTable); |
| 778 | + my $transObj = $seqObj->translate(-CODONTABLE_ID => $opt_codonTable); |
778 | 779 |
|
779 | 780 | # translate alternative start codon by a M |
780 | 781 | my $start_codon = substr($seqObj->seq(),0,3); # get start codon |
781 | | - my $myCodonTable = Bio::Tools::CodonTable->new( -id => $codonTable ); |
| 782 | + my $myCodonTable = Bio::Tools::CodonTable->new( -id => $opt_codonTable ); |
782 | 783 | my $first_AA = substr($transObj->seq(),0,1); |
783 | 784 | if ($phase == 0 and $opt_alternative_start_codon and $myCodonTable->is_start_codon($start_codon)){ |
784 | 785 | if($first_AA ne "M"){ # if the start codon was not a M while it is a valid start codon we have to replace it by a methionine |
|
0 commit comments