t/*: remove "use lib '.'" and t/lib/Error.pm
[bioperl-live.git] / t / AlignIO / emboss.t
blob9f79e69f22f74b6725159ecf41823aaa23aee5ac
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id: emboss.t 14971 2008-10-28 16:08:52Z cjfields $
4 use strict;
6 BEGIN {
7     use Bio::Root::Test;
8     
9     test_begin(-tests => 37);
10         
11         use_ok('Bio::AlignIO::emboss');
14 my $DEBUG = test_debug();
16 my ($str,$aln,$strout,$status);
18 # EMBOSS water
19 $str = Bio::AlignIO->new('-format' => 'emboss',
20                  '-file'   => test_input_file('cysprot.water'));
21 $aln = $str->next_aln();
22 isa_ok($aln,'Bio::Align::AlignI');
23 is($aln->score,'501.50');
24 is($aln->get_seq_by_pos(1)->get_nse,'PAPA_CARPA/3-342');
25 is($aln->get_seq_by_pos(2)->get_nse,'CATL_HUMAN/1-331');
26 is(sprintf("%.1f",$aln->overall_percentage_identity),33.8);
27 is(sprintf("%.1f",$aln->average_percentage_identity),40.1);
29 is($aln->get_seq_by_pos(1)->start, 3);
30 is($aln->length,364);
33 # EMBOSS needle
34 $str = Bio::AlignIO->new('-format' => 'emboss',
35           '-file'   => test_input_file('cysprot.needle'));
36 $aln = $str->next_aln();
37 isa_ok($aln,'Bio::Align::AlignI');
38 is($aln->score,'499.50');
39 is($aln->get_seq_by_pos(1)->get_nse,'PAPA_CARPA/1-345');
40 is($aln->get_seq_by_pos(2)->get_nse,'CATL_HUMAN/1-333');
43 # EMBOSS water 2.2.x
44 $str = Bio::AlignIO->new('-format' => 'emboss',
45          '-file'   => test_input_file('cys1_dicdi.water'));
46 $aln = $str->next_aln();
47 isa_ok($aln,'Bio::Align::AlignI');
48 is($aln->get_seq_by_pos(1)->get_nse,'CYS1_DICDI/1-343');
49 is($aln->get_seq_by_pos(2)->get_nse,'CYS1_DICDI-1/1-343');
50 is($aln->score,'1841.0');
51 $aln = $str->next_aln();
52 isa_ok($aln,'Bio::Align::AlignI');
53 is($aln->get_seq_by_pos(1)->get_nse,'CYS1_DICDI/29-343');
54 is($aln->get_seq_by_pos(2)->get_nse,'ALEU_HORVU/61-360');
57 # EMBOSS water 2.2.x sparse needle
58 $str = Bio::AlignIO->new(-verbose => $DEBUG,
59           '-format' => 'emboss',
60         '-file'   => test_input_file('sparsealn.needle'));
61 $aln = $str->next_aln();
62 isa_ok($aln,'Bio::Align::AlignI');
63 is($aln->score,'18.0');
64 is(sprintf("%.1f",$aln->overall_percentage_identity), 2.1);
65 is(sprintf("%.1f",$aln->average_percentage_identity), 38.5);
66 is($aln->get_seq_by_pos(1)->length, 238);
67 is($aln->length,238);
68 is($aln->get_seq_by_pos(1)->get_nse,'KV1K_HUMAN/1-108');
69 is($aln->get_seq_by_pos(2)->get_nse,'IF1Y_HUMAN/1-143');
70 is($aln->get_seq_by_pos(1)->seq(), 'DIQMTQSPSTLSVSVGDRVTITCEASQTVLSYLNWYQQK'.
71    'PGKAPKLLIYAASSLETGVPSRFSGQGSGTBFTFTISSVZPZBFATYYCQZYLDLPRTFGQGTKVDLKR'.
72    '-'x130);
73 is($aln->get_seq_by_pos(2)->seq(), ('-'x94).'PKNKGKGGK-NRRRGKNENESEKRELVFKE'.
74    'DGQEYAQVIKMLGNGRLEALCFDGVKRLCHIRGKLRKKVWINTSDIILVGLRDYQDNKADVILKYNADEAR'.
75    'SLKAYGGLPEHAKINETDTFGPGDDDEIQFDDIGDDDEDIDDI');
76 is($aln->is_flush, 1);
78 # EMBOSS needle
79 $str = Bio::AlignIO->new('-format' => 'emboss',
80           '-file'   => test_input_file('gf-s71.needle'));
81 $aln = $str->next_aln();
82 isa_ok($aln,'Bio::Align::AlignI');
83 is($aln->get_seq_by_pos(2)->seq(), 'MEDVTLFQFTWRKPI-RLQGEIVYKTSETQTIETNKKDVECVANFQENKEVQTDS-VDNGVGENVKKDITISKEVLNLLYDFVRDDSKVNYDRLLEFHKFDKVALETVQKYHVETRNENIILMISSSSRKTLILFGGISHETFCSHQARALLCSSSTSFSIPLPVCAISAVFYSSTQFILGDVSGNISMCSKDKIIFEKKITDGAVTCLEMCRHGLLSGSDDGNIILWQIGTSGLEKLGGTKLTVSDLSRKIRRSSTSNKPVAIVSMQVYVWPSGEEACVATETGGLYLLTLPTLDYKPLSHQTATSINKILFENQFVAVIYHTSNAAVFNSEGLVDEIPFVATLAVR----------PKLVLF--YTSVCVQDITLNCTSPFREFNNEYNPVIKFSKIRFSADLSVING-FRTSSPNSNN-----------------------------------------------');
84 is($aln->get_seq_by_pos(1)->seq(), 'MEDVTLHHFRWRKPVENKNGEIVYKTSETQTAEISRKDVECVANFQKSQESQTDDFMQNGVGDGIKKEIRISKEVLGHIYDFLRDDSKVNYDRLLEFHKFDKVSLETVQKYHVETRNENIILMISNSSRKTLILFGGLSHETFCSHQARAVLCSSSTTSSLPLPVCAISAVFYSSTQFLLGDISGNISMWTKEKMIFENKVTDGSVTSLELCRYGLLSGSDDGNVILWKVEESKIEKIEGIKLTVSDLSRKIRRSSTSNKPVAIVSMQV----SGDEVCVATETGGLYLLTLPTLESKPLT-QSATSIFKILYEHPYIAVVYHTSNSAIFNSEGLVDEIPFVATLAVRCGAYFIFSNQSRLIIWSMNTRSTVIDENLNCHS-ICSLSND--------------TLQVLDGDFNLNSQSENSATSESENLRISDLQNLRMLKLQNLRTSEFQNFRTSESQYFKKDNGEL');
85 is($aln->is_flush(), 1);
86 is($aln->get_seq_by_pos(1)->get_nse,'gf.s71.44/1-448');
87 is($aln->get_seq_by_pos(2)->get_nse,'Y50C1A.2/1-406');