References - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

References

Description:

References – PowerPoint PPT presentation

Number of Views:45
Avg rating:3.0/5.0
Slides: 26
Provided by: tabr1
Category:

less

Transcript and Presenter's Notes

Title: References


1
References
2
  • Assignment Due Friday
  • READ
  • Ensembl API Tutorial
  • http//www.ensembl.org/info/docs/api/core/core_tut
    orial.html

3
Cluster Assignment
4
References
  • Are similar to "pointers" in C
  • May be used to build complex data structures
    (such as 2-D arrays)
  • Are essentially scalars themselves
  • Created with \

5
Reference Example
  • !/usr/bin/perl
  • i 69 scalar
  • j \i j is now a scalar "reference" to i
  • print j What is this ???
  • print "\n"
  • print j This "dereferences" a "reference"
  • print "\n" meaning, it "accesses" whatever the
    "reference" references (or points to)
  • Output
  • SCALAR(0x8060224)
  • 69

6
  • !/usr/bin/perl
  • i 69 scalar
  • j \i j is now a scalar "reference" to i
  • print j What is this ???
  • print "\n"
  • print j This "dereferences" a "reference"
  • print "\n" meaning, it "accesses" whatever the
    "reference" references (or points to)
  • i 96
  • print j Now this prints 96
  • print "\n"

7
Scalar References
  • Scalar reference
  • j \i
  • Using a scalar reference
  • j This is the reference
  • j This accesses what the reference is
    pointing to
  • Anonymous references
  • ref \32
  • scooby_ref \"ScoobyDoo"

8
References
k
i
Scooby
7
m
j
i7 k"Scooby"
9
References
k
i
Scooby
7
j
m
j \k
10
References
k
i
Scooby
7
j
m
m j
11
References
k
i
Scooby
7
j
m
m \j Reference to a reference
12
References
k
i
Scooby
7
j
m
Value of k through j j Value of k through
m m
13
References
k
i
7
j
m
k \i Value of i thru m m
14
Array References (an array of scalars)
  • Creating an array ref
  • _at_i (1, 2, 3)
  • j \_at_i
  • Using an array ref
  • k j0 k is first element of array
    1
  • The "j" dereferences to an ARRAY, and then the
    "0" accesses the first element of the array

15
-gt for Dereferencing
  • _at_i (1, 2, 3)
  • j \_at_i
  • j0 11 change first element of array
    from 1 to 11
  • j-gt0 11 ditto (same thing)
  • I prefer this notation -- easier to
    read

16
Arrays of References (or arrays of arrays)
  • j 5
  • k 7
  • m 8
  • _at_i (\j, \k, \m)
  • Access the value of j ???
  • i0 ???? -- remember this worked when the
    first element of the array was a SCALAR (here the
    first element is a REFERENCE)
  • No -- i0 is the reference, NOT i
  • i0

17
Example
  • !/usr/bin/perl
  • deepReference2.pl
  • j5
  • k7
  • m8
  • _at_i (\j, \k, \m)
  • print "First i0 \n"
  • print "Second i0 \n"

18
Arrays of References (or arrays of arrays)
  • Since references are scalars, we can create
    arrays of references
  • _at_first (1,2,3,4,5)
  • _at_second (10,20,30,40,50)
  • _at_third (100,200,300,400,500)
  • \_at_ is a "reference"
  • _at_numbers (\_at_first,\_at_second,\_at_third) _at_numbers
    is an array of "array references"

19
  • !/usr/bin/perl
  • _at_first (1,2,3,4,5)
  • _at_second (10,20,30,40,50)
  • _at_third (100,200,300,400,500)
  • \_at_ is a "reference"
  • _at_numbers (\_at_first,\_at_second,\_at_third)
  • foreach i (_at_numbers) i becomes a reference
    to an array
  • foreach j (_at_i) _at_ dereferences i (an
    reference to an aray)
  • so j is an elemetn of
    an array
  • print "j is value in arrayArray\n"
  • print "\n"

20
Needleman-Wunsch Algorithm
  • Dynamic programming solution
  • Global, optimal alignment
  • Uses a 2D matrix of partially computed alignment
    scores.
  • Must select a scoring system for
    matches/mismatches and gaps
  • Two phases to the algorithm
  • Construction of similarity a matrix
  • Recursive traversal of the matrix to construct
    the actual alignment
  • An illustration 2 sequences AAAC, AGC

21
Algorithm Basics
Match 1 Mismatch -1 Gap -2
22
NW Traversal Demonstration
23
Example Needleman-Wunsch
  • Enter sequence 1
  • ATGCCA
  • Enter sequence 2
  • TGCG
  • b matrix
  • T G C G
  • 0 -1 -2 -3 -4
  • A -1 0 0 0 0
  • T -2 2 0 0 0
  • G -3 0 2 0 2
  • C -4 0 0 2 0
  • C -5 0 0 2 0
  • A -6 0 0 0 0
  • d matrix
  • T G C G
  • 0
  • A D D D D
  • T D D D D
  • G V D H D
  • a matrix
  • T G C G
  • 0 -1 -2 -3 -4
  • A -1 0 -1 -2 -3
  • T -2 1 0 -1 -2
  • G -3 0 3 2 1
  • C -4 -1 2 5 4
  • C -5 -2 1 4 5
  • A -6 -3 0 3 4
  • score 4
  • Align1 - T G - C G
  • Align2 A T G C C A

Use gap -1 mis-match
0 perfect match 2 Make shortest sequence
horizontal Web resources?
24
Some code to get started
  • sub print_matrix
  • my matrixRef shift a ref to an array of
    refs
  • my c shift column
  • my r shift row
  • my i
  • my j
  • my x
  • print "\t\t"
  • for(i0iltc-1i)
  • print substr(seq1,i,1)."\t"
  • print "\n"
  • Here's how to access the matrix thru a ref
  • matrixRef13 99
  • x 0 count thru length of seq2
  • !/usr/bin/perl
  • use strict
  • my _at_a A matrix
  • my col 4
  • my row 5
  • my seq1"TTGGAT"
  • my seq2"TTATAGA"
  • col length(seq1)1
  • row length(seq2)1
  • A matrix -- holds calculated scores
  • a000

25
End
Write a Comment
User Comments (0)
About PowerShow.com