Changeset 6


Ignore:
Timestamp:
Apr 14, 2010, 9:54:51 AM (10 years ago)
Author:
maarten
Message:

added dbsnp reference

Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • lib/ProccesAllicVariants.pm

    r5 r6  
    99        my $self           = {};
    1010        $self->{Omim2Pubmed} = "";
     11        $self->{Omim2DBsnp}  = "";
    1112
    1213        bless($self);    # but see below
     
    3536        my ( $self, $o2p ) = @_;
    3637        $self->{Omim2Pubmed} = $o2p;
     38
     39}
     40
     41sub addOmim2dbsnp {
     42        my ( $self, $o2dbsnp ) = @_;
     43        $self->{Omim2DBsnp} = $o2dbsnp;
    3744
    3845}
     
    156163        }
    157164
    158         return (\@returnarray);
     165        return ( \@returnarray );
    159166}
    160167
     
    189196        my @years = ();
    190197        if ( $yearsUnformated =~ /^(\d{4})$/ ) {
    191                         push( @years, $1 );
     198                push( @years, $1 );
    192199        }
    193200        else {
     
    204211        }
    205212
    206         return (\@years);
     213        return ( \@years );
    207214
    208215}
    209216
    210217sub formatAuthors {
    211         my ($authref)       = shift;
     218        my ($authref) = shift;
    212219        my @authorsAndYears = @$authref;
    213         print (scalar(@authorsAndYears));
    214         my @formatedAuth    = ();
    215 
    216         for ( my $i = 0 ; $i < scalar(@authorsAndYears) ; $i =$i +2 ) {
     220        print( scalar(@authorsAndYears) );
     221        my @formatedAuth = ();
     222
     223        for ( my $i = 0 ; $i < scalar(@authorsAndYears) ; $i = $i + 2 ) {
    217224                my $years = fomatYears( $authorsAndYears[ $i + 1 ] );
    218225                foreach my $year (@$years) {
     
    220227                }
    221228        }
    222         return(\@formatedAuth);
     229        return ( \@formatedAuth );
    223230}
    224231
     
    235242        }
    236243        return ($deceaseID);
     244}
     245
     246sub formatAAMutation {
     247        my $mutation = @_;
     248        ##TODO determ mutation is deletion, substitution of insertion.
     249        if  (! $mutation =~ /\w{3}\d{1,4}\w{w}/ ) {
     250                carp("non mutation\t".$mutation);
     251        }
     252        return ($mutation);
    237253}
    238254
     
    242258        my @authAndYear = @$authref;
    243259        my ( $author, $year, $pubmedid ) = "";
    244         for ( my $i = 0 ; $i < scalar(@authAndYear) ; $i =$i +2 ) {
     260        for ( my $i = 0 ; $i < scalar(@authAndYear) ; $i = $i + 2 ) {
    245261                $author   = $authAndYear[$i];
    246262                $year     = $authAndYear[ $i + 1 ];
     
    259275        foreach my $av (@avs) {
    260276
    261                 my $mutation        = getMutation($av);
     277                my $mutation        = formatAAMutation( getMutation($av) );
    262278                my $authorsAndYears = getAuthor( $av->description() );
    263279                $authorsAndYears = formatAuthors($authorsAndYears);
    264                 my $articles=$self->createAuthorsOutput( $refsref,$authorsAndYears, $numb  );
     280                my $articles =
     281                  $self->createAuthorsOutput( $refsref, $authorsAndYears, $numb );
    265282                my $desc = $av->description();
     283                my $dbsnp = $self->{Omim2DBsnp}->getdbsnp( $numb, $av->number() );
    266284                $desc =~ tr/\n/ /;
    267285                if ( length($desc) < 60 ) {
    268286
    269287                        my $pubmedid = "test";
    270                          # $self->getPubmedID( $refsref, $authAV, $yearAV, $numb );
     288
     289                        # $self->getPubmedID( $refsref, $authAV, $yearAV, $numb );
    271290                        $result .=
    272291                            $numb . "\t"
     
    283302                        my $nucleotidemutation =
    284303                          extractnuclitdemutation( $desc, $av->position() );
    285        
     304
    286305                        $result .=
    287306                            $numb . "\t"
    288307                          . $av->number() . "\t"
    289                           . $av->title() . " "
     308                          . $av->title() . "\t"
    290309                          . $deceaseID . "\t"
    291310                          . $mutation . "\t"
    292                           .$articles."\t"
    293                         #  . $authAV . "("
    294                         #  . $yearAV . ") "
    295                          
     311                          . $dbsnp. "\t"
     312                          . $articles . "\t"
     313
     314                          #  . $authAV . "("
     315                          #  . $yearAV . ") "
     316
    296317                          . $nucleotidemutation . "\n";
    297318                }
  • omimparser.pl

    r5 r6  
    77use warnings;
    88use lib::Omim2Pubmed;
     9use lib::Omim2dbsnp;
     10
    911use Data::Dumper;
    1012use lib::ProccesAllicVariants;
     
    6365$omim2pubmed->loadpubmed_cited($pubmedcited);
    6466
     67my $dbsnpreff="data/dbsnp-to-OMIM.cvs";
     68my $dbsnp=Omim2dbsnp->new();
     69$dbsnp->loadCrossReference($pubmedcited);
     70
    6571
    6672  my $omim_parser = Bio::Phenotype::OMIM::OMIMparser->new(  -omimtext => $filename );
    6773  my $PAV=ProccesAllicVariants->new();
    6874$PAV-> addOmim2pubmed($omim2pubmed);
     75$PAV->  addOmim2dbsnp($dbsnp);
    6976  while ( my $omim_entry = $omim_parser->next_phenotype() ) {
    7077    # This prints everything.
  • test/test.pl

    r5 r6  
    88use ProccesAllicVariants;
    99use Omim2Pubmed;
     10use Omim2dbsnp;
    1011use Bio::Phenotype::OMIM::OMIMparser;
    11 use Test::More tests => 33;
     12use Test::More tests => 36;
    1213
    1314#lib "../lib";
    1415my $filename    = "data.bak/ACTA.omim.txt";
    1516my $pubmedcited = "../data/pubmed_cited";
     17
    1618my $omim2pubmed = Omim2Pubmed->new();
    1719$omim2pubmed->loadpubmed_cited($pubmedcited);
     
    2022my $PAV = ProccesAllicVariants->new();
    2123$PAV->addOmim2pubmed($omim2pubmed);
     24
     25my $dbsnpref="../data/dbsnp-to-OMIM.cvs";
     26my $dbsnp=Omim2dbsnp->new();
     27$dbsnp->loadCrossReference($dbsnpref);
     28$PAV->addOmim2dbsnp($dbsnp);
     29is($PAV->{Omim2DBsnp}->getdbsnp("600046","0025"),"3890182","testing getdbsnp only with numbers");
     30is($PAV->{Omim2DBsnp}->getdbsnp("600046","0025a"),"3890182","testing getdbsnp  with numbers and junk");
     31
     32
     33
    2234
    2335my $string =
     
    157169(2004) identified a 1110A-C transversion in the ACTA1 gene, resulting in
    158170a glu334-to-ala (E334A) substitution. Two members of the family
    159 developed adult-onset hypertrophic cardiomyopathy and respiratory
     171developed adult-onset hypertrophic cardimyopathy and respiratory
    160172insufficiency.";
    161173
Note: See TracChangeset for help on using the changeset viewer.