Bio-Phylo
view release on metacpan or search on metacpan
t/24-bioperl-alignio.t view on Meta::CPAN
$aln = Bio::Phylo::Matrices::Matrix->new_from_bioperl( $str->next_aln() );
isa_ok( $aln, 'Bio::Align::AlignI' );
$str = Bio::AlignIO->new(
'-file' => test_input_file("UnaSmithHIV-both.nex"),
'-format' => 'nexus',
'-verbose' => -1,
);
isa_ok( $str, 'Bio::AlignIO' );
$aln = Bio::Phylo::Matrices::Matrix->new_from_bioperl( $str->next_aln() );
isa_ok( $aln, 'Bio::Align::AlignI' );
$str = Bio::AlignIO->new(
'-file' => test_input_file("quoted-strings2.nex"),
'-format' => 'nexus',
'-verbose' => -1,
);
isa_ok( $str, 'Bio::AlignIO' );
$aln = Bio::Phylo::Matrices::Matrix->new_from_bioperl( $str->next_aln() );
isa_ok( $aln, 'Bio::Align::AlignI' );
$str = Bio::AlignIO->new(
'-file' => test_input_file("barns-combined.nex"),
'-format' => 'nexus',
'-verbose' => -1,
);
isa_ok( $str, 'Bio::AlignIO' );
$aln = Bio::Phylo::Matrices::Matrix->new_from_bioperl( $str->next_aln() );
isa_ok( $aln, 'Bio::Align::AlignI' );
$str = Bio::AlignIO->new(
'-file' => test_input_file("radical-whitespace.nex"),
'-format' => 'nexus',
'-verbose' => -1,
);
isa_ok( $str, 'Bio::AlignIO' );
$aln = Bio::Phylo::Matrices::Matrix->new_from_bioperl( $str->next_aln() );
isa_ok( $aln, 'Bio::Align::AlignI' );
$str = Bio::AlignIO->new(
'-file' => test_input_file("basic-bush.nex"),
'-format' => 'nexus',
'-verbose' => -1,
);
isa_ok( $str, 'Bio::AlignIO' );
$aln = Bio::Phylo::Matrices::Matrix->new_from_bioperl( $str->next_aln() );
isa_ok( $aln, 'Bio::Align::AlignI' );
$str = Bio::AlignIO->new(
'-file' => test_input_file("radical-whitespace_02.nex"),
'-format' => 'nexus',
'-verbose' => -1,
);
# EMBOSS water
$str = Bio::AlignIO->new(
'-format' => 'emboss',
'-file' => test_input_file('cysprot.water'),
'-verbose' => -1,
);
$aln = Bio::Phylo::Matrices::Matrix->new_from_bioperl( $str->next_aln() );
isa_ok( $aln, 'Bio::Align::AlignI' );
is( $aln->score, '501.50' );
is( $aln->get_seq_by_pos(1)->get_nse, 'PAPA_CARPA/3-342' );
is( $aln->get_seq_by_pos(2)->get_nse, 'CATL_HUMAN/1-331' );
SKIP: {
skip 'percentage identity', 2, if 1;
is( sprintf( "%.1f", $aln->overall_percentage_identity ), 33.8 );
is( sprintf( "%.1f", $aln->average_percentage_identity ), 40.1 );
}
is( $aln->get_seq_by_pos(1)->start, 3 );
SKIP: {
skip 'length', 1, if 1;
is( $aln->length, 364 );
}
# EMBOSS needle
$str = Bio::AlignIO->new(
'-format' => 'emboss',
'-file' => test_input_file('cysprot.needle'),
'-verbose' => -1,
);
$aln = Bio::Phylo::Matrices::Matrix->new_from_bioperl( $str->next_aln() );
isa_ok( $aln, 'Bio::Align::AlignI' );
is( $aln->score, '499.50' );
is( $aln->get_seq_by_pos(1)->get_nse, 'PAPA_CARPA/1-345' );
is( $aln->get_seq_by_pos(2)->get_nse, 'CATL_HUMAN/1-333' );
# EMBOSS water 2.2.x
$str = Bio::AlignIO->new(
'-format' => 'emboss',
'-file' => test_input_file('cys1_dicdi.water'),
'-verbose' => -1,
);
$aln = Bio::Phylo::Matrices::Matrix->new_from_bioperl( $str->next_aln() );
isa_ok( $aln, 'Bio::Align::AlignI' );
is( $aln->get_seq_by_pos(1)->get_nse, 'CYS1_DICDI/1-343' );
is( $aln->get_seq_by_pos(2)->get_nse, 'CYS1_DICDI-1/1-343' );
is( $aln->score, '1841.0' );
$aln = Bio::Phylo::Matrices::Matrix->new_from_bioperl( $str->next_aln() );
isa_ok( $aln, 'Bio::Align::AlignI' );
is( $aln->get_seq_by_pos(1)->get_nse, 'CYS1_DICDI/29-343' );
is( $aln->get_seq_by_pos(2)->get_nse, 'ALEU_HORVU/61-360' );
# EMBOSS water 2.2.x sparse needle
$str = Bio::AlignIO->new(
-verbose => $DEBUG,
'-format' => 'emboss',
'-file' => test_input_file('sparsealn.needle'),
'-verbose' => -1,
);
$aln = Bio::Phylo::Matrices::Matrix->new_from_bioperl( $str->next_aln() );
isa_ok( $aln, 'Bio::Align::AlignI' );
is( $aln->score, '18.0' );
is( sprintf( "%.1f", $aln->overall_percentage_identity ), 2.1 );
is( sprintf( "%.1f", $aln->average_percentage_identity ), 38.5 );
is( $aln->get_seq_by_pos(1)->length, 238 );
is( $aln->length, 238 );
is( $aln->get_seq_by_pos(1)->get_nse, 'KV1K_HUMAN/1-108' );
is( $aln->get_seq_by_pos(2)->get_nse, 'IF1Y_HUMAN/1-143' );
is( $aln->get_seq_by_pos(1)->seq(),
'DIQMTQSPSTLSVSVGDRVTITCEASQTVLSYLNWYQQK'
. 'PGKAPKLLIYAASSLETGVPSRFSGQGSGTBFTFTISSVZPZBFATYYCQZYLDLPRTFGQGTKVDLKR'
. '-' x 130 );
is( $aln->get_seq_by_pos(2)->seq(),
( '-' x 94 )
. 'PKNKGKGGK-NRRRGKNENESEKRELVFKE'
. 'DGQEYAQVIKMLGNGRLEALCFDGVKRLCHIRGKLRKKVWINTSDIILVGLRDYQDNKADVILKYNADEAR'
. 'SLKAYGGLPEHAKINETDTFGPGDDDEIQFDDIGDDDEDIDDI' );
is( $aln->is_flush, 1 );
# MEGA
$str = Bio::AlignIO->new(
'-format' => 'mega',
'-file' => test_input_file("hemoglobinA.meg"),
'-verbose' => -1,
);
$aln = Bio::Phylo::Matrices::Matrix->new_from_bioperl( $str->next_aln() );
isa_ok( $aln, 'Bio::Align::AlignI' );
is( $aln->get_seq_by_pos(1)->get_nse, 'Human/1-141' );
is( $aln->get_seq_by_pos(2)->get_nse, 'Horse/1-144' );
$aln->unmatch();
is( $aln->get_seq_by_pos(3)->subseq( 1, 10 ), 'V-LSAADKGN' );
$strout = Bio::AlignIO->new(
'-format' => 'mega',
'-file' => ">" . test_output_file(),
'-verbose' => -1,
);
$status = $strout->write_aln($aln);
is $status, 1, "mega output test";
# EMBOSS needle
$str = Bio::AlignIO->new(
'-format' => 'emboss',
'-file' => test_input_file('gf-s71.needle'),
'-verbose' => -1,
);
$aln = Bio::Phylo::Matrices::Matrix->new_from_bioperl( $str->next_aln() );
isa_ok( $aln, 'Bio::Align::AlignI' );
is( $aln->get_seq_by_pos(2)->seq(),
'MEDVTLFQFTWRKPI-RLQGEIVYKTSETQTIETNKKDVECVANFQENKEVQTDS-VDNGVGENVKKDITISKEVLNLLYDFVRDDSKVNYDRLLEFHKFDKVALETVQKYHVETRNENIILMISSSSRKTLILFGGISHETFCSHQARALLCSSSTSFSIPLPVCAISAVFYSSTQFILGDVSGNISMCSKDKIIFEKKITDGAVTCLEMCRHGLLSGSDDGNIILWQIGTSGLEKLGGTKLTVSDLS...
);
is( $aln->get_seq_by_pos(1)->seq(),
'MEDVTLHHFRWRKPVENKNGEIVYKTSETQTAEISRKDVECVANFQKSQESQTDDFMQNGVGDGIKKEIRISKEVLGHIYDFLRDDSKVNYDRLLEFHKFDKVSLETVQKYHVETRNENIILMISNSSRKTLILFGGLSHETFCSHQARAVLCSSSTTSSLPLPVCAISAVFYSSTQFLLGDISGNISMWTKEKMIFENKVTDGSVTSLELCRYGLLSGSDDGNVILWKVEESKIEKIEGIKLTVSDLS...
);
is( $aln->is_flush(), 1 );
is( $aln->get_seq_by_pos(1)->get_nse, 'gf.s71.44/1-448' );
is( $aln->get_seq_by_pos(2)->get_nse, 'Y50C1A.2/1-406' );
# PHYLIP sequential/non-interleaved
$strout = Bio::AlignIO->new(
'-file' => test_input_file('noninterleaved.phy'),
'-format' => 'phylip',
'-verbose' => -1,
);
$aln =
( run in 1.384 second using v1.01-cache-2.11-cpan-364913b4093 )