Notes

Ticks are awesome !

Nearly 3 years spent studying their DNA and I begin to really like these little guys.

Mating during dinner

Have sex before a meal

“It’s springtime ! Hungry ? Waiting for food ? Play it like a tick, have sex before/during your blood meal !! ” Female and male of Castor bean tick (Ixodes ricinus, L 1758)

Hard ticks have to take a long blood meal before molting (metamorphosis from larvae to nymph, and from nymph to adult). Females need an extra (very long) blood meal – which last several days – in order to prepare the egg production. But sex (or more precisely mating) occurs before and/or during the blood meal (which is actually funny from my human point of view). After leaving the host, females will layed more than a thousand of eggs; which represents more than the mass of the tick before feeding.

For the rest of their life, ticks spend most of their time doing… well… I don’t know. Maybe waiting for an host, metabolizing blood, staying away from desiccation, finding the best spot to catch a bloody tetrapod ?

Host detection and cutting-edge technology

Hey there !

“Hey human, I’m looking for your blood ! Here… just here, right here !” Nymphal instar of tick, waiting for an host to feed on. Castor bean tick (Ixodes ricinus, L. 1758)

Not much is known about their abilities to detect the presence of the desired host. Some particular organs are present at the last segment of their frontal legs. They could help ticks to do the job. Described for the first time by G. Haller in 1881, this authors initially thought it was an organ of hearing due to the similarity with auditory organs of many crustacea. You should read the note writtten in 1907 by G.H.F. Nuttal, W.F. Cooper and L.E. Robinson, there is some nice planche describing the anatomy (doi:10.1017/S0031182000003486) and a recent advance in the understanding of this organ by Carr et al., 2017(doi:10.3390/ijms18071563).

Host seeking strategy

Wait and see...

“Wait and see…”. Adult ♀ of Castor bean tick (Ixodes ricinus, L. 1758)

Some tick species are running around, actively hunting, looking for a host to feed on, such as Amblyomma and Hyalomma species.

But I. ricinus is more like a “proactive waiter” species. By proactive, I mean that they have to climb on a platform like a grass stem… and then, wait ! One can question if their ability to choose the right place to wait is not the result of an active strategy ? For this reason, we say that I. ricinus is “questing” which have a definitely more active meaning that “waiting”. But compared to some Hyalomma species running around – literally hunting,  it is still a “wait and see” strategy.
Some others tick species seam even less proactive, living near or inside the nest of their host, feeding whenever they like – we say that they are nidicolous. Different tick species, different strategies. Ticks are awesome ! There is a nice review/opinion paper in Experimental and Applied Acarology by Igor Uspensky in 2002.
doi: 10.1023/A:1025303811856

Hope you enjoyed my enthusiasm about ticks. They can definitely transmit pathogens but can also be seen as a beautiful form of life !

These article is a combination of three Instagram posts:

View this post on Instagram

"Wait and see" Adult ♀ of Castor bean tick (Ixodes ricinus, L. 1758). Some tick species are running around, actively hunting, looking for a host to feed on, such as Amblyomma or Hyalomma species. I. ricinus is more like a "proactive waiter" species. By proactive, I mean that they have to climb on a plateform like a grass stem and then wait. One can question if their ability to choose the right place to wait is not an active strategy but compared to some Hyalomma species, it is still a "wait and see" strategy. Some others tick species seam even less proactive, living near or inside the nest of their host, feeding whenever they like. Differents tick species, differents strategies. Ticks are awesome ! There is a nice review/opinion paper in Experimental and Applied Acarology by Igor Uspensky in 2002. doi: 10.1023/A:1025303811856 . . . . . #tickseason #ticksareawsome #macro_captures #blood #waitandsee #strategy #macrophotography #proactive #ticksaway #bloody #macro #ticks #macro_holic #hunting #ambush #phdlife #phd #phdstudent #research #phdjourney #ecology #scicomm

A post shared by Noemi Pierre Charrier (@npcharrier) on

View this post on Instagram

"Hey human, I'm looking for your blood ! Here… just here, right here !" Nymphal instar of tick, waiting for an host to feed on. Castor bean tick (Ixodes ricinus, L. 1758) Not much is known about their abilities to detect the presence of the desired host. Some organs are present at the last segment of their frontal legs. They could help to do the job. Described for the first time by G. Haller in 1881, this authors initially thought it was an organ of hearing due to the similarity with auditory organs of many crustacea. You should read the note writtten in 1907 by G.H.F. Nuttal, W.F. Cooper and L.E. Robinson, there is some nice planche describing the anatomy. doi:10.1017/S0031182000003486 . . . . . #tickseason #ticksareawsome #anatomy #hallersorgan #macro_captures #blood #macrophotography #ticksaway #bloody #macro #ticks #macro_holic #phdlife #phd #phdstudent #research #phdjourney #scicomm

A post shared by Noemi Pierre Charrier (@npcharrier) on

Bash One-Liner

Bash One-Liner

Here some quick remember (for me and maybe for you) of some bash one-liner syntax. In fact, I use daily some “for loop” one-liners but I regularly forget how to include an “if statement”.

Bash One-Liner : syntax

For loop one-liner is the idea to use a for loop in a one line context.
In a script or program you will write it on multiple lines as follow :

for i in {1..10}
do
    echo ${i}
done

Pretty annoying for simple action… There we are, for loop (among others) can be written as a one-liner command.

for i in {1..10} ; do echo ${i} ; done

Here some exemple

me@laptop:~$ for i in {1..100} ; do touch File-${i} ; done
me@laptop:~$ for i in $( ls File-* | head -n 50 ) ; do echo "Not empty anymore" >> $i ; done

And What if I want to test some conditions and do something if my statement is true ?

me@laptop:~$ for i in File-* ; do if [ -s ${i} ] ; then echo "is empty !" > ${i}.emptyFlag ; else echo $i "is not empty" ; fi ; done
me@laptop:~$ for i in File-* ; do if [ -e ${i}.emptyFlag ] ; then rm $i ${i}.emptyFlag ; else :  ; fi ; done

Bash One-Liner : example

Here some examples in a more detail and in a reproductive manner. Let’s start a scratch directory :

me@laptop:~$ mkdir sandbox-OneLiner
me@laptop:~$ cd sandbox-OneLiner
me@laptop:~/sandbox-OneLiner$ pwd
/home/me/sandbox-OneLiner

Let’s create a bunch of test file:

me@laptop:~/sandbox-OneLiner$ for i in {1..100} ; do touch File-${i} ; done

Let’s check a bit what we create it :

me@laptop:~/sandbox-OneLiner$ ls File-* | head -n 2
EmptyFile-1
EmptyFile-10

If you want to sort you result numerically, you can pass the list to sort and ask him to use the second column of the string (-k 2). String will be cut using the ‘-‘ character (-t -).

me@laptop:~/sandbox-OneLiner$ ls File-* | sort -t - -k 2 -g | head -n 2
EmptyFile-1
EmptyFile-2

Let’s check how many file do we have :

me@laptop:~/sandbox-OneLiner$ ls File-* | wc -l
100

Now, we will add some content at half of the files. And in a same time put a flag on the empty one (just by creating a new file with an explicit extension). Then we will remove every files who posses the flag.

me@laptop:~/sandbox-OneLiner$ for i in $( ls File-* | head -n 50 ) ; do echo "Not empty anymore" >> $i ; done
me@laptop:~/sandbox-OneLiner$ for i in File-* ; do if [ -s ${i} ] ; then echo "is empty !" > ${i}.emptyFlag ; else echo $i "is not empty" ; fi ; done
me@laptop:~/sandbox-OneLiner$ for i in File-* ; do if [ -e ${i}.emptyFlag ] ; then rm $i ${i}.emptyFlag ; else :  ; fi ; done
me@laptop:~/sandbox-OneLiner$ ls File-* | wc -l
50

Ok there is a quick way to do it (and many more to just remove empty files) :

# starting by removing all the files :
me@laptop:~/sandbox-OneLiner$ rm File-*
me@laptop:~/sandbox-OneLiner$ for i in {1..100} ; do if [[ $i < 51 ]] ; then touch File-${i} ; else echo "Not empty" > File-${i} ; fi ; done
me@laptop:~/sandbox-OneLiner$ for i in File-* ; do if [ -s ${i} ] ; then rm $i ; else : ; fi ; done

For the specific task of deleting empty file there is the find command

me@laptop:~/sandbox-OneLiner$ rm File-*
me@laptop:~/sandbox-OneLiner$ for i in {1..100} ; do if [[ $i < 51 ]] ; then touch File-${i} ; 
me@laptop:~/sandbox-OneLiner$ find . -size 0 -delete

Some useful link :
http://www.bashoneliners.com/

Inkscape – Modifying PDF files

If you asked “How to modify pdf files or How to edit pdf files ??”, especially for R figures, your are in the right place !

Inkscape is an open-source software under General Public License used to edit or create vectors graphics. I use it when I have to modify legends or axis of my figures (exported in pdf from R).

Inkscape let you modify, magnify, change color, add text, point, lines, shaded-box and so on. Once open, there is plenty of menu and mode. Internet is fill of tutorials and guides to take the full potential of this tool. I submit to you some explanation about basics to achieve your goal quickly (modifying/magnifying axis labels, legends, … ).

 

Generating the figure

Let’s begin by generating a figure correctly formated :

pdf("Raw-Figure.pdf")
plot(density(rnorm(1000 ,0, 1)))
dev.off()

As you might know, PDF format keeps track of vectorial composition of your work. It could be easily edited using Inkscape.

Modifying the figure

Object and path mode

Once open, (by drag and drop or from the “File->Open” ), you should be able to directly edit the different objects. By default, you should be in the “object selector mode” (an arrow at the top of the left menu).
For example, if we want to modify the frame around the R graph, we will select the frame object. From this point, and depending the number of click we did, we are on the object selector mode or the path mode :

Frame selected on the “Object mode”
Frame selected on the “Path mode”

Changing the frame style

The frame object is possessing some “Fill and Stroke” properties, which can be modified from the top menu “Object->Fill and Stroke“. Here I modified the frame to have a dashed stroke of 3px width.

Using “Fill and Strokes” to change the frame aspect (3px Dashed line)

Similarly, I edit the property of the Fill to obtain a grey-shaded (RGBa : 0:0:0:10). Be aware that this object have position dependent of others objects. The frame could be put in background from the top menu : “Object->Lower to Bottom” or by using the “end” short-key.

Using “Fill and Strokes” to change the frame aspect (Grey shaded box)

Changing the size of the frame

We can change the size of the frame to include axis labels and the top title. Two option are possible :

i) using the “Object mode”, by dragging the corner or by using the top menu “Object->Transform, sub-menu:Scale“. When increasing the frame, width stoke property increased (3px-> 3.7px).

Resized frame using “Object mode”
Resized frame using “Path mode”

ii) using the” Path mode” by selecting the frame in Path mode. By selecting side nodes or top nodes and moving them with keyboard’s arrows. This way doesn’t modify the stroke width, which could be important.

Depending on your goals (increased one or multiple elements), it will be more relevant to use a mode than an other.

Modifying text objects

Texts can be edited easily by clicking on it. You should be able to change the font, size, form, … For the example, we will first modify the title, and change the font of all the text objects.

Select the title and be sure to be on the right mode (F8 or double click from the “object mode”) and type a new name for your beautiful graph :

Title renamed

Then to modify globally the font (i.e. for different text object at once), I select manually every text object I want (shift key) and change the font from the corresponding Top menu (“Text->Text and Font”). If you know a better trick, let me know 😉

Font globally changed for different text objects

Resize the page to the content

At the end, a tricks to think is to resize the page to contents using the right option inside the Top menu : “File->Document Properties”.

Finally you can export your object as bitmap (in ‘.png’ for exemple), as vectorial object (pdf, svg, …) or whatever format supported by Inkscape in the top Menu “File-> Save” as or “File->Export“.

I hope it helps you a bit. If you find it useful or if you have others recipes and tricks, let me know 😉

Thanks to Julie Toury, she helped me to correct mistakes and to clarify some points.

Simple SSH config file and rsa keys to manage multiple remote server connections

SSH config file and RSA keys

I’m a biologist… and computer should remain simple because most of my time is spent behind a keybord, over network, working with several remote server. At the beginning, it was quite confusing to remember every couple of login@IpAdress as well as spicy passwords. But Open-Source community helped me to gain efficiency, providing me good advices and saving a lot of my time.
This post is about ssh configuration between your laptop and a remote server (both running under GNU/linux distros).

SSH config file

Since I discovered the ~/.ssh/config file, my work became easier : it works exactly like an alias.
You can type ssh Alias to connect directly on the right remote server (remote-serverA). Amazing, isn’t it ?

me@laptop:~$ nano .ssh/config
Host Alias
    HostName remote-serverA
    User login
    Port 22
    ForwardX11 yes

Instead of typing “ssh login@remote-serverA -p 22“, you just have to type “ssh Alias“, followed by your password.

RSA keys

The second very useful things is a complementary trick, the rsa key. Briefly, it consist of a private key (stored on your laptop for the example) and a public key (stored on a remote server). When initiating the ssh connection, the remote server will send a random message to your laptop, waiting the same message returned encrypted by your private key. If the return-message while decrypted by the public key, corresponds to the initial random message, the ssh connection is allowed (without any password !!!) Nice, right ?
So you need to generate a private and a public keys for identifying the two machines.
On your laptop and give them to each machine (I’m using Debian jessie) just type :

me@laptop:~$ cd ~/.ssh/
me@laptop:~/.ssh$ ssh-keygen -t rsa -b 4096 -f remote-serverA

You will be asked for passphrase, you can let it empty. If not, you will have to type you passphrase during each connection (instead of your password… which is initialy what we want avoid).
In you ~/.ssh/ directory, you should see

me@laptop:~/.ssh$ ls
config remote-serverA remote-serverA.pub

You should copy the content on the remote server in a file named ~/.ssh/authorized_keys. There is two possibility,

do it manually :

First print using cat to conserve the one-line structure. More will split the string, adding newline character (“\n”) to fit the size of your screen.

me@laptop:~/.ssh$ cat remote-serverA.pub

It should look

AAZcjdE45jhf[long character string]SHFJJ45djkSFF== login@laptop

Copy it in your clipboard or whereever you want and open an ssh connection to the remote-serverA :

me@laptop:~/.ssh$ ssh login@remote-serverA -p 22 [enter your password] Welcome on Server A 🙂 
login@remote-serverA:~$ 

Edit the “authorized_keys” file :

login@remote-serverA:~$ nano ~/.ssh/authorized_keys

Careful : the content of your key should remain on one line !!!

the lazy way:

All this step can be done in a one-ligner syntax by adding the content of the public key directly on the “authorized_keys” file using the pipe symbol (“|”), all of this encapsulated by an ssh connection.

me@laptop:~$ cat ~/.ssh/remote-serverA.pub | ssh login@remote-serverA "cat - >> .ssh/authorized_keys"

It should work !

Just try it, and feel you free to ask, comment or correct me :

me@laptop:~$ ssh Alias
Welcome on Server A !
login@remote-serverA:~$

Ressources :

https://www.digitalocean.com/community/tutorials/how-to-configure-ssh-key-based-authentication-on-a-linux-server
https://www.cyberciti.biz/faq/linux-generating-rsa-keys/