#!/usr/bin/perl #################################################### # This program has been written by Biju Issac for # extracting cds from genbank files #################################################### $cnt=0; open(FO,">$ARGV[1]"); open(FL,"$ARGV[0]"); #open combined features file while($line=){ chomp($line); @cod=split(/\s+/,$line); if($cod[0] eq "LOCUS"){ if($cnt>0){ $cds=~s/[^0-9]/ /g; $cds=~s/\s+/ /g; print FO "$name $cds\n"; } $cnt++; $name="$cod[1]";$s=0;$cds=""; } if($cod[1] eq "CDS"){ $s=1;$cds=""; } if($s==1){ $gim=substr($cod[1],1,4); if($gim eq "gene" || $gim eq "tran" || $gim eq "db_x" || $gim eq "codo" || $gim eq "EC_n" || $gim eq "prod" || $gim eq "note"){ $s=0; } } if($s==1){ for($i=1;$i<@cod;$i++){ $cds.=" $cod[$i]"; } } } if($cnt>0){ $cds=~s/[^0-9]/ /g; $cds=~s/\s+/ /g; print FO "$name $cds\n"; } close FL; close FO;