#!/usr/bin/perl -w use strict; use Getopt::Std; use Data::Dumper; use File::Basename; my $prog_name = basename($0); my $usage = <<"USAGE"; Usage: $prog_name [-flags] Files must be all one type. ie (all fasta NT, all fastq, all fasta fna). The script is able to detect if fasta or fastq files have been suplied. Depending on the flags, it produces different output. $prog_name will produce a histogram, a vector distribution, and a NT/AA distribution. For fastq files, you must use a flag to specify which version. of fastq the file is formatted with. -l to specify Solexa/Illumina < 1.3 Fastq -s to specify Sanger Fastq -u to specify Illumina >= 1.3 Fastq only one option is allowed! USAGE ###### "code" starts here ########### my %opts; die "$usage" if !getopts ("lsu", \%opts); # above removes any -lu or -lus options from command line # all that is left in @ARGV are the two file paths... # above will cause $usage to be printed if unknown option, say # "-x" is encountered. die "must have 2 files: fasta infile and an output file!\n$usage" if (my ($inflile, $outfile) = @ARGV) !=2; foreach my $opt (keys %opts) #just for debugging.... { print "$opt= $opts{$opt}\n"; } # here is where you put stuff that rules out combos of options. # I am guessing that more than one option is not right die "only one option allowed!\n$usage" if (keys %opts >1); #ie only 0 or 1 options are allowed #now open the input file and the output files # #error should say "can't open $infile for read", etc.... #we are past the usage stuff...