-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcnv_fgenesh2gff.pl
972 lines (753 loc) · 27.6 KB
/
cnv_fgenesh2gff.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
#!/usr/bin/perl -w
#-----------------------------------------------------------+
# |
# cnv_fgenesh2gff.pl - Convert fgenesh output to gff |
# |
#-----------------------------------------------------------+
# |
# AUTHOR: James C. Estill |
# CONTACT: JamesEstill_@_gmail.com |
# STARTED: 01/31/2009 |
# UPDATED: 01/11/2010 |
# |
# DESCRIPTION: |
# Convert output from fgenesh to the gff format. |
# |
# USAGE: |
# ShortFasta Infile.fasta Outfile.fasta |
# |
# VERSION: $Rev: 948 $ |
# |
# LICENSE: |
# GNU General Public License, Version 3 |
# http://www.gnu.org/licenses/gpl.html |
# |
#-----------------------------------------------------------+
package DAWGPAWS;
#-----------------------------+
# INCLUDES |
#-----------------------------+
use strict;
use Getopt::Long;
# The following needed for printing help
use Pod::Select; # Print subsections of POD documentation
use Pod::Text; # Print POD doc as formatted text file
use IO::Scalar; # For print_help subfunction
use IO::Pipe; # Pipe for STDIN, STDOUT for POD docs
use File::Spec; # Convert a relative path to an abosolute path
use Bio::Tools::Fgenesh;
#-----------------------------+
# PROGRAM VARIABLES |
#-----------------------------+
my ($VERSION) = q$Rev: 948 $ =~ /(\d+)/;
# Get GFF version from environment, GFF2 is DEFAULT
my $gff_ver = uc($ENV{DP_GFF}) || "GFF2";
#-----------------------------+
# VARIABLE SCOPE |
#-----------------------------+
my $infile;
my $outfile;
my $seqname;
my $param;
my $tmp_file_path; # A temp file stripped of html tags
my $prog; # The program used to generate the data
# BOOLEANS
my $quiet = 0;
my $verbose = 0;
my $show_help = 0;
my $show_usage = 0;
my $show_man = 0;
my $show_version = 0;
my $do_test = 0; # Run the program in test mode
my $append = 0;
my $test = 0;
my $strip_html = 0; # Strip html tags from text file
#-----------------------------+
# COMMAND LINE OPTIONS |
#-----------------------------+
my $ok = GetOptions(# REQUIRED OPTIONS
"i|infile=s" => \$infile,
"o|outfile=s" => \$outfile,
# ADDITIONAL OPTIONS
"gff-ver=s" => \$gff_ver,
"p|param=s" => \$param,
"program=s" => \$prog,
# Allow name in addition to seqname
"s|name|seqname=s" => \$seqname,
"html" => \$strip_html,
"q|quiet" => \$quiet,
"verbose" => \$verbose,
"append" => \$append,
# ADDITIONAL INFORMATION
"usage" => \$show_usage,
"test" => \$test,
"version" => \$show_version,
"man" => \$show_man,
"h|help" => \$show_help,);
#-----------------------------+
# STANDARDIZE GFF VERSION |
#-----------------------------+
unless ($gff_ver =~ "GFF3" ||
$gff_ver =~ "GFF2") {
# Attempt to standardize GFF format names
if ($gff_ver =~ "3") {
$gff_ver = "GFF3";
}
elsif ($gff_ver =~ "2") {
$gff_ver = "GFF2";
}
else {
print "\a";
die "The gff-version \'$gff_ver\' is not recognized\n".
"The options GFF2 or GFF3 are supported\n";
}
}
#-----------------------------+
# SHOW REQUESTED HELP |
#-----------------------------+
if ( ($show_usage) ) {
# print_help ("usage", File::Spec->rel2abs($0) );
print_help ("usage", $0 );
}
if ( ($show_help) || (!$ok) ) {
# print_help ("help", File::Spec->rel2abs($0) );
print_help ("help", $0 );
}
if ($show_man) {
# User perldoc to generate the man documentation.
system ("perldoc $0");
exit($ok ? 0 : 2);
}
if ($show_version) {
print "\ncnv_fgenesh2gff.pl:\n".
"Version: $VERSION\n\n";
exit;
}
#-----------------------------+
# TAKE A LOOK AT THE FILE TO |
# SEE IF IT IS HTML |
#-----------------------------+
unless ($strip_html) {
# OPEN INPUT FILE HANDLE
if ($infile) {
open (TMPIN, "<$infile") ||
die "Can not open input file ";
}
else {
print STDERR "Expecting input from STDIN\n";
open (TMPIN, "<STDIN") ||
die ""
}
while (<TMPIN>) {
if ($_ =~ m/DOCTYPE HTML PUBLIC/) {
print STDERR "------------------------------------------------\n";
print STDERR " WARNING: The input file appears to be HTML\n";
print STDERR " Attempting to strip HTML from text file\n";
print STDERR "------------------------------------------------\n";
$strip_html = 1;
}
}
close TMPIN;
}
#-----------------------------+
# STRIP HTML |
#-----------------------------+
# A very simple attempt to strip HTML from the output
if ($strip_html) {
# OPEN INPUT FILE HANDLE
if ($infile) {
open (TMPIN, "<$infile") ||
die "Can not open input file ";
}
else {
print STDERR "Expecting input from STDIN\n";
open (TMPIN, "<STDIN") ||
die ""
}
# OPEN OUTPUT FILE HANDLE
if ($infile) {
$tmp_file_path = "$infile.strip.tmp";
}
else {
$tmp_file_path = "fgenesh.strip.tmp";
}
open (TMPOUT, ">$tmp_file_path") ||
die "Can not write to temp file:\n$tmp_file_path\n";
# STRIP HTML
while (<TMPIN>) {
next if m/^\</; # Remove lines starting with <
next if m/www\.softberry/; # Remove copywrite
s /\>\;/\>/; # Replace > with >
#print STDERR $_;
print TMPOUT $_;
}
close TMPIN;
close TMPOUT;
}
#-----------------------------+
# DO THE CONVERSION |
#-----------------------------+
#my $prog = "fgenesh";
if ($strip_html) {
fgenesh2gff ($prog, $tmp_file_path, $outfile, $seqname, $param, $append);
}
else {
fgenesh2gff ($prog, $infile, $outfile, $seqname, $param, $append);
}
exit 0;
#-----------------------------------------------------------+
# SUBFUNCTIONS |
#-----------------------------------------------------------+
sub fgenesh2gff {
# fgnesh_in - path to the fgenesh program
# gff_out - path to the gff output file
# seq_id - id of the source sequence
# src_suffix - parameter id for fgenesh run
my ($source, $fgenesh_in, $gff_out, $seq_id, $src_suffix, $do_append ) = @_;
my $attribute;
#-----------------------------+
# OPEN THE FGENESH INFILE |
#-----------------------------+
my $fgenesh_result;
if ($fgenesh_in) {
$fgenesh_result = Bio::Tools::Fgenesh->new(-file => $fgenesh_in);
}
else {
print STDERR "Expecting input from STDIN\n";
$fgenesh_result = Bio::Tools::Fgenesh->new( -fh => \*STDIN );
}
#-----------------------------+
# OPEN THE GFF OUTFILE |
#-----------------------------+
# Default to STDOUT if no argument given
if ($gff_out) {
if ($do_append) {
open (GFFOUT, ">>$gff_out") ||
die "ERROR: Can not open gff outfile:\n $gff_out\n";
}
else {
open (GFFOUT,">$gff_out") ||
die "ERROR: Can not open gff outfile:\n $gff_out\n";
if ($gff_ver =~ "GFF3") {
print GFFOUT "##gff-version 3\n";
}
}
}
else {
open (GFFOUT, ">&STDOUT") ||
die "Can not print to STDOUT\n";
if ($gff_ver =~ "GFF3") {
print GFFOUT "##gff-version 3\n";
}
}
#-----------------------------+
# SET PROGRAM SOURCE |
#-----------------------------+
unless ($source) {
$source = "fgenesh";
}
if ($src_suffix) {
$source = $source.":".$src_suffix;
}
my $gene_num = 0;
while (my $gene = $fgenesh_result->next_prediction()) {
$gene_num++;
my $gene_id = sprintf("%05d", $gene_num); # Pad the gene number
my $gene_name = "Fgenesh_gene_".$gene_id."\n";
$gene_id = "gene".$gene_id;
#-----------------------------+
# SET SEQUENCE ID |
#-----------------------------+
unless ($seq_id) {
if ($gene->seq_id()) {
$seq_id = $gene->seq_id();
}
else {
$seq_id = "seq";
}
}
# NOTE:
# $gene is an instance of Bio::Tools::Prediction::Gene, which inherits
# off Bio::SeqFeature::Gene::Transcript.
#
# $gene->exons() returns an array of
# Bio::Tools::Prediction::Exon objects
# all exons:
#-----------------------------+
# IF GFF3 PRINT PARENT GENE |
# AND TRANSCRIPT INFORMATION |
#-----------------------------+
if ($gff_ver =~ "GFF3") {
#-----------------------------+
# GENE |
#-----------------------------+
$attribute = "ID=".$source."_".$gene_id;
#$gene_id;
# my @exons_ordered = $gene->exons_ordered();
# Get gene start and end
my $gene_start = $gene->start();
my $gene_end = $gene->end();
if ($gene_start > $gene_end) {
$gene_end = $gene->start();
$gene_start = $gene->end();
}
# Get gene score
my $gene_score;
if ($gene->score()) {
$gene_score = $gene->score();
}
else {
$gene_score = ".";
}
# Get gene strand
my $gene_strand = $gene->strand()."\t";
if ($gene_strand =~ "-1") {
$gene_strand = "-";
}
else {
$gene_strand = "+";
}
print GFFOUT $seq_id."\t". # Seqname
$source."\t". # Source
"gene\t". #feature
"$gene_start\t". # start
"$gene_end\t". # end
"$gene_score\t". # score
"$gene_strand\t". # strand
".\t". # frame
$attribute. # attribute
"\n";
# #-----------------------------+
# # TRANSCRIPT
# #-----------------------------+
# #my @transcripts = $gene->transcripts();
# my @promoters = $gene->promoters();
# my @utr_5 = $gene->utrs('utr5prime');
# my @utr_3 = $gene->utrs('utr3prime');
#
# # Poly a is returning a single base
# my $poly_a_site = $gene->poly_A_site;
# my $poly_a_start = $poly_a_site->start();
# my $poly_a_end = $poly_a_site->end();
# if ($poly_a_site) {
# print STDERR "polya".$poly_a_start."-".$poly_a_end."\n";
# }
# foreach my $ind_utr_5 (@utr_5) {
# print STDERR "YUP\n\n";
# }
# foreach my $promoter (@promoters) {
# print STDERR "Prom\t".
# $promoter->start()."\t".
# $promoter->end()."\t".
# "\n;"
# }
# foreach my $poly_a_site (@polya_sites) {
# print STDERR "polya\n";
# }
# print STDERR ;
}
#-----------------------------+
# EXONS |
#-----------------------------+
# Exons will be directly assigned to the gene as the parent
my @exon_arr = $gene->exons();
my $exon_num = 0;
foreach my $ind_exon (@exon_arr) {
$exon_num++;
my $exon_id = sprintf("%05d", $exon_num); # Pad the exon number
$exon_id = "exon".$exon_id;
# $exon_id =
#print STDERR $ind_exon;
# if ($ind_exon->is_coding()) {
# print STDERR "coding\t";
# }
# else {
# }
#-----------------------------+
# FORMAT STRAND |
#-----------------------------+
my $strand = $ind_exon->strand()."\t";
if ($strand =~ "-1") {
$strand = "-";
}
else {
$strand = "+";
}
#-----------------------------+
# GET START AND END |
#-----------------------------+
my $start = $ind_exon->start();
my $end = $ind_exon->end();
if ($start > $end) {
$end = $ind_exon->start();
$start = $ind_exon->end();
}
#-----------------------------+
# START GFF3 WORK HERE |
#-----------------------------+
my $attribute;
my $feature;
if ($gff_ver =~ "GFF3") {
$attribute = "ID=".$source."_".$gene_id."_".$exon_id.
"\;Parent=".$source."_".$gene_id;
$feature = "exon";
}
else {
$feature = "exon";
$attribute = "gene_".$gene_num;
}
print GFFOUT $seq_id."\t". # Seqname
$source."\t". # Source
$feature."\t". #feature
$start."\t". # start
$end."\t". # end
$ind_exon->score()."\t". # score
$strand."\t". # strand
".\t". # frame
$attribute. # attribute
"\n";
# The following does work
#print GFFOUT $ind_exon->primary_tag()."\t";
#///////////////////////////////
# The following do not work
#///////////////////////////////
#print GFFOUT $gene->cds()."\n";
#print GFFOUT $ind_exon->significance()."\t";
#print $ind_exon->predicted_cds();
#print GFFOUT $ind_exon->coding_signal_score()."\t";
#print GFFOUT $ind_exon->seq_id()."\t";
#print $ind_exon->significance()."\n";
# Get the CDS of the sequence
#print STDERR $ind_exon->cds()."\n";
}
# # initial exons only
# @init_exons = $gene->exons('Initial');
# # internal exons only
# @intrl_exons = $gene->exons('Internal');
# # terminal exons only
# @term_exons = $gene->exons('Terminal');
# # singleton exons:
# ($single_exon) = $gene->exons();
}
# CLOSE FGENESH
$fgenesh_result->close();
}
sub print_help {
my ($help_msg, $podfile) = @_;
# help_msg is the type of help msg to use (ie. help vs. usage)
print "\n";
#-----------------------------+
# PIPE WITHIN PERL |
#-----------------------------+
# This code made possible by:
# http://www.perlmonks.org/index.pl?node_id=76409
# Tie info developed on:
# http://www.perlmonks.org/index.pl?node=perltie
#
#my $podfile = $0;
my $scalar = '';
tie *STDOUT, 'IO::Scalar', \$scalar;
if ($help_msg =~ "usage") {
podselect({-sections => ["SYNOPSIS|MORE"]}, $0);
}
else {
podselect({-sections => ["SYNOPSIS|ARGUMENTS|OPTIONS|MORE"]}, $0);
}
untie *STDOUT;
# now $scalar contains the pod from $podfile you can see this below
#print $scalar;
my $pipe = IO::Pipe->new()
or die "failed to create pipe: $!";
my ($pid,$fd);
if ( $pid = fork() ) { #parent
open(TMPSTDIN, "<&STDIN")
or die "failed to dup stdin to tmp: $!";
$pipe->reader();
$fd = $pipe->fileno;
open(STDIN, "<&=$fd")
or die "failed to dup \$fd to STDIN: $!";
my $pod_txt = Pod::Text->new (sentence => 0, width => 78);
$pod_txt->parse_from_filehandle;
# END AT WORK HERE
open(STDIN, "<&TMPSTDIN")
or die "failed to restore dup'ed stdin: $!";
}
else { #child
$pipe->writer();
$pipe->print($scalar);
$pipe->close();
exit 0;
}
$pipe->close();
close TMPSTDIN;
print "\n";
exit 0;
}
1;
__END__
=head1 NAME
cnv_fgenesh2gff.pl - Convert fgenesh gene predictions to gff format
=head1 VERSION
This documentation refers to program version $Rev: 948 $
=head1 SYNOPSIS
=head2 Usage
cnv_fgenesh2gff.pl -i infile.txt -o outfile.gff
=head2 Required Arguments
--infile # Path to fgenesh result to convert
--outfie # Path to the gff format output
=head1 DESCRIPTION
This program converts output from the fgenesh program to the gff format. If
the fgenesh output file appears to be saved from the web, the program
will attempt to first strip the HTML tags from the text before converting
to the GFF format.
=head1 REQUIRED ARGUMENTS
=over 2
=item -i,--infile
Path of the input file. This should a text file of the result of the fgenesh
gene prediction program. If an input file is not specified, then the program
will expect input from STDIN.
=item -o,--outfile
Path of the gff file that is produced by the program. If an output file
is not specified, the program will write output to STDOUT.
=back
=head1 OPTIONS
=over 2
=item --gff-ver
The GFF version for the output. This will accept either gff2 or gff3 as the
options. By default the GFF version will be GFF2 unless specified otherwise.
The default GFF version for output can also be set in the user environment
with the DP_GFF option. The command line option will always override the option
defined in the user environment.
=item --html
Use this to convert the output from the softberry website if you
saved the text in html format.
=item -p,--param
The label used to describe the parameter set used for the the annotation
program. This identifier will be appended the source column (col 2)
in the GFF output.
=item -s,--seqname
This is the name of the sequence that was annotated. This will be used
in the source column (col 1) of the gff output file. By default, the program
will use the name of the sequence as specified in the fgenesh output file.
=item --usage
Short overview of how to use program from command line.
=item --help
Show program usage with summary of options.
=item --version
Show program version.
=item --man
Show the full program manual. This uses the perldoc command to print the
POD documentation for the program.
=item -q,--quiet
Run the program with minimal output.
=back
=head1 EXAMPLES
=over 2
=item Typical Use
Typically you will be using this program to convert the fgenesh annotation
output for an individual sequence file to the gff format.
cnv_fgenesh2gff.pl -i fgenesh_result.txt -o fgenesh_result.gff
This will result in a GFF result similar to the following:
HEX3045G05 fgenesh exon 961 1456 12.02 + . gene_1
HEX3045G05 fgenesh exon 1702 2725 0.04 + . gene_1
HEX3045G05 fgenesh exon 3619 3982 10.41 + . gene_1
HEX3045G05 fgenesh exon 6960 7273 13.70 + . gene_2
HEX3045G05 fgenesh exon 7435 7789 21.29 + . gene_2
HEX3045G05 fgenesh exon 7904 8091 1.14 + . gene_2
HEX3045G05 fgenesh exon 8248 9163 13.79 + . gene_2
HEX3045G05 fgenesh exon 9206 9587 8.00 + . gene_2
...
=item Specify the Sequence ID
Generally the cvn_fgenesh2gff.pl program will use the label for the sequence
as reported in the fgenesh report file. Otherwise, you can specify the
source sequence name using the -n or --name flag. For example:
cnv_fgenesh2gff.pl -i result.txt -o result.gff -n wheat_1
Will result in a gff file like the following:
wheat_1 fgenesh exon 961 1456 12.02 + . gene_1
wheat_1 fgenesh exon 1702 2725 0.04 + . gene_1
wheat_1 fgenesh exon 3619 3982 10.41 + . gene_1
wheat_1 fgenesh exon 6960 7273 13.70 + . gene_2
wheat_1 fgenesh exon 7435 7789 21.29 + . gene_2
wheat_1 fgenesh exon 7904 8091 1.14 + . gene_2
wheat_1 fgenesh exon 8248 9163 13.79 + . gene_2
wheat_1 fgenesh exon 9206 9587 8.00 + . gene_2
...
This option allows you to change the name of the sequence source without
having to run the fgenesh program again.
=item Specify the Parameter Set
It is often useful to run a program using different parameter sets. The
cnv_fgenesh2gff.pl program therefore allows you to specify the label
for a set of parameters to be able to distinguish multiple prediction results
from the same program using different parameter combinations. This
parameter set label will be added to the second column of the gff
output file.
For example running the program with parameter set one:
cnv_fgenesh2gff.pl -i result.txt -o result.gff -p set_1
This will result in a GFF file like the following:
HEX3045G05 fgenesh:set_1 exon 961 1456 12.02 + . gene_1
HEX3045G05 fgenesh:set_1 exon 1702 2725 0.04 + . gene_1
HEX3045G05 fgenesh:set_1 exon 3619 3982 10.41 + . gene_1
HEX3045G05 fgenesh:set_1 exon 6960 7273 13.70 + . gene_2
HEX3045G05 fgenesh:set_1 exon 7435 7789 21.29 + . gene_2
HEX3045G05 fgenesh:set_1 exon 7904 8091 1.14 + . gene_2
HEX3045G05 fgenesh:set_1 exon 8248 9163 13.79 + . gene_2
HEX3045G05 fgenesh:set_1 exon 9206 9587 8.00 + . gene_2
...
Then running the program wit parameter set two:
cnv_fgenesh2gff.pl -i result.txt -o result.gff -p set_2
This will result in a GFF file like the following:
HEX3045G05 fgenesh:set_2 exon 961 1456 12.02 + . gene_1
HEX3045G05 fgenesh:set_2 exon 1702 2725 0.04 + . gene_1
HEX3045G05 fgenesh:set_2 exon 3619 3982 10.41 + . gene_1
...
This will allow you to later distinguish between the result for parameter
set one and the parameter set two results.
=item Set GFF3 as the GFF3 version to output
The gff-ver option can be used to set the GFF version that will be
used for output. The command line option will always overried the option
defined in the user environment. For example:
cnv_fgenesh2gff.pl -i result.txt -o result.gff --gff-ver gff3
will produce outout in GFF3 format.
=item Accepting Input from STDIN
It is often useful in working at the unix command line to pipe the output
from one program to another. For that reason, the cnv_fgenesh2gff.pl program
can accept input from STDIN. For example, given a text file named result.txt.
You can send the result to cnv_fgenesh2gff.pl using the cat command and
then the pipe '|':
cat result.txt | cnv_fgenesh2gff.pl
Since an output file is not specified, the result will be printed to
STDOUT and will appear on the screen.
=item Writing Output to STDOUT
Since the program can write output to STDOUT, it is possible to
directly load the GFF file to your database. For example, if you
have a script called load_gff2mydb.pl, you can pipe the GFF results
to this program directly:
cnv_fgenesh2gff.pl -i result.txt | load_gff2mydb.pl
This will load the result to your database without generating a copy
of the GFF file on your hard drive.
=item Removing Text That Throws Warnings
Saving the output from the fgenesh webpage will included the copywrite statement
from. You will get the following warning:
--------------------- WARNING ---------------------
MSG: seq doesn't validate, mismatch is ?1999,2009,<,://,/>
---------------------------------------------------
This warning is only written to STDERR, and should not affect the gff output
of the program. However, you can remove the offending line of fgenesh
output using the grep command before piping the text to the
cnv_fgenesh2gff.pl program.
grep -v 'www.softberry.com' fgenesh.txt | cnv_fgenesh2gff.pl
=item Strip HTML Tags
It is also possible to parse output from the softberry website if
it was saved in html text format using the --html option. This
will attempt to strip the html and save a local tmp copy that
is in plain text file that will then be parsed:
cnv_fgenesh2gff.pl -i infile.txt --html
=back
=head1 DIAGNOSTICS
The following lists some typical error messages and solutions:
=over 2
=item * MSG: seq doesn't validate, mismatch is ?1999,2009,<,://,/>
This generally will be seen when the fgenesh text file includes the
copywrite statement from the softberry web site.
=item * MSG: seq doesn't validate, mismatch is &,;,:[,]13,(,)961,39821884,,,+,
You may see something like this if you are trying to parse a result
you saved from the softberry web site in the html format. The solution
to this problem is to save the program as text. You can strip the
html from the program using the --html option.
=item * WARNING: The input file appears to be HTML
You will see this message if the program detects that the fgenesh output
you are trying to parse is in HTML format. If this is the case,
cnv_fgenesh2gff.pl will attempt to save a copy of the fgenesh
result as a normal text file before converting to GFF format.
=back
=head1 CONFIGURATION AND ENVIRONMENT
=over 2
=item DP_GFF
The DP_GFF variable can be defined in the user environment to set
the default GFF version output. Valid settings are 'gff2' or
'gff3'.
=back
=head1 DEPENDENCIES
=head2 Required Software
=over 2
=item * Fgenesh
This program is designed to parse ab initio gene annotation results generated
by the Fgenesh program. These results can be generated from a local copy
of the Fgenesh program, or can be results obtained by the Fgenesh web
service provided by softberry
http://linux1.softberry.com/berry.phtml
=back
=head2 Required Perl Modules
=over 2
=item * Bio::Tools::Fgenesh
This program requires the perl module Bio::Tools::Fgenesh. This module is
part of the bioperl package
=back
Other modules or software that the program is dependent on.
=head1 BUGS AND LIMITATIONS
=head2 Bugs
=over 2
=item * No bugs currently known
If you find a bug with this software, file a bug report on the DAWG-PAWS
Sourceforge website: http://sourceforge.net/tracker/?group_id=204962
=back
=head2 Limitations
=over 2
=item * Not Tested on Fgenesh Binary
This progarm has only been tested with output from the softberry
website and has not been tested with the Fgenesh binary. If you find
that this program does work with the standalone program, please
contact the author and let me know.
=back
=head1 SEE ALSO
This program is part of the DAWGPAWS package of genome
annotation programs. See the DAWGPAWS web page
( http://dawgpaws.sourceforge.net/ )
or the Sourceforge project page
( http://sourceforge.net/projects/dawgpaws )
for additional information about this package.
=head1 REFERENCE
Your use of the DAWGPAWS programs should reference the following manuscript:
JC Estill and JL Bennetzen. 2009.
"The DAWGPAWS Pipeline for the Annotation of Genes and Transposable
Elements in Plant Genomes." Plant Methods. 5:8.
=head1 LICENSE
GNU General Public License, Version 3
L<http://www.gnu.org/licenses/gpl.html>
THIS SOFTWARE COMES AS IS, WITHOUT ANY EXPRESS OR IMPLIED
WARRANTY. USE AT YOUR OWN RISK.
=head1 AUTHOR
James C. Estill E<lt>JamesEstill at gmail.comE<gt>
=head1 HISTORY
STARTED: 01/31/2009
UPDATED: 01/12/2010
VERSION: $Rev: 948 $
=cut
#-----------------------------------------------------------+
# HISTORY |
#-----------------------------------------------------------+
#
# 01/31/2009
# - Program started, basic conversion to gff using the
# bioperl module for parsing fgenesh programs
# 02/02/2009
# - Updated POD documentation
# - Added the --html flag to strip html if needed
# - Added autodetect of html format
#
# 03/27/2009
# - Working on adding code to deal with (c) statement
# - Added --program option
# - Renamed --name option to --seqname
#
# 01/12/2010
# - Added option for GFF3 output, this can accept the
# desired version from the command line with 'gff-ver' or
# as defined in the user environment with DP_GFF.
# The default version is GFF2 if not specified at the command
# line or the user environment.
# - This currently sets exon as the child of gene.
# - Updated POD for the changes
#
# 04/15/2010
# - Updated reference and see also