Thursday, May 10, 2018

Downloading sequences from NCBI:

This downloads the GenBank file and puts it into a file called CP011547.gbk (Just change the accession number in the first line to download any other sequence):
curl -s  "${i}&rettype=gb&retmode=txt">$i.gbk

The sequence as nucleotide fasta:
curl -s  "${i}&rettype=fasta&retmode=txt">$i.fna

The CDS as protein fasta:
curl -s  "${i}&rettype=fasta_cds_aa&retmode=txt">$i.cds.faa

The CDS as nucleotide fasta:
curl -s  "${i}&rettype=fasta_cds_na&retmode=txt">$i.cds.fna

Friday, February 16, 2018

Brief Bioinformatics Bash

Multi FASTA to one Sequence per FASTA

Write each Sequence of a multisequence FASTA to a separate FASTA file.
while read line
    if [[ ${line:0:1} == '>' ]]
        echo $line > $outfile
        echo $line >> $outfile
done < $1

 Don't forget to chmod +x

 ./ input.fasta

Brief Bioinformatics Bash

FASTA to single line FASTA

Write the wrapped sequences of a FASTA file to a single line; example:


awk '/^>/ {printf("\n%s\n",$0);next; } { printf("%s",$0);}  END {printf("\n");}' < $1 | grep -v '^$'

 Don't forget to chmod +x

 ./ input.fasta > output.fasta

Saturday, February 4, 2017

Sun Locator - Privacy Policy

Sun Locator - Privacy Policy

The Sun Locator app requests so called "sensitive device information". Specifically, this is the device position (GPS) and camera access.

Device Position (GPS)

GPS data is requested when you click on "Location from GPS" to use your current location.

Camera access

Camera access is needed to use the Camera View (aka Augmented Reality view)

Other data (e.g user data)

No other data is used by the app.

Data collection/Data storage

Absolute none! No data from your device is sent to any servers, no analytics is performed. The data stays on your device, all the calculations are done directly on your device.
However be aware, that the "Location form Map" Option and the "Map View"-Feature uses Google Maps. More information about the Google's privacy policy can be found here:

If you have any questions, send me an email contac┼ž

Friday, October 28, 2016

Sun Locator -
Predict the Sun and Moon Position anywhere and anytime
Image result for google play

Sun Locator is an Android App to predict the sun and moon position during the course of a day and a year.
Anticipate lighting conditions in photography/filming, real estate, architecture, outdoor activities (e.g. setting up camp), solar panel positioning, gardening, and more.

The Camera view (Augmented Reality) displays the solar position and lunar position directly overlaid on your device's camera. Use the slider to set the time of day or day of year and directly track the solar movement.

The Map view displays the solar and lunar location, direction and shadow on a map to help you plan your activities.

The Main view includes all important information such as sunrise and sunset, twilight, "magic" photography times (blue hour/golden hour), moonrise and moonset, lunar phase etc.

Use it for:

  • Photography: when and where will the sun rise and set? When are the Blue hour and the golden hour? When and where will the moon shine tonight?
  • Gardening: do your plants get enough direct sunlight during the course of the day and year?
  • Real estate: does a neighboring building obstruct the sun and cause shade?
  • Architecture: How much sunshine will your home get? Does the sun shine through your window?
  • Camping: will the sun shine on your tent?
  • Hiking: when does dawn start and dusk end?
  • Solar panels: Will there be nearby obstructions?

Sun Locator is available at Google Play.
Image result for google play

The Lite version is free and limited to information for the current day.
The Pro version displays information for any day of the year.

Main View

Sunrise, Sunset, Moon rise, Moon set:
The time of day when the sun or moon crosses the Earth's horizon.

Sun transit:
Sometimes referred to as solar noon, is the time of the day when the sun passes over the observer's meridian line, this is roughly when the sun is at its highest.
Twilight times:
Twilight is the remaining illumination when the sun is below the horizon. The sunlight scatters in the atmosphere and illuminates the Earth. There are three definitions of twilight:
  • Civil twilight: Approximately the limit at which solar illumination is sufficient, under clear weather conditions, for terrestrial objects to be clearly distinguished by eye. There is enough light from the sun during this period that artificial sources of light are not needed to carry on most outdoor activities.
  • Nautical twilight: The horizon is clearly visible, but artificial lighting is necessary to see terrestrial objects.
  • Astronomical twilight: Outside of the astronomical twilight, the sky (away from light pollution, moonlight, auroras, and other sources of light in the sky) is dark enough for nearly all astronomical observations.

Shadow ratio:
The length of the shadow cast by an object of the height of 1 foot or meter.
E.g. at a shadow ratio of 1:0.45 an object of 5 meter height will cast a shadow of 5 × 0.45 = 2.25 meter
Photography: Blue and golden hour:
The Blue hour is the period of twilight when the sun is below the horizon and the indirect sunlight takes on a predominantly blue hue and cold color temperature.
The Golden hour is the short period of time just after sunset when the light is redder, having a warm color temperature. Lighting is diffuse and with little contrast, so no strong shadows exist.
Current sun and moon position: Azimuth:
The horizontal angle clockwise from North. I.e. North is zero degrees (0°), East 90°, South 180° and West 270°. The Magnetic declination is automatically taken into account using the specified location.
Current sun and moon position: Elevation:
Sometimes referred to as altitude, is the angle between the devices horizon and the sun. The horizon is at 0° and the zenith at 90°
Moon phase:
The percentage of the lit surface of the moon. 0% corresponds to a new moon, 100% to a full moon. The moon is either waxing (the lit surface is increasing) or waning (decreasing).
Time zone:
All times are displayed in your current time zone (as set by your device). So if you select a locationof another time zone (e.g. you're in Europe and want to know the sun rise somewhere in the USA), the displayed times correspond to your device's clock.

The button "Show Camera view" and "Show map view" opens the Augmented Reality View and Map view, respectively.

Camera View

[A] Date/Time: Use the bottom slider to quickly change the date and time.
[B] Switch Sun/Moon: Switch from displaying the Sun position and path to displaying the Moon.
[C] Slider range: Using the slider will either set the time of day or day in year.
[D] Slider: set the date and time by going back and forth.
[E] Sun/Moon path throughout the day. 
[F] Current position of the Sun/Moon

Map View

[A] Switch Sun/Moon: Switch from displaying the Sun position and path to displaying the Moon.
[B] Map type: choose between different map types (normal, satellite, terrain) to be displayed
[C] Date/Time: Use the bottom slider to quickly change the date and time.
[D] Slider range: Using the slider will either set the time of day or day in year
[E] Slider: set the date and time by going back and forth.
[F] Current sun/moon position
[G] Sun/moon path throughout the day
[H] Shadow cast by the 3D sundial


Tuesday, December 1, 2015

Install a VNC Server on Ubuntu (x11vnc as alternative to tightVNC)

The goal of a VNC server is to remotely access the screen of another machine. In my case remotely is a room further down the hall on the same intranet, so at this stage I'm not worried about using encryption.

After having some trouble using the very popular tightvnc as a the tool of choice (I was getting errors running software which are based on the Qt framework; a similar bug has been reported here).
Because I'm quite dependent on this particular piece of software, I had to find a workaround. I chose to use x11vnc.

Because x11vnc relies on an actual X display, we need to make a virtual X display first. For this I use Xvfb. Both x11vnc and Xvfb are available in the Ubuntu repositories.
Additionally, I wanted to use the old Gnome-Fallback (a.k.a Gnome Classic) display, because I'm not a big fan of the current display and the 3D-effects make things go slower on a VNC connection. This can be installed using sudo apt-get install gnome-session-fallback. This is of course not a requirement to use x11vnc and Xvfb.

First generate a password for x11vnc:
x11vnc -storepasswd and store it to /home/yourusername/.vnc/passwd. The password is only a minimal security measure, the connection still won't be encrypted.

You need to first start the Xvfb display this way:
/usr/bin/xinit /usr/bin/gnome-session --session=gnome-fallback --disable-acceleration-check -- /usr/bin/Xvfb :20 -screen 0 1680x1050x24
This will open an Xvfb display on X display number 20 with the given resolution (1680x1050) and color depth (24bit). If you don't want to use the classic gnome desktop remove the --session=gnome-fallback argument.

Next start x11vnc:
/usr/bin/x11vnc -display :20 -loop -rfbport 5901 -rfbauth /home/yourusername/.vnc/passwd -o /var/log/x11vnc.log
This will forward X display number 20 (where the Xvfb display is) to port 5901. Make sure that argument -rfbauth points to your password you created in the first step.

You can now connect to your machine on port 5901 using a VNC client such as RealVNC. Make sure that your firewall allows access to port 5901. You can of course also change the port using the -rfbport argument in x11vnc.

If everything works we can use a service to start these two programs automatically at every upstart.
As sudo create a text file at /etc/init/x11vnc.conf. Include following commands (make sure to replace yourusername with your actual username):
start on login-session-start
echo Start x11vnc at `date` >> /var/log/x11vnc.log
su - yourusername -c "/usr/bin/xinit /usr/bin/gnome-session --session=gnome-fallback --disable-acceleration-check -- /usr/bin/Xvfb :20 -screen 0 1680x1050x24" &
su - yourusername -c "/usr/bin/x11vnc -display :20 -forever -loop -rfbport 5901 -rfbauth /home/yourusername/.vnc/passwd -o /var/log/x11vnc.log" >> /var/log/x11vnc.log
end script

This script will be run on every startup or by using sudo service x11vnc start.

Run I-Tasser in parallel mode using SGE

I-TASSER ( is a popular protein structure prediction software that can also be installed locally as a stand alone program.

In order to make use of the parallelization capabilities of I-TASSER you first must install a batch-queuing system, for which I chose SGE (Sun Grid Engine). I followed these instructions to set it up on my Ubuntu multi core server:
The setup is comparatively straight-forward (or at least similar confusing as other systems such as Torque or SLURM) and the necessary binaries are available through Ubuntu's repositories.

After successful setup of SGE and some tests, I was ready to setup I-TASSER to use SGE. It's advisable to run I-TASSER in the serial mode first, to check that everything is in order, e.g. the database is in the right place, all the right software is installed etc. If the serial mode works, we're ready to change the starting script such that it works using SGE.
The starting script is called and located in the I-TASSERmod folder. I made a copy of this script and called it

Change following lines:
Line 840: change
$bsub=`qsub -e $errfile -o $outfile -l $walltime -N $tag $jobname`;
$bsub=`qsub -cwd -S /usr/bin/perl -e $errfile -o $outfile -N $tag $jobname`;

Line 1661: change
$bsub=`qsub $datadir/$tagnames{$i}`;
$bsub=`qsub -cwd -S /usr/bin/perl $datadir/$tagnames{$i}`;

This seems to do the trick. You can now use using the -runstyle parallel option and I-TASSER will submit the tasks to the SGE queue.