~ubuntu-branches/ubuntu/trusty/bioperl/trusty

« back to all changes in this revision

Viewing changes to t/AlignIO/phylip.t

  • Committer: Package Import Robot
  • Author(s): Charles Plessy
  • Date: 2013-09-22 13:39:48 UTC
  • mfrom: (3.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20130922133948-c6z62zegjyp7ztou
Tags: 1.6.922-1
* New upstream release.
* Replaces and Breaks grinder (<< 0.5.3-3~) because of overlaping contents.
  Closes: #722910
* Stop Replacing and Breaking bioperl ( << 1.6.9 ): not needed anymore. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
BEGIN {
7
7
        use lib '.';
8
8
    use Bio::Root::Test;
9
 
    
10
 
    test_begin(-tests => 16);
11
 
        
 
9
 
 
10
    test_begin(-tests => 17);
 
11
 
12
12
        use_ok('Bio::AlignIO::phylip');
13
13
}
14
14
 
16
16
 
17
17
my ($str,$aln,$strout,$status);
18
18
 
 
19
# PHYLIP sequential/non-interleaved
 
20
$strout = Bio::AlignIO->new('-file'  => test_input_file('noninterleaved.phy'), '-interleaved' => 0,
 
21
                            '-format' => 'phylip');
 
22
$aln = $strout->next_aln($aln);
 
23
isa_ok($aln,'Bio::Align::AlignI');
 
24
is($aln->get_seq_by_pos(2)->seq(), 'CCTCAGATCACTCTTTGGCAACGACCCCTCGTCACAATAA'.
 
25
   'AGGTAGGGGGGCAACTAAAGGAAGCTCTATTAGATACAGGAGCAGATGATACAGTATTAGAAGACATGAATT'.
 
26
   'TGCCAGGAAGATGGAAACCAAAAATGATAGGGGGAATTGGAGGGTTTATCAAAGTAAGACAGTATGATCAGA'.
 
27
   'TACCCATAGAGATCTGTGGACATAAAGCTATAGGTACAGTATTAGTAGGACCCACACCTGTCAATATAATTG'.
 
28
   'GAAGAAATCTGTTGACTCAGATTGGTTGCACTTTAAATTTT' );
 
29
 
 
30
# PHYLIP interleaved with long Ids
 
31
 
 
32
$str = Bio::AlignIO->new(
 
33
    '-file' => test_input_file("protpars_longid.phy"),
 
34
    '-format' => 'phylip',
 
35
    'longid' => 1);
 
36
 
 
37
$aln = $str->next_aln();
 
38
#isa_ok($str,'Bio::AlignIO');
 
39
isa_ok($aln,'Bio::Align::AlignI');
 
40
is $aln->get_seq_by_pos(1)->get_nse, 'S I N F R U  P 0 0 1 /1-84';
 
41
is $aln->get_seq_by_pos(2)->get_nse, 'SINFRUP002/1-84';
 
42
 
 
43
# PHYLIP interleaved, multiple segments
 
44
$str = Bio::AlignIO->new(
 
45
    '-file' => test_input_file("protpars.phy"),
 
46
    '-format' => 'phylip');
 
47
 
 
48
$aln = $str->next_aln();
 
49
#isa_ok($str,'Bio::AlignIO');
 
50
isa_ok($aln,'Bio::Align::AlignI');
 
51
is $aln->get_seq_by_pos(1)->get_nse, 'SINFRUP001/1-4940';
 
52
# is $aln->get_seq_by_pos(2)->get_nse, 'SINFRUP002/1-84';
 
53
 
 
54
 
19
55
# PHYLIP interleaved
 
56
 
20
57
$str = Bio::AlignIO->new(
21
58
    '-file' => test_input_file("testaln.phylip"),
22
59
    '-format' => 'phylip');
23
 
isa_ok($str,'Bio::AlignIO');
24
60
$aln = $str->next_aln();
 
61
#isa_ok($str,'Bio::AlignIO');
25
62
isa_ok($aln,'Bio::Align::AlignI');
26
63
is $aln->get_seq_by_pos(1)->get_nse, 'Homo_sapie/1-45';
27
64
 
45
82
    is($ls->length,47);
46
83
}
47
84
 
48
 
# PHYLIP sequential/non-interleaved
49
 
$strout = Bio::AlignIO->new('-file'  => test_input_file('noninterleaved.phy'),
50
 
                            '-format' => 'phylip');
51
 
$aln = $strout->next_aln($aln);
52
 
isa_ok($aln,'Bio::Align::AlignI');
53
 
is($aln->get_seq_by_pos(2)->seq(), 'CCTCAGATCACTCTTTGGCAACGACCCCTCGTCACAATAA'.
54
 
   'AGGTAGGGGGGCAACTAAAGGAAGCTCTATTAGATACAGGAGCAGATGATACAGTATTAGAAGACATGAATT'.
55
 
   'TGCCAGGAAGATGGAAACCAAAAATGATAGGGGGAATTGGAGGGTTTATCAAAGTAAGACAGTATGATCAGA'.
56
 
   'TACCCATAGAGATCTGTGGACATAAAGCTATAGGTACAGTATTAGTAGGACCCACACCTGTCAATATAATTG'.
57
 
   'GAAGAAATCTGTTGACTCAGATTGGTTGCACTTTAAATTTT' );
58
 
 
59
 
# PHYLIP interleaved with long Ids
60
 
$str = Bio::AlignIO->new(
61
 
    '-file' => test_input_file("protpars_longid.phy"),
62
 
    '-format' => 'phylip',
63
 
    'longid' => 1);
64
 
 
65
 
isa_ok($str,'Bio::AlignIO');
 
85
# check to see that newlines between header and sequences are parsed correctly
 
86
$str = Bio::AlignIO->new('-file' => test_input_file("codeml45b.mlc"), '-format' => 'phylip', '-longid' => 1);
66
87
$aln = $str->next_aln();
67
 
isa_ok($aln,'Bio::Align::AlignI');
68
 
is $aln->get_seq_by_pos(1)->get_nse, 'S I N F R U  P 0 0 1 /1-84';
69
 
is $aln->get_seq_by_pos(2)->get_nse, 'SINFRUP002/1-84';
70
 
 
 
88
$ls = $aln->get_seq_by_pos(9);
 
89
ok($ls->display_id eq "Pop_trich_ch", "newline between header and sequences is parsed correctly");