[Bio] / FigKernelScripts / p3-rep-prots.pl Repository:
ViewVC logotype

Diff of /FigKernelScripts/p3-rep-prots.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4, Fri Oct 19 16:06:14 2018 UTC revision 1.5, Tue Mar 26 11:46:38 2019 UTC
# Line 30  Line 30 
30  If specified, a C<6.1.1.20.dna.fasta> file will be produced in addition to the others, containing  If specified, a C<6.1.1.20.dna.fasta> file will be produced in addition to the others, containing
31  the DNA sequences of the proteins.  the DNA sequences of the proteins.
32    
33    =item binning
34    
35    If specified, a seed protein database suitable for binning will be produced with the specified name.
36    (This is similar to the C<dna> option, but produces the comments in a slightly different format).
37    
38  =item debug  =item debug
39    
40  If specified, status messages for the PATRIC3 API will be displayed.  If specified, status messages for the PATRIC3 API will be displayed.
# Line 55  Line 60 
60          ['clear', 'clear the output directory if it exists'],          ['clear', 'clear the output directory if it exists'],
61          ['prot=s', 'name of the protein to use', { default => 'Phenylalanyl-tRNA synthetase alpha chain' }],          ['prot=s', 'name of the protein to use', { default => 'Phenylalanyl-tRNA synthetase alpha chain' }],
62          ['dna', 'produce a DNA FASTA file in addition to the default files'],          ['dna', 'produce a DNA FASTA file in addition to the default files'],
63            ['binning=s', 'produce a SEED protein binning database in the named file'],
64          ['debug', 'show P3 API messages']          ['debug', 'show P3 API messages']
65          );          );
66  # Get the output directory name.  # Get the output directory name.
# Line 73  Line 79 
79  if ($opt->dna) {  if ($opt->dna) {
80      $dnaFile = "$outDir/6.1.1.20.dna.fasta";      $dnaFile = "$outDir/6.1.1.20.dna.fasta";
81  }  }
82    my $binning = $opt->binning;
83  # Create the statistics object.  # Create the statistics object.
84  my $stats = Stats->new();  my $stats = Stats->new();
85  # Create a filter from the protein name.  # Create a filter from the protein name.
# Line 81  Line 88 
88  # Save the checksum for the seed role.  # Save the checksum for the seed role.
89  my $roleCheck = RoleParse::Checksum($protName);  my $roleCheck = RoleParse::Checksum($protName);
90  # Create a list of the columns we want.  # Create a list of the columns we want.
   
91  my @cols = qw(genome_id genome_name patric_id aa_sequence_md5 product);  my @cols = qw(genome_id genome_name patric_id aa_sequence_md5 product);
92  if ($dnaFile) {  my $dnaMode;
93    if ($dnaFile || $binning) {
94      push @cols, 'na_sequence_md5';      push @cols, 'na_sequence_md5';
95        $dnaMode = 1;
96  }  }
97  # Open the output files.  # Open the output files.
98  print "Setting up files.\n";  print "Setting up files.\n";
99  open(my $gh, '>', "$outDir/complete.genomes") || die "Could not open genome output file: $!";  open(my $gh, '>', "$outDir/complete.genomes") || die "Could not open genome output file: $!";
100  open(my $fh, '>', "$outDir/6.1.1.20.fasta") || die "Could not open FASTA output file: $!";  open(my $fh, '>', "$outDir/6.1.1.20.fasta") || die "Could not open FASTA output file: $!";
101  my $nh;  my ($bh, $nh);
102  if ($dnaFile) {  if ($dnaFile) {
103      open($nh, '>', $dnaFile) || die "Could not open DNA output file: $!";      open($nh, '>', $dnaFile) || die "Could not open DNA output file: $!";
104  }  }
105    if ($binning) {
106        open($bh, '>', $binning) || die "Could not open binning output file: $!";
107    }
108  # Get access to PATRIC.  # Get access to PATRIC.
109  my $p3 = P3DataAPI->new();  my $p3 = P3DataAPI->new();
110  if ($opt->debug) {  if ($opt->debug) {
# Line 175  Line 186 
186      } else {      } else {
187          print $gh "$genome\t$name\n";          print $gh "$genome\t$name\n";
188          print $fh ">$genome\n$seq\n";          print $fh ">$genome\n$seq\n";
189          if ($nh && $dnaMd5) {          if ($dnaMd5) {
190              my $dna = $md5Hash->{$dnaMd5};              my $dna = $md5Hash->{$dnaMd5};
191              if (! $dna) {              if (! $dna) {
192                  $stats->Add(missingDna => 1);                  $stats->Add(missingDna => 1);
193              } else {              } else {
194                    if ($nh) {
195                  print $nh ">$genome\n$dna\n";                  print $nh ">$genome\n$dna\n";
196                  $stats->Add(dnaOut => 1);                  $stats->Add(dnaOut => 1);
197              }              }
198                    if ($bh) {
199                        print $bh ">fig|$genome.peg.X $genome\t$name\n$dna\n";
200                        $stats->Add(binDnaOut => 1);
201                    }
202                }
203          }          }
204      }      }
205      $stats->Add(genomeOut => 1);      $stats->Add(genomeOut => 1);

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3