### Archive

Archive for the ‘emacs’ Category

## Software update

Picards tools

The classical one 😉  Note that some changes were done for java 7 compatibility. So, after GATK, turning to java 7 as default may be on its way.

Beagle 4

Another update (r1128), not documented so far.

Minimac

The new version now use all variants in the reference panel (snp, indels, SV)

Open MP

The openmp specification 4.0 are out ! Now support Fortran2003 and prepare the support for accelerator. Note the next intel compiler version already support a large number of the new specifications.

Magma

This library now in its version 1.4 . Support for new GPUs were added as well as additional subroutines. I wish more Fortran interface were added…maybe next time !

Cuda 5.5

As previously mentioned, the last version of cuda is now available as rpm/deb package (allowing a much easier install).

Categories: emacs, Linux, NGS

## Software update

So what are the last noticeable update of this latest months ?

GATK 2.6-5

At last HaplotypeCaller is now a real alternative for Big project ! <grumpy> The bad thing <\grumpy> is that now GATK need java7, which is still not so common nowadays and (thanks to oracle) no that easy to install !

I am actually running it on a batch of 100 bulls  @12&+X(so far so good, I will complete a whole genome variant calling in 2 weeks).

Beagle 4
Now allowing imputation ! And this just make everything so simple !

eigenstrat

This tool has been released in its 5.0 version.

TexLive2013

This is the yearly release. Not a lot of new things but it’s always worthy to upgrade.

Categories: emacs, Linux, NGS

## Software update

Another month, another software update

samtools 0.1.19

I missed it in the last posts (this version was released in March). Multi-thread is now available. I play a bit with the the different displays (Html, Curse and Text) of tview, (pretty handy). I may need more time to get acustomed to bamcheck/plot-bamcheck output.

Delly 0.0.11

Some small fixes, a new progress bar to control process, better temporary file handling, and BWA-mem support…more here

BWA 0.7.5a

Several small fixes

Picard tools 1.93

Small bug fixes. Released some hours ago (I had to compensate samtools glitch)

llvm 3.3

Still some efficiency enhancement, clang is now totally C++11 complient. New Arch support…and more. Release announcement is still pending, but binary are already available.

GCTA

Apparently computing speed improvement are the newsworthy point of this release.

Coming soon…

I’ve had access to both next cuda 5.5 RC and Intel compiler….and so far the good new is that both now offer a simplified install procedure. Cuda 5.5 is available as a deb file, Intel compiler as a script with a GUI. I am eager to test these RC.

Categories: emacs, Linux, NGS

## eMarch 5 : Tramp

We are all living in a modern world, the cloud is everywhere and of course also in emacs. So the closing post of this serie will talk about tramp. Tramp is so rich of features that a post won’t be enough. I’ll focus on the point I’ve used so far.

## Basic use

I generally use a lot of ssh connection. Tramp allows me to naviguate through the remote directory as if they were on my local machine. The basic commands C-x D and C-x f just need a special syntax to describe the path to the file directory you want to access to.

With ssh, the syntax is similar to the scp one. Hence to access the file test.txt in your home directory “~” on remote host “rem1” , just do

```C-x C-f
/ssh:rem1:~/test.txt```

To access the directory “/work/you/project” on remote1 “remote1.com”, ip “127.0.0.1”

```C-x d
/ssh:remote1.com:/work/you/project
/ssh:127.0.0.1:/work/you/project```

Last, while visiting a remote directory, if you start a shell buffer with “M-x shell”, the later will be started on the remote host. If a shell buffer is already open on your localhost, M-x shell will redirect you to this buffer. The trick here is to use  C-u M-x shell to start a second buffer shell.

## Some other hints

Of course the neat way to access remote host is to create a ssh config file. Anyway if your login on the remote host is different from the one you generally use, or if you are using a tunnel with a different port, you ‘ll have to modify your path.

Taking the former example, assuming now that your login is “Name” you want to connect on localhost port 9022 (We are considering an access via an ssh tunnel).

```C-x d
/ssh:Name@remote1.com#9022:/work/you/project```

Other useful tips and alternative can be found on the emacs wiki tramp page, like :

• setting a default tramp user with (setq tramp-default-user “ClassicalLogin”)
• setting a default tramp protocol (setq tramp-default-method “ssh”)
Categories: emacs, Linux, Shell

## eMarch 4: Compilation environment variable

I sometime use improved library like mkl, in my code, the later need to have their path added to the LD_LIBRARY_PATH, in order to be accessed during compilation. Eventually, this may prevent the very handful M-x compile command to work with emacs. The fix I found on stackoverflow

```(let ((path (shell-command-to-string ". ~/.bashrc; echo -n \$PATH")))
(setenv "PATH" path)
(setq exec-path
(append
(split-string-and-unquote path ":")
exec-path)))
(let ((ld_library_path (shell-command-to-string ". ~/.bashrc; echo -n \$LD_LIBRARY_PATH")))
(setenv "LD_LIBRARY_PATH" ld_library_path)
(setq exec-path
(append
(split-string-and-unquote ld_library_path ":")
exec-path)))
```
Categories: emacs, Fortran, Linux

## eMarch 3 : Time-stamps

Keeping a track of changes in your source code is always a good idea. I generally use two ways to know when I’ve done my last change of a file.

## Time-stamps

This function is generally useful for small scripts or projects. First you have to insert the following lines in your .emacs

``` (setq
time-stamp-active t          ; Set  time-stamp
time-stamp-line-limit 20     ; Indicate within how many lines a time-stamp should be seek (here the 20th first lines)
time-stamp-format "%04y-%02m-%02d %02H:%02M:%02S (%u)") ; Format date

Second, just add within the first line of your file (20 in the latter code); the keyword:

`Time-stamp: <>`

Any time you ‘ll save your file, the Time-stamp will be updated. A nice feature here is that emacs is looking for a pattern, so we can play a bit with is. As instance, if you want to keep a track in a log file of which version of a script was used, just add :

```T="Time-stamp: <>"
echo "Running "\$0 "Version "\$T
```

Likewise, you can add some similar kind of code to your FORTRAN, C etc…  source code to know which version of the source was used to create your executable as already mentioned in a later post.

## SVN ID version

The last comment lead us directly to the second time-stamping option. When I first start using svn I had trouble with the Time-stamp tags in my files since any small change in a file under svn generate at least two lines of changes (the actual change and the Time-stamp change). In this case the correct way to proceed is to use the
VC-dir tool.

Either, with C-x v h, or Tools, Version Control,  Insert Header, or click-1 on major mode keyword in baseline  and then Insert Header.

This will add the tag \$Id\$ preceded by an appropriate comment sign. Every time you commit your source the tag will be updated (and won’t be considered as an actual changes in the code).

Categories: emacs, Linux

## eMarch 2 : create a pdf with highlighted code source

A very nice feature of emacs is syntax highlighting for a wide variety of language. Back in the old time, I used to print my a lot of my source code in order to analyse it in details, as the AIX server I was working on had no access to any color-printer, I had to print my buffer to a postscript file first, (convert it to pdf) and last transfer it to my main computer. But one, day I found a nice small piece of lisp which allow me simplify the process.

Thus I just added this in my  .emacs file

```(defun print-to-pdf ()
(interactive)
(ps-spool-buffer-with-faces)
(switch-to-buffer "*PostScript*")
(write-file "tmp.ps")
(kill-buffer "tmp.ps")
(setq cmd (concat "ps2pdf14 tmp.ps " (buffer-name) ".pdf"))
(shell-command cmd)
(shell-command "rm tmp.ps")
(message (concat "File printed in : "(buffer-name) ".pdf"))
)```

Then, from any buffer, typing M-x print-to-pdf,  create nice and colorful pdf of my source code.

This script used to be a neat way to keep a pretty printed version of my work, fortunately printing to pdf became much easier with later version emacs, making the previous code a bit useless. But here comes the way I recycled this script. As I very often have to document my script and source code (who doesn’t ???), I took the habit to add as an appendix to my manuals the source code of the main scripts or software used. To do so, I produce a syntax highlighted pdf that I include via the \includepdf{} $\LaTeX$ command. Still, an annoying point is that scripts are updated rather often, so we have to think about an easy way to recreate the pdf.

In my .emacs, I thus modify my previous function into :

```(defun print-to-pdf-batch ()
(interactive)
(ps-spool-buffer-with-faces)
(switch-to-buffer "*PostScript*")
(write-file "tmp.ps")
(kill-buffer "tmp.ps")
(setq cmd (concat "ps2pdf14 tmp.ps " (buffer-name) ".pdf"))
(shell-command cmd)
(shell-command "rm tmp.ps")
(kill-emacs t)
)```

The changes are that we now avoid message output and ask to kill emacs at the end of the execution. For a series of sources code , you just have to run e.g.

```for File in *.sh ; do emacs \$File --eval "(print-to-pdf-batch)" ; done
```

This trick works, I imagine a better version would be to use the “-batch” argument of emacs, and eventually a lisp file (thus you should not change your .emacs). Unfortunately, I could not achieve to obtain color in the output (probably due to X issues ? any hints/solutions wold be appreciated). If you have no X server the -nw options also works but the colors used are to my opinion not so nice.

Categories: emacs