how to convert the value from logarithm to normal?

Hi, I have a gene expression matrix that is taken from the logarithm of gene expression values.
Now I want to return the logarithm of values to the normal state, how to convert the value from logarithm to normal?
And what tool should I use?

Hi @maryam-gh99
it seems Datamesh does not have power transformation option but you can try awk. Assuming you have log2 values, calculate raw values with 2^$column_number_with_log_values and print columns you need.
Here is an example:
https://usegalaxy.org.au/u/igor/h/powertransformation
Log values are in column 2, and I printed the whole line plus additional column with raw/non-transformed values.
Hope that helps.
Kind regards,
Igor

1 Like

Hello, thank you for your help
But it seems that this tool only supports values related to one column
I have a matrix with 1306 columns and the logarithm is taken from all the values of these columns.
Can I use this tool to power the total values of these columns?

‫‪Igor Makunin via Galaxy Community Help‬‏ <‪notifications@galaxy.discoursemail.com‬‏> در تاریخ سه‌شنبه ۳ ژانویه ۲۰۲۳ ساعت ۴:۱۰ نوشت:‬

Hi @maryam-gh99
if you have only log transformed numbers in the table including the 1st column, try something like this for awk:
{
for (i=1; i<NF; i++) printf (2^$i)“\t”; printf (2^$NF); printf “\n”
}

NF is a variable for number of columns. The for loop returns “powered” value plus the tub character for every column except the last one, for which it prints only “powered” value. At the end of each raw it prints “new line”.
Hope it does make sense. There must be a better way to transform the data.
If your table has names or/and descriptions in first columns, change the starting value for i. Optionally, you can print columns with names or descriptions by adding something like
printf $1"\t";
before the ‘for’ loop.
I hope someone with experience in awk can simplify the script using OFS.
Kind regards,
Igor

Hello, thank you very much

I am familiar with R and Python programming languages, but unfortunately I am not familiar with awk programming language and I do not know how to change and apply this code that you sent me for my matrix.
Is it possible to guide me further?

‫‪Igor Makunin via Galaxy Community Help‬‏ <‪notifications@galaxy.discoursemail.com‬‏> در تاریخ پنجشنبه ۵ ژانویه ۲۰۲۳ ساعت ۱۳:۳۵ نوشت:‬

Hi @maryam-gh99
I added examples of multi-column power transformation using awk into the shared history.
Paste the script from the previous reply into AWK Program window. If the input table has only numeric values, submit the job. If the input table has names in the 1st column, change i=1 to i=2. You can add column with names later. Maybe try it on a small subset first and check the results.
Kind regards,
Igor

Hello, I apologize for disturbing you again
I followed all the tips you said and put any code into the AWK tool to power transformation matrix data and still got the red output from the tool.
I created a new history and loaded the log_values_table dataset that you shared in the history into it but still got red output with the codes you gave me.
It seems that there is no problem to run codes that do not need to read information from the dataset (the green item in history).
But by trying other codes that need to read the data set, we get a red output from the tool
Can you tell the problem of karma?

History link:https://usegalaxy.eu/u/gh.maaryaam1996/h/unnamed-history-3

‫‪Igor Makunin via Galaxy Community Help‬‏ <‪notifications@galaxy.discoursemail.com‬‏> در تاریخ پنجشنبه ۱۲ ژانویه ۲۰۲۳ ساعت ۵:۲۴ نوشت:‬

Hi @maryam-gh99
job #2: semicolon is missing after the command for handling the 1st column and the ‘for’ loop. You have:
{ printf $1"\t" for (i=2; i<NF; i++) printf (2^$i)“\t”; printf (2^$NF); printf “\n” }
Working version:
{ printf $1"\t"; for (i=2; i<NF; i++) printf (2^$i)“\t”; printf (2^$NF); printf “\n” }
You may split the script into blocks using formatting:
{
printf $1"\t";
for (i=2; i<NF; i++) printf (2^$i)“\t”; printf (2^$NF); printf “\n”
}

Jobs #4 and #5 have a different issue. Click at View error icon, the one looking like ladybird bug/beetle for job #4. You’ll see that the script with the errors differs from what you pasted into the awk box. To see the issue, zoom in your browser to, say, 400% and examine the scripts for jobs #2 and #4. The job #2 has Double Quotation characters (ASCII code 34), while job #4 has Left and Right double quotation marks (positions 146 and 147 in ASCII table according to Windows-1252 or similar version), and AWK struggles with some characters from this encoding. It seems the Double quotes character (ASCII 34) was replaced during cut and paste operation or on html page. Copy the script from my shared history. If you use a text editor program, make sure it saves files in plain text mode, not rtf (Rich Text Format).
Hope it does make sense.
Kind regards,
Igor

1 Like

Hi @maryam-gh99
sorry, I missed ‘before’ in the first sentence: should be after the 1st command and before the for loop.
Kind regards,
Igor

Thank you very much for your guidance
My data was corrected with your assistance, fortunately
You have helped me a lot🌱

‫‪Igor Makunin via Galaxy Community Help‬‏ <‪notifications@galaxy.discoursemail.com‬‏> در تاریخ سه‌شنبه ۱۷ ژانویه ۲۰۲۳ ساعت ۴:۳۰ نوشت:‬

Hi @maryam-gh99
I am glad to hear it works for you. You may consider downloading the data, doing the transformation in any electronic tables, such as Excel (keep eye on gene names, as Excel sometimes convert gene names into dates) and bringing the converted data back to Galaxy.
Kind regards,
Igor

Hello, I apologize for bothering you again with my questions
{
printf $1"\t"
for (i=2; i<NF; i++) printf (2.6766368+$i)“\t”; printf (2.6766368+$NF); printf “\n”
}
I want in this code besides summing all the values of the matrix with this specific value, I want to keep the first line, which contains the headers of each column, in the same form and not delete them.
In fact, I want the data summing operation to start from both the second column and the second line
Do you know what I should change in this code to get the desired result?

‫‪Igor Makunin via Galaxy Community Help‬‏ <‪notifications@galaxy.discoursemail.com‬‏> در تاریخ دوشنبه ۲۳ ژانویه ۲۰۲۳ ساعت ۱۰:۰۷ نوشت:‬

Hi @maryam-gh99
maybe try conditional expression if … else either for rows (NR variable) or a pattern (present in the header line only). The awk page in Galaxy has a link to an excellent tutorial(Long AWK tutorial). Alternatively, filter out the header line, transform the data and concatenate the header and new table. If you have multiple tables for transformation, create a Galaxy workflow. For a single table Excel might be a good option, just check gene names, because Excel can change some gene names.
Kind regards,
Igor