staff project download information miscellaneous
Vect   Word Mapping
  Installing Perl
Mac
Windows
Unix


Download

Reference Manual
Introduction
Overview
Input Panel
Convert Panel
Output Panel
Perl Program Panel


Tutorials
Numerical Data Extraction
Statistical Data Extraction
Patent Calculation
PDB Data Extraction
GenBank Data Extraction
Tabular Data Analysis
Word Mapping
DNA to Protein Extraction

Change Log


FAQ

Cookbook
 
MangoPicky DownloadLucy2 DownloadTrend DownloadGRAMAUBViz DownloadgeneDBN Download

Part 3: Update the old data file

Insert a merge rule and you can use the default rule name. Replace first “????” with “new_name” rule and second “????” with “old_data”.

Now you need to create a simple perl subroutine to help. Insert a new rule called “ To write simple Perl code to convert data .”

Name the rule something like “update_name”. Click on the grey-highlighted word “user rule” and replace the code inside with the code below:


my %name_list = ();
sub { 
  my ($input1, $input2) = @_;

  return if !defined($input1);
  if (!defined($input2)){
     my $output = $input1;
     if ($output =~ /^>/) {
        my $old_name;
        my $new_name;
        my $tial = "";
        my $length_of_name = index ($output, " ");
        if ($length_of_name == -1) {
           $length_of_name = length($output) - 1;
           $old_name = substr($output, 1);
        }else {
            $tial = " ";
            $old_name = substr($output, 1, $length_of_name);
            chop($old_name);
        }
        
        if (exists $name_list{ $old_name }){
            $new_name = $name_list { $old_name };
        } else {
            $new_name = $old_name;
        }
        $new_name = $new_name.$tial;
         substr($output, 1, $length_of_name) = $new_name;
        return  $output;
     }

     return $output;
  }
  $name_list{ $input2 } = $input1;
   return;
}

It is a little bit long. If you don't know perl and want to know what it means, please refer to a Perl manual or tutorial to help you with it. It is only designed for the data formate showed in the example (FASTA). If you have other formate documents, you need to modify the code.

Set input1 to be MergeRule and input2 to be old_name. You should now have a updated file. Your end result should look like the following:

Now when the rule 6 is highlighted white as , you can click to move the output of this rule to panel.
At Output Data panel, click button to view the final output data. Click to save the data in a new file.

Then you are done. But don’t forget to save the rules you made for future reference.

Written by Ye Lin
Dec 2005

Last modified June 13, 2008 . All rights reserved.

Contact Webmaster

lab