File: SeqDiff.t

package info (click to toggle)
bioperl 1.4-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 20,336 kB
  • ctags: 8,476
  • sloc: perl: 119,890; xml: 6,001; lisp: 121; makefile: 57
file content (108 lines) | stat: -rw-r--r-- 2,641 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# -*-Perl-*-
## Bioperl Test Harness Script for Modules
## $Id: SeqDiff.t,v 1.6 2002/06/10 08:38:54 heikki Exp $

# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.t'

use strict;
BEGIN {
    # to handle systems with no installed Test module
    # we include the t dir (where a copy of Test.pm is located)
    # as a fallback
    eval { require Test; };
    if( $@ ) {
	use lib 't';
    }
    use Test;
    plan tests => 42;
}

use Bio::Variation::SeqDiff;
use Bio::Variation::DNAMutation;
use Bio::Variation::Allele;

ok 1;
my ($obj, $mm, $aa, $dna, $m);

ok $obj = Bio::Variation::SeqDiff -> new;

ok $obj->id('id');
ok $obj->id, 'id';

ok $obj->sysname('sysname');
ok $obj->sysname, 'sysname';

$obj->trivname('trivname'); 
ok $obj->trivname eq 'trivname';

ok $obj->chromosome('chr');
ok $obj->chromosome, 'chr';

ok $obj->description('desc');
ok $obj->description, 'desc';

ok $obj->numbering('numbering');
ok $obj->numbering, 'numbering';

ok $obj->offset(100);
ok $obj->offset, 100;
#                  12345678901234567890
ok $obj->dna_ori ('gctgctgatcgatcgtagctagctag');
ok $obj->dna_ori, 'gctgctgatcgatcgtagctagctag';

# generate mutated DNA seq from the mutation
ok $m = Bio::Variation::DNAMutation->new(-isMutation => 1, -start=>14, -end=>14);
ok $a = Bio::Variation::Allele->new(-seq=>'c');
$b = Bio::Variation::Allele->new(-seq=>'g');
ok $m->allele_ori($a);
ok $m->allele_mut($b);
ok $obj->add_Variant($m);
my $m2 = Bio::Variation::DNAMutation->new(-isMutation => 1, -start=>19, -end=>19);
my $a2 = Bio::Variation::Allele->new(-seq=>'c');
my $b2 = Bio::Variation::Allele->new(-seq=>'g');
$m2->allele_ori($a2);
$m2->allele_mut($b2);
$obj->add_Variant($m2);

#ok $obj->dna_mut('gctgctgatcggtcgtagctagctag');
ok $obj->dna_mut, 'gctgctgatcgatggtaggtagctag';

ok $obj->rna_ori('gctgctgatcgatcgtagctagctag');
ok $obj->rna_ori, 'gctgctgatcgatcgtagctagctag';

$obj->rna_mut('gctgctgatcgatcgtagctagctag'); 
ok $obj->rna_mut, 'gctgctgatcgatcgtagctagctag';

ok $obj->aa_ori('MHYTRD');
ok $obj->aa_ori, 'MHYTRD';

ok $obj->aa_mut('MHGTRD');
ok $obj->aa_mut, 'MHGTRD';

foreach $mm ( $obj->each_Variant ) {
    $mm->primary_tag('a');
    ok $mm->isa('Bio::Variation::VariantI');
}


ok $obj->gene_symbol('fos');
ok $obj->gene_symbol, 'fos';

ok $obj->rna_offset(10);
ok $obj->rna_offset == 10;

ok $obj->rna_id('transcript#3');
ok $obj->rna_id, 'transcript#3';

ok $dna = $obj->seqobj('dna_ori');
ok $dna->isa('Bio::PrimarySeq');

$obj->aa_mut(''); 
$aa = $obj->seqobj('aa_mut');
ok not defined $aa;

eval {
    $dna = $obj->seqobj('dna_ri');
};
ok $@;