[Bioperl-l] converting to clustalw alignment format

Roy Chaudhuri roy.chaudhuri at gmail.com
Tue Sep 18 11:41:57 UTC 2012


Include the option:
-displayname_flat=>1
when you create your writeio_obj, ie.:

my $writeio_obj = Bio::AlignIO->new(-file=>">$out",
-format=>'clustalw', -displayname_flat=>1);

See:
http://doc.bioperl.org/releases/bioperl-current/bioperl-live/Bio/AlignIO.html#POD1

Cheers,
Roy.


On 18 September 2012 10:28, Tao Zhu <bill_zt at sina.com> wrote:
>
>
> I have a DNA seq alignment in FASTA format:
>
>> scry
> TATAAAAACATTAAGTGCTACTGCACTGATATAATTGTTAAC
>> soct
> TACAAAAATTTCAAATGCTATTGTACTGATATCATTGTCGAC
>> spom
> TTTAAAAATGTAGAGTGTTATTGCACTAATTTAAGCATTGAC
>> sjap
> GAAAAAGAAATCGAGTGTTATTGTACAGACTTGATTGTAAAC
>
> I changed it to CLUSTALW format using Bio::AlignIO
>
> my $in =  shift;
> my $out = shift;
> use Bio::AlignIO;
> my $align_obj   = Bio::AlignIO->new(-file=>$in,
> -format=>'fasta')->next_aln;
> my $writeio_obj = Bio::AlignIO->new(-file=>">$out", -format=>'clustalw');
> $writeio_obj->write_aln($align_obj);
>
> The result is:
> scry/1-139             TATAAAAACATTAAGTGCTACTGCACTGATATAATTGTTAAC
> soct/1-137             TACAAAAATTTCAAATGCTATTGTACTGATATCATTGTCGAC
> spom/1-135             TTTAAAAATGTAGAGTGTTATTGCACTAATTTAAGCATTGAC
> sjap/1-87              GAAAAAGAAATCGAGTGTTATTGTACAGACTTGATTGTAAAC
>                           *** *  *  * ** ** ** **  *  * *   *  **
>
> I didn't want positions like "/1-139" to be shown, I just want the same
> sequence name as original.
>
> How should I do to eliminate positions like "/1-XXX"? Thank you!
> _______________________________________________
> 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