4 # PURPOSE : Simple driver for Bio::Tools::pSW
5 # AUTHOR : Ewan Birney birney@sanger.ac.uk
6 # CREATED : Tue Oct 27 1998
11 # you almost certainly have to have installed bioperl
12 # from the makefile system for this to work. This is
13 # because this module use XS extensions (C source code
14 # 'compiled into' perl)
16 # The lib system below is just so that I (ewan) can test it
20 use lib
"/nfs/disk100/pubseq/wise/PerlMod/";
23 # This is a simple example script. We are going
24 # to make 3 sequences directly from memory and
25 # then align them once using blosum matrix and once
26 # using a gonnet matrix. These matrices should
27 # in the examples directory.
32 # redundant, as Bio::Tools::pSW uses them, but useful to say
33 # precisely what we are using ;)
39 # for legibility - write with newlines and then strip them!
41 $tseq = 'SKSESPKEPEQLRKLFIGGLSFETTDESLRSHFEQWGTLTDCVVMRDPNTKRSRGFGFVT
42 YATVEEVDAAMNARPHKVDGRVVEPKRAVSREDSQRPGAHLTVKKIFVGGIKEDTEEHHL
43 RDYFEQYGKIEVIEIMTDRGSGKKRGFAFVTFDDHDSVDKIVIQKYHTVNGHNCEVRKAL
44 SKQEMASASSSQRGRSGSGNFGGGRGGGFGGNDNFGRGGNFSGRGGFGGSRGGGGYGGSG
45 DGYNGFGNDGGYGGGGPGYSGGSRGYGSGGQGYGNQGSGYGGSGSYDSYNNGGGRGFGGG
46 SGSNFGGGGSYNDFGNYNNQSSNFGPMKGGNFGGRSSGPYGGGGQYFAKPRNQGGYGGSS
51 $seq1 = Bio
::Seq
->new(-id
=>'roa1_human',-seq
=>$tseq);
53 $tseq = 'MVNSNQNQNGNSNGHDDDFPQDSITEPEHMRKLFIGGLDYRTTDENLKAHFEKWGNIVDV
54 VVMKDPRTKRSRGFGFITYSHSSMIDEAQKSRPHKIDGRVVEPKRAVPRQDIDSPNAGAT
55 VKKLFVGALKDDHDEQSIRDYFQHFGNIVDINIVIDKETGKKRGFAFVEFDDYDPVDKVV
56 LQKQHQLNGKMVDVKKALPKQNDQQGGGGGRGGPGGRAGGNRGNMGGGNYGNQNGGGNWN
57 NGGNNWGNNRGGNDNWGNNSFGGGGGGGGGYGGGNNSWGNNNPWDNGNGGGNFGGGGNNW
58 NNGGNDFGGYQQNYGGGPQRGGGNFNNNRMQPYQGGGGFKAGGGNQGNYGGNNQGFNNGG
63 $seq2 = Bio
::Seq
->new(-id
=>'roa1_drome',-seq
=>$tseq);
65 $tseq = 'MHKSEAPNEPEQLRKLFIGGLSFETTDESLREHFEQWGTLTDCVVMRDPNSKRSRGFGFV
66 TYLSTDEVDAAMTARPHKVDGRVVEPKRAVSREDSSRPGAHLTVKKIFVGGIKEDTEEDH
67 LREYFEQYGKIEVIEIMTDRGSGKKRGFAFVTFEDHDSVDKIVIQKYHTVNNHNSQVRKA
68 LSKQEMASVSGSQRERGGSGNYGSRGGFGNDNFGGRGGNFGGNRGGGGGFGNRGYGGDGY
69 NGDGQLWWQPSLLGWNRGYGAGQGGGYGAGQGGGYGGGGQGGGYGGNGGYDGYNGGGSGF
70 SGSGGNFGSSGGYNDFGNYNSQSSSNFGPMKGGNYGGGRNSGPYGGGYGGGSASSSSGYG
74 $seq3 = Bio
::Seq
->new(-id
=>'roa1_xenla',-seq
=>$tseq);
78 # Now make an Alignment Factory with blosum62 as a matrix
82 $fac = Bio
::Tools
::pSW
->new(-matrix
=> 'blosum62.bla',-gap
=> 12, -ext
=> 2);
86 # run seq1 vs seq2 and seq1 vs seq3 and write the output direct
87 # to stdout using the 'pretty' method
90 $fac->align_and_show($seq1,$seq2,STDOUT
);
91 print "Next alignment\n";
92 $fac->align_and_show($seq1,$seq3,STDOUT
);
96 # a different factory, using gonnet, and now make a simple align and
100 $fac = Bio
::Tools
::pSW
->new(-matrix
=> 'gon250.bla',-gap
=> 12, -ext
=> 2);
103 # switch on reporting this time and change the amount of memory it is allowed
105 print STDOUT
"Doing the next calculation in limited memory, with a progress report\n";
110 $al = $fac->pairwise_alignment($seq1,$seq2);
113 # write out a MSF file
114 my $out = Bio
::AlignIO
->newFh('-fh'=> \
*STDOUT
, '-format' => 'msf');
115 my $status = print $out $al;
116 #$al->write_MSF(\*STDOUT);