"Fossies" - the Fresh Open Source Software Archive

Member "augustus-3.3.3/scripts/filterInFrameStopCodons.pl" (13 Sep 2019, 1126 Bytes) of package /linux/misc/augustus-3.3.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "filterInFrameStopCodons.pl" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 3.3.2_vs_3.3.3.

    1 #!/usr/bin/env perl
    2 
    3 # Katharina J. Hoff
    4 # March 5th 2012
    5 #
    6 # Find all predicted genes that do not contain in-frame stop codons in an amino acid file and return the gene identifier (fasta header).
    7 #
    8 # Input format: multiple fasta with fasta headers that contain only the gene identifier.
    9 # Output format: List of gene identifiers
   10 #
   11 # Note: consider running AUGUSTUS with the option --noInFrameStop=true if you want to avoid stop codons in the first place.
   12 
   13 my $usage = "filterInFrameStopCodons.pl protein.fa > no-stop.lst\nConsider running AUGUSTUS with the option --noInFrameStop=true if you want to avoid stop codons in the first place.\n";
   14 
   15 if (@ARGV != 1) {
   16     print $usage;
   17     exit;
   18 }
   19 
   20 my $protein = $ARGV[0];
   21 my %hasStop;
   22 my $currentID;
   23 
   24 open(PROT, "<", $protein) or die "Could not open protein file $protein!\n";
   25 while(<PROT>){
   26     if($_=~m/^>/){
   27     $_=~s/>//;
   28     chomp;
   29     $currentID = $_;
   30     $hasStop{$currentID} = 0;
   31     }elsif($_=~m/X/){
   32     $hasStop{$currentID} = 1;
   33     }
   34 }
   35 close(PROT) or die "Could not close protein file $protein!\n";
   36 
   37 while ( ($id,$stop) = each %hasStop ) {
   38     if($stop == 0){
   39     print "$id\n";
   40     }
   41 }