Want to edit bioperl script for making .ptt files (for each contig) from .gbk files.
Entering edit mode
15 months ago

Hello. I am currently doing pangenome analysis of multiple genome strains simultaneously.I am using PGAP-X pipeline. For this purpose, I have to convert .gbk files into .ptt file.My questions are: 1) Is there any on click tool or Python code to convert the .gbk files into .ptt files? 2) From Biostars website, I have found a Bioperl script for the conversion, However since I am a newbie in script writing; I am unable to understand the errors present in the script. I have tried running it on Padre The Perl and it shows error in line 3 (BOLD) 3) I don't know where and how to take my saved .gbk file as an input to get the desired output. Do I have to take one file at a a time?

#!/usr/bin/env perl
use strict;
**use Bio::SeqIO;**
my $gbk = Bio::SeqIO->new(-fh=>\*STDIN, -format=>'genbank');
my $seq = $gbk->next_seq;
my @cds = grep { $_->primary_tag eq 'CDS' } $seq->get_SeqFeatures;

print $seq->description, " - 0..",$seq->length,"\r\n";
print scalar(@cds)," proteins\r\n";
print join("\t", qw(Location Strand Length PID Gene Synonym Code COG 

for my $f (@cds) {
   my $gi = '-';
   $gi = $1 if tag($f, 'db_xref') =~ m/\bGI:(\d+)\b/;
   my $cog = '-';
   $cog = $1 if tag($f, 'product') =~ m/^(COG\S+)/;
   my @col = (
     $f->strand >= 0 ? '+' : '-',
     tag($f, 'gene'),
     tag($f, 'locus_tag'),
     tag($f, 'product'),
   print join("\t", @col), "\r\n";

sub tag {
   my($f, $tag) = @_;
   return '-' unless $f->has_tag($tag);
   return join(' ', $f->get_tag_values($tag));
genome software error perl DNA-Seq Python • 550 views
Entering edit mode

Does Padre show any error message? In any case you should use #!/usr/bin/env perl instead of !/usr/bin/env perl. And error with use Bio::SeqIO could be because this module is not installed. You can install it by opening CPAN client from start menu and running these commands:

get Bio::SeqIO
make Bio::SeqIO
test Bio::SeqIO
install Bio::SeqIO

You may also try Unix & Perl Primer book which is suited for beginners in programming.


Login before adding your answer.

Traffic: 1686 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6