X-Git-Url: https://git.donarmstrong.com/?p=function2gene.git;a=blobdiff_plain;f=bin%2Fparse_genecard_results;h=b42371957a229b4423cd8b89ac152eb2094f7134;hp=4b7d514d7df0b5352a4fb71aa50f0d8cfd55365e;hb=a4b9214b7939fbe990f2373684dfd7aa1f9e77e2;hpb=0486e6434cd182e8b30ba008d98ad3d3f008d2ab diff --git a/bin/parse_genecard_results b/bin/parse_genecard_results index 4b7d514..b423719 100755 --- a/bin/parse_genecard_results +++ b/bin/parse_genecard_results @@ -70,6 +70,9 @@ BEGIN{ use IO::File; use IO::Dir; +use HTML::TreeBuilder; +use HTML::ElementTable; + my %options = (debug => 0, help => 0, man => 0, @@ -139,29 +142,26 @@ while ($_ = $dir->read) { $results[REFSEQ] ||= 'NO REFSEQ'; # Find Gene Location - ($results[LOCATION]) = $result =~ m&LocusLink\s+cytogenetic\s+band:\s+ - \s*([^\<]+?)\s*&xis; + ($results[LOCATION]) = $result =~ m{cytogenetic\s+band:\s+ + ]*>\s*([^\<]+?)\s*}xis; $results[LOCATION] ||= 'NO LOCATION'; # Find gene aliases - my ($alias_table) = $result =~ m|Aliases and Descriptions(.+?)|is; - $alias_table ||=''; - - my @gene_aliases = $alias_table =~ m|
  • \s*([^\(]{0,20}?)\s*\(]+>]+>Aliases.+?)}is; + $alias_table ||= ''; + my @gene_aliases = map {s/\s*$//; $_;} $alias_table =~ m{\s*([^<]+)<}gis; $results[ALIAS] = join('; ', @gene_aliases); $results[ALIAS] ||= 'NO ALIASES'; # Find gene function(s) - # Swiss prot functions - my @functions = $result =~ m&
  • Function:\s+(.+?)(?:
  • )|(?:)&gis; - + my @functions; # GO Functions - push @functions, (map {s/\n//g} - map {s#\s*\s*(?:\s*)?\s*# #g; $_;} - $result =~ m{(GO:\d+\s*(?:\s*)?.+?)(?:
    |

    )}gis + push @functions, (map {s/\n//g; $_;} + map {s#\s*(?:\s*)?\s*# #g; $_;} + $result =~ m{(GO:\d+\s*(?:\s*)?.+?)(?:||

    |

    )}gis ); $results[FUNCTION] = join('; ', map {(defined $_)?($_):()} @functions); $results[FUNCTION] ||= 'NO FUNCTION'; @@ -171,8 +171,19 @@ while ($_ = $dir->read) { $results[KEYWORD] ||= 'NO KEYWORD'; + # Swiss prot functions + my @description = (map {s/<[^>]+>/ /g; + s/\s+/ /g; + $_; + } + $result =~ m{<(?:dd|li)>Function(?::|:)\s+ + (.+?)<(?:/dd|li)>}xgis + ); + # Figure out what the description is - $results[DESCRIPTION] = ''; + $results[DESCRIPTION] = join('; ', + map {(defined $_)?($_):()} + @description); # Database searched $results[DBNAME] = 'genecard';