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
Product)),"\r\n";
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->start.'..'.$f->end,
$f->strand >= 0 ? '+' : '-',
($f->length/3)-1,
$gi,
tag($f, 'gene'),
tag($f, 'locus_tag'),
$cog,
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));
}`
0 answers
No answers yet.
Log in to answer this question.
Does Padre show any error message? In any case you should use
#!/usr/bin/env perlinstead of!/usr/bin/env perl. And error withuse Bio::SeqIOcould be because this module is not installed. You can install it by opening CPAN client from start menu and running these commands:You may also try Unix & Perl Primer book which is suited for beginners in programming.
Please guide me how to input my .gbk file in the above script?
Let's say your file is called
seqs.gbkand is in the same folder as Perl script. All you need to do is to change the line:to this:
By doing this you change the script in a way that it reads not from standard input (STDIN) but from file seqs.gbk.
This certainly worked for me! Thankyou for the answer. Could you answer this query for me? How to download proteins in my scenario?