[Bioperl-l] fasta conversion

Mark A. Jensen maj at fortinbras.us
Mon Jun 8 17:12:03 EDT 2009


you're getting the sequence descriptor rather than the sequence in the return 
from
$in->next_seq. Read up on what the 'raw' format actually entails in the 
Bio::SeqIO pod..
cheers MAJ
----- Original Message ----- 
From: <lsbrath at gmail.com>
To: <bioperl-l at lists.open-bio.org>
Sent: Monday, June 08, 2009 4:28 PM
Subject: [Bioperl-l] fasta conversion


> 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?
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
> 




More information about the Bioperl-l mailing list