| 1 | package Microarray::File::Clone_Locns; | ||
| 2 | |||
| 3 | use 5.006; | ||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | our $VERSION = '1.8'; | ||
| 7 | |||
| 8 | require Microarray::File; | ||
| 9 | |||
| 10 | { package clone_locn_file; | ||
| 11 | |||
| 12 | our @ISA = qw( microarray_text_file ); | ||
| 13 | |||
| 14 | sub import_data { | ||
| 15 | my $self = shift; | ||
| 16 | $self->make_clone_hash; | ||
| 17 | } | ||
| 18 | sub make_clone_hash { | ||
| 19 | my $self = shift; | ||
| 20 | my $source = $self->get_source; | ||
| 21 | $source =~ s/"//g; | ||
| 22 | my @aRows = split(/\n/,$source); | ||
| 23 | $self->line_num(scalar @aRows); | ||
| 24 | |||
| 25 | my %hClones = (); | ||
| 26 | for my $row (@aRows){ | ||
| 27 | my ($name,$locn,$chr) = split(/;/,$row); | ||
| 28 | $hClones{ $name } = { | ||
| 29 | _chr => $chr, | ||
| 30 | _locn => $locn | ||
| 31 | }; | ||
| 32 | } | ||
| 33 | $self->{ _clones } = \%hClones; | ||
| 34 | } | ||
| 35 | sub clone_number { | ||
| 36 | my $self = shift; | ||
| 37 | $self->line_num; | ||
| 38 | } | ||
| 39 | sub clone_hash { | ||
| 40 | my $self = shift; | ||
| 41 | if (@_){ | ||
| 42 | my $clone = shift; | ||
| 43 | my $hClones = $self->{ _clones }; | ||
| 44 | return $hClones->{ $clone }; | ||
| 45 | } else { | ||
| 46 | $self->{ _clones }; | ||
| 47 | } | ||
| 48 | } | ||
| 49 | sub chromosome { | ||
| 50 | my $self = shift; | ||
| 51 | my $hClone = $self->clone_hash(shift); | ||
| 52 | return $hClone->{ _chr }; | ||
| 53 | } | ||
| 54 | sub location { | ||
| 55 | my $self = shift; | ||
| 56 | my $hClone = $self->clone_hash(shift); | ||
| 57 | return $hClone->{ _locn }; | ||
| 58 | } | ||
| 59 | sub chr_location { | ||
| 60 | my $self = shift; | ||
| 61 | my $clone = shift; | ||
| 62 | return ($self->chromosome($clone), $self->location($clone)); | ||
| 63 | } | ||
| 64 | sub genomic_locn { # ensembl build 36 figures | ||
| 65 | my $self = shift; | ||
| 66 | my $clone = shift; | ||
| 67 | if ((my $chr = $self->chromosome($clone)) && (my $locn = $self->location($clone))){ | ||
| 68 | my %hChromosome = ( | ||
| 69 | # start bp # length | ||
| 70 | 1 => 0, # 247249719 | ||
| 71 | 2 => 247249720, # 242951149 | ||
| 72 | 3 => 490200869, # 199501827 | ||
| 73 | 4 => 689702696, # 191273063 | ||
| 74 | 5 => 880975759, # 180857866 | ||
| 75 | 6 => 1061833625, # 170899992 | ||
| 76 | 7 => 1232733617, # 158821424 | ||
| 77 | 8 => 1391555041, # 146274826 | ||
| 78 | 9 => 1537829867, # 140273252 | ||
| 79 | 10 => 1678103119, # 135374737 | ||
| 80 | 11 => 1813477856, # 134452384 | ||
| 81 | 12 => 1947930240, # 132349534 | ||
| 82 | 13 => 2080279774, # 114142980 | ||
| 83 | 14 => 2194422754, # 106368585 | ||
| 84 | 15 => 2300791339, # 100338915 | ||
| 85 | 16 => 2401130254, # 88827254 | ||
| 86 | 17 => 2489957508, # 78774742 | ||
| 87 | 18 => 2568732250, # 76117153 | ||
| 88 | 19 => 2644849403, # 63811651 | ||
| 89 | 20 => 2708661054, # 62435964 | ||
| 90 | 21 => 2771097018, # 46944323 | ||
| 91 | 22 => 2818041341, # 49691432 | ||
| 92 | 23 => 2867732773, # 154913754 X-alternative | ||
| 93 | 24 => 3022646527, # 57772954 Y-alternative | ||
| 94 | X => 2867732773, # 154913754 | ||
| 95 | Y => 3022646527 # 57772954 TOTAL=3080419480 | ||
| 96 | ); | ||
| 97 | return unless (defined $hChromosome{$chr}); | ||
| 98 | return $hChromosome{$chr} + $locn; | ||
| 99 | } | ||
| 100 | } | ||
| 101 | } | ||
| 102 | |||
| 103 | |||
| 104 | 1; | ||
| 105 | |||
| 106 | |||
| 107 | __END__ |