1

I have just started using org-mode and org-babel as a lab notebook. I am trying to use a code block to fill in two columns of a table. The code block seems to work for the first column because those are the right numbers. However, when trying to concatenate a string to the file name in column three so the code blocks works on a different set of files it seems to just run the code block on the original files instead, which produces the same output as column one.

#+name: tRNAs #+begin_src sh :var filename="" :results silent cd Data/tRNA grep -c ">" $filename #+end_src #+tblname: sequences | # of Sequences before QC | # after QC | Original File name| |--------------------------+------------+------------------| | 681865 | 681865 | read1 | | 324223 | 324223 | read2 | | 1014578 | 1014578 | read3 | | 971965 | 971965 | read4 | | 931777 | 931777 | read5 | | 810798 | 810798 | read6 | | 965134 | 965134 | read7 | | 718474 | 718474 | read8 | |--------------------------+------------+------------------| #+TBLFM: $1='(org-sbe tRNAs (filename (concat "\"" $3 "\""))) #+TBLFM: $2='(org-sbe tRNAs (filename (concat "\"final_" $3 "\""))) 
4
  • It would be good to post an example that is simple and self-contained so others can run it and provide better answers. Commented May 28, 2015 at 11:25
  • @mankoff Sorry about that. You can recreate the environment by having files named read1...read8 and final_read1....final_read8 with variable numbers of ">" characters. Commented May 28, 2015 at 17:28
  • @Darwin - What version of Emacs & org-mode are you using? Commented May 31, 2015 at 20:41
  • @Melioratus I am using Org-mode version 8.2.10 and Aquamacs 3.2a which uses GNU Emacs 24.4.51.2 Commented Jun 1, 2015 at 4:21

1 Answer 1

3

You can only have one #+TBLFM line per table. Separate formula with "::". Does it work if you have the following?

#+TBLFM: $1='(org-sbe tRNAs (filename (concat "\"" $3 "\"")))::$2='(org-sbe tRNAs (filename (concat "\"final_" $3 "\""))) 
3
  • The above doesn't work and #+TBLFM: $1='(org-sbe tRNAs (filename (concat "\"" $3 "\"")))::$2='(org-sbe tRNAs (filename (concat "\"final_" $3 "\""))) does not work either. It seems like you can have more than one #+TBLFM line per table you just have to ^C-^C each one. Commented May 28, 2015 at 17:44
  • @Darwin - just to clarify, you're saying it is possible to have more than one #+TBLFM: line but the user must move their cursor to each line then do C-c C-c? Does concat work on line 1 and not line 2? Commented Jun 14, 2015 at 22:25
  • @Melioratus - Yes, I can have more than one #+TBLFM: line, but you need to C-c C-c each one. The concat does work with the first one. I have created another column with the filename I tried to create with concat and just concat the " marks like the first formula. Now both work. Commented Jun 28, 2015 at 7:29

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.