#!/usr/bin/perl -w use strict; # create_gff.pl, last update: 8/5/03 # creates a gff file from other files # by Chet Langin, clangin@siu.edu # SIU Plant Biotechnology and Genome Core-facility # set the timer use Time::HiRes; my $start_time = Time::HiRes::time; # all of the filenames are preset # the output file will remain open throughout the script # the input files will be opened and processed one at a time open OUTPUT_FILE, ">soybean.gff" or die "Cannot open output file: $!\n"; print "Current file being processed: MLG\n"; open MLG_INPUT, "<../gff/mlg.gff" or die "Cannot open MLG file: $!\n"; # copy each line as is to the output file while() { print OUTPUT_FILE; } # while close MLG_INPUT; my @file_list = qw/ sorted_locus_placements.txt sorted_clone_placements.txt sorted_contig_placements.txt/; my $track = ""; foreach my $current_file(@file_list) { if($current_file =~ /locus/) { $track = "Loci"; } # if elsif($current_file =~ /clone/) { $track = "Clone"; } # elsif else { $track = "Ctg"; } # else print "Current file being processed: $track\n"; open(CURRENT_INPUT, "<", $current_file) or die "Cannot open $current_file: $!\n"; while() { chomp; my @fields = split /\t/; my $mlg = $fields[0]; my $start = $fields[1]; my $end = $fields[2]; my $name = $fields[3]; print OUTPUT_FILE "$mlg\tvarious\t$track\t$start\t$end\t.\t+\t.\tSequence \"$name\" ; Note\n"; } close CURRENT_INPUT; } # foreach close OUTPUT_FILE; # show the run time print "Run time: ${\(Time::HiRes::time - $start_time)} seconds\n";