]> git.donarmstrong.com Git - function2gene.git/blobdiff - bin/parse_genecard_results
Add results to table; modify the search parssers to work better. Fix error in get_ncb...
[function2gene.git] / bin / parse_genecard_results
index 6024d9bd27e0f9d74618070735532cb6dd051da1..4b7d514d7df0b5352a4fb71aa50f0d8cfd55365e 100755 (executable)
@@ -104,7 +104,7 @@ if ($options{keywords}) {
      if (@ARGV != 1) {
          pod2usage("If the --keywords option is used, exactly one argument (the keyword) must be passed");
      }
-     $option{dir} = "$ARGV[0]_results_genecard";
+     $options{dir} = "$ARGV[0]_results_genecard";
 }
 
 if (not -d $options{dir}) {
@@ -128,15 +128,13 @@ while ($_ = $dir->read) {
      my @results;
 
      # Find gene name
-     ($results[NAME]) = $result =~ m&(?:Lean|Gene)Card\s+for\s+(?:(?:disorder\s+locus|uncategorized|
-                                    hugo\s*reserved\s*symbol|cluster|
-                                    potentially\s*expressed\s*sequence)|(?:predicted\s+|pseudo|rna\s+|)gene)
-                                    \s*(?:with\s*support\s*|)<FONT\s+COLOR=\"[^\"]+\">\s*<FONT\s+SIZE=\+2>\s*([^\s]+)\s*&xis;
+     ($results[NAME]) = $result =~ m{(?:Lean|Gene)Card\s+for\s+[^<]+<FONT[^>]+>\s*([^<]+)}xis;
 
      $results[NAME] ||= 'NO NAME';
      # Find REF SEQ number
-     ($results[REFSEQ]) = $result =~ m|http://www.ncbi.nlm.nih.gov/entrez/query.fcgi\?
-                              cmd=Search\&db=nucleotide\&doptcmdl=GenBank\&term=([^\"]+)\"|xis;
+     ($results[REFSEQ]) = $result =~ m{http://www.ncbi.nlm.nih.gov/entrez/query.fcgi\?
+                                      (?:cmd=Search\&db=nucleotide|db=nucleotide\&cmd=search)
+                                      \&doptcmdl=GenBank\&term=([^\"]+)\"}xis;
 
      $results[REFSEQ] ||= 'NO REFSEQ';
 
@@ -161,7 +159,10 @@ while ($_ = $dir->read) {
      my @functions = $result =~ m&<li><b>Function:</b>\s+(.+?)(?:<li>)|(?:</ul>)&gis;
 
      # GO Functions
-     push @functions, (map {s#\s*</a>\s*# #g; $_;} $result =~ m&(GO:\d+\s*</a>.+?)(?:<dd>|<p>)&gis);
+     push @functions, (map {s/\n//g}
+                      map {s#\s*\s*</a>(?:</td><td>\s*)?\s*# #g; $_;}
+                      $result =~ m{(GO:\d+\s*</a>(?:</td><td>\s*)?.+?)(?:</td><dd>|<p>)}gis
+                     );
      $results[FUNCTION] = join('; ', map {(defined $_)?($_):()} @functions);
      $results[FUNCTION] ||= 'NO FUNCTION';