Advertisement
Guest User

Untitled

a guest
Jul 12th, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 3.92 KB | None | 0 0
  1. use Bio::Phenotype::OMIM::OMIMparser;
  2.  
  3. $omim_parser = Bio::Phenotype::OMIM::OMIMparser->new( -genemap  => "genemap",
  4.                                                         -omimtext => "omim.txt" );
  5.                                                        
  6. my $parsedOMIM="parsed.OMIM.txt";
  7. open my $fh, ">", $parsedOMIM or die "Can't open $parsedOMIM: $!";
  8. print $fh "ID" . "\t" . "Disease" . "\t" . "Genes" . "\n";
  9.  
  10. while ( my $omim_entry = $omim_parser->next_phenotype() ) {
  11.     # This prints everything.
  12.     #~ print( $omim_entry->to_string() );
  13.     #~ print "\n\n";
  14.    
  15.     # This gets individual data (some of them object-arrays)
  16.     # (and illustrates the relevant methods of OMIMentry).
  17.     my $numb  = $omim_entry->MIM_number();                     # *FIELD* NO
  18.     my $title = $omim_entry->title();                          # *FIELD* TI - first line
  19.     my $alt   = $omim_entry->alternative_titles_and_symbols(); # *FIELD* TI - additional lines
  20.     my $mtt   = $omim_entry->more_than_two_genes();            # "#" before title
  21.     my $sep   = $omim_entry->is_separate();                    # "*" before title
  22.     my $desc  = $omim_entry->description();                    # *FIELD* TX
  23.     my $mm    = $omim_entry->mapping_method();                 # from genemap
  24.     my $gs    = $omim_entry->gene_status();                    # from genemap
  25.     my $cr    = $omim_entry->created();                        # *FIELD* CD
  26.     my $cont  = $omim_entry->contributors();                   # *FIELD* CN
  27.     my $ed    = $omim_entry->edited();                         # *FIELD* ED
  28.     my $sa    = $omim_entry->additional_references();          # *FIELD* SA
  29.     my $cs    = $omim_entry->clinical_symptoms_raw();          # *FIELD* CS
  30.     my $comm  = $omim_entry->comment();                        # from genemap
  31.    
  32.     my $mini_mim   = $omim_entry->miniMIM();                   # *FIELD* MN
  33.       # A Bio::Phenotype::OMIM::MiniMIMentry object.
  34.       # class Bio::Phenotype::OMIM::MiniMIMentry
  35.       # provides the following:
  36.       # - description()
  37.       # - created()
  38.       # - contributors()
  39.       # - edited()
  40.       #
  41.     # Prints the contents of the MINI MIM entry (most OMIM entries do
  42.     # not have MINI MIM entries, though).
  43.     #~ print $mini_mim->description()."\n";
  44.     #~ print $mini_mim->created()."\n";
  45.     #~ print $mini_mim->contributors()."\n";
  46.     #~ print $mini_mim->edited()."\n";
  47.    
  48.     my @corrs      = $omim_entry->each_Correlate();            # from genemap
  49.       # Array of Bio::Phenotype::Correlate objects.
  50.       # class Bio::Phenotype::Correlate
  51.       # provides the following:
  52.       # - name()
  53.       # - description() (not used)
  54.       # - species() (always mouse)
  55.       # - type() ("OMIM mouse correlate")
  56.       # - comment()
  57.    
  58.     my @refs       = $omim_entry->each_Reference();            # *FIELD* RF
  59.       # Array of Bio::Annotation::Reference objects.
  60.    
  61.    
  62.     my @avs        = $omim_entry->each_AllelicVariant();       # *FIELD* AV
  63.       # Array of Bio::Phenotype::OMIM::OMIMentryAllelicVariant objects.
  64.       # class Bio::Phenotype::OMIM::OMIMentryAllelicVariant
  65.       # provides the following:
  66.       # - number (e.g ".0001" )
  67.       # - title (e.g "ALCOHOL INTOLERANCE" )
  68.       # - symbol (e.g "ALDH2*2" )
  69.       # - description (e.g "The ALDH2*2-encoded protein has a change ..." )
  70.       # - aa_ori  (used if information in the form "LYS123ARG" is found)
  71.       # - aa_mut (used if information in the form "LYS123ARG" is found)
  72.       # - position (used if information in the form "LYS123ARG" is found)
  73.       # - additional_mutations (used for e.g. "1-BP DEL, 911T")
  74.    
  75.     my @cps        = $omim_entry->each_CytoPosition();         # from genemap
  76.       # Array of Bio::Map::CytoPosition objects.
  77.    
  78.     my @gss        = $omim_entry->each_gene_symbol();          # from genemap
  79.       # Array of strings.
  80.    
  81.     ### A handy string to store gene symbols
  82.     my $geneSymbols = join(",", @gss);
  83.    
  84.     ### My query (this is just an example, I actually need to perform more complex queries)
  85.    
  86.     if ($title =~ /^#/) {
  87.         print $fh $numb . "\t" . $title . "\t" . $geneSymbols . "\n";
  88.     }
  89. }
  90. close $fh;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement