[Bioperl-l] fasta conversion
lsbrath at gmail.com
lsbrath at gmail.com
Mon Jun 8 20:28:46 UTC 2009
Hello!
I am running into trouble while trying to convert a text file to fasta. It
should be simple enough but I am getting a wierd error message.
This is my script:
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use File::Copy;
use Bio::SeqIO;
my $maid_dir = "C:/Documents and Settings/mgavi.brathwaite/Desktop/msa";
my $maid = '13063';
opendir my $dh, "$maid_dir"; # directory to search
my @files = readdir $dh;
#find the _fasta file
for my $f (@files){
my $fa = $maid_dir."/".$maid."_hu_1kb.fa";
my $r = $maid_dir."/".$maid."_hu_1kb.txt";
open (my $in,$r);
if($f=~ m/^(\d+)_hu_1kb/){ # convert to fasta
print Dumper($f);
my $hu_1kb = $maid.'_hu_1kb'; #file to convert
my $in = Bio::SeqIO->new(-file => $r,
-format => 'raw');
my $out = Bio::SeqIO->new(-file => ">$fa",
-format => 'Fasta');
while ( my $seq = $in->next_seq()) {
$out->write_seq($seq);
}
}
}
I keep getting the following error message:
-------------------- WARNING ---------------------
MSG: seq doesn't validate, mismatch is 13063
---------------------------------------------------
------------- EXCEPTION: Bio::Root::Exception -------------
MSG: Attempting to set the sequence to [13063HU] which does not look healthy
STACK: Error::throw
STACK: Bio::Root::Root::throw C:/Perl/site/lib/Bio/Root/Root.pm:359
STACK: Bio::PrimarySeq::seq C:/Perl/site/lib/Bio/PrimarySeq.pm:258
STACK: Bio::PrimarySeq::new C:/Perl/site/lib/Bio/PrimarySeq.pm:210
STACK: Bio::Seq::new C:/Perl/site/lib/Bio/Seq.pm:484
STACK: Bio::Seq::SeqFactory::create
C:/Perl/site/lib/Bio/Seq/SeqFactory.pm:116
STACK: C:/Perl/site/lib/Bio\SeqIO\raw.pm:119
-----------------------------------------------------------
Anyone out there that can help me solve this?
More information about the Bioperl-l
mailing list