One process listens to one port.

What about a computer runs multiple tabs/ browsers?

For clients, we don’y listen to port 80. For each tab, the browser will assign an arbitray port (usually > 50000) to the tab. Then, each port independently communicates with each tab. So one process still listens to one port.

Two RAID solutions

Hardware: PCIE RAID card
Software: Linux softwares

A workstation in our lab uses hardware PCIE RAID card to maintain disks.
All disks connect to PCIE RAID card.
RAID card is setup in BIOS.

**Before entering system, virtual drive must be created. **
Systems can not identify any physical disks. Only when virtual drive is setup, can system identify drives.

Foreign in RAID means the disk contains RAID configuration that does not belong to the current RAID card.
Foreign configuration can be imported or wiped.

Software-based RAID is managed by programs (e.g., mdadm).
The programs merge mounting points into single virtual drive.

Chimeric reads

Reads are splited and aligned to reference genome separately.
Samtools flag 2048

samtools view -F 2048

can easliy exclude chimeric reads

Different strategies in Samtools fastq & depth

samtools fastq

does not include any chimeric reads in output file

samtools depth

However, count all reads including chimeric

**Warning: Output from samtools fastq and samtools depth can be inconsistent **


enter root mode using root’s password


use super user’s privilege to execuate a command

sudo -i

enter root mode using a superuser’s password

su VS sudo -i

The passwords used are different
su: must use root’s password
sudo -i: can use any user’s password who is in admin group

Enable/Disable root user

Some systems did not enable root user (Some users in admin group).
Give root password will enable root

$sudo –i passwd root
Enter new UNIX password: [Set new password for root account]
Retype new UNIX password: [Confirm new password]

Delete password of root will disable root

$sudo passwd -dl root

source Adcanced R

Four OO systems

  1. Base object
  2. S3
  3. S4
  4. Reference classes

Base object

Underlying every R object is a C structure (or struct) that describes how that object is stored in memory.

S3 object

In S3, methods belong to functions, called generic functions, or generics for short. S3 methods do not belong to objects or classes.

S3 objects are usually built on top of lists, or atomic vectors with attributes.

S4 object

S4 works in a similar way to S3, but it adds formality and rigour. Methods still belong to functions, not classes.

Inheritence supported.
Method dispatch can be based on multiple arguments to a generic function, not just one.
There is a special operator, @, for extracting slots (aka fields) from an S4 object.

Referenece class

Reference classes (or RC for short) are the newest OO system in R
RC methods belong to objects, not functions
RC objects are mutable: the usual R** copy-on-modify semantics do not apply **


S3 objects

S3 objects are made up of atomic vectors, arrays, and lists, so you can always pull apart an S3 object using the techniques described above and the knowledge you gain from str().

DataFrame is built based on List!

#S4 objects

There are also two additional subsetting operators that are needed for S4 objects: @ (equivalent to $), and slot() (equivalent to [[). @ is more restrictive than $ in that it will return an error if the slot does not exist. These are described in more detail in the OO field guide.

$ is a shorthand operator, where x$y is equivalent to x[[“y”, exact = FALSE]]


Now, R is more like a modern language. However, few people will use it for OOP. People will stick to its original base and S3 objects.

sudo docker run -d -ti  --rm -p 8787:8787 -e ROOT=TRUE  -e PASSWORD=yourpasswordhere --name RStudioServer --mount source=R_data,target=/home/rstudio/rdata  rocker/rstudio

-d: detachable
-e ROOT: give user privileges
-e PASSWORD: define password
–mount: mount a persistent drive
–name: give the container a name

Detach and attach for dock containers (copied from a post)

It all depends on how the container is launched. It comes down to the following when the container was launched:
was a TTY allocated (-t)
was stdin left open (-i)

^P^Q does work, BUT only when -t and -i is used to launch the container:
[berto@g6]$ docker run -ti -d --name test python:3.6 /bin/bash -c 'while [ 1 ]; do sleep 30; done;' b26e39632351192a9a1a00ea0c2f3e10729b6d3e22f8e0676d6519e15c08b518 
[berto@g6]$ docker attach test # here I typed
^P^Q read escape sequence # i'm back to my prompt [berto@g6]$ docker kill test; docker rm -v test test test ctrl+c does work, BUT only when -t (without -i) is used to launch the container:
[berto@g6]$ docker run -t -d --name test python:3.6 /bin/bash -c 'while [ 1 ]; do sleep 30; done;' 018a228c96d6bf2e73cccaefcf656b02753905b9a859f32e60bdf343bcbe834d 
[berto@g6]$ docker attach test ^C

Rstudio server in LXD container combined with conda environment

I have a conda environment dedicated to the R studio server. Rstudio server is an application service running in the background.

The start of Rstudio server service cannot combine with conda environment. That means the service will rely on the base environment.

I attempted to edit systemd file and wrap the start service into a shell script which activates environment first. However, the environment does not start prior to the running of service.

Some R packages from Bioconductor need system libraries.

Current solution:

Use Rstudio server docker image.

I have a LXD container running on a server.
Running docker in a LXD container always pops out OCI errors. A change must be made before running docker.

In LXD documentation page, https://lxd.readthedocs.io/en/latest/

How can I run docker inside a LXD container?
In order to run Docker inside a LXD container the security.nesting property of the container should be set to true.

lxc config set <container> security.nesting true

Note that LXD containers cannot load kernel modules, so depending on your Docker configuration you may need to have the needed extra kernel modules loaded by the host.
You can do so by setting a comma separate list of kernel modules that your container needs with:

lxc config set <container> linux.kernel_modules <modules>

We have also received some reports that creating a /.dockerenv file in your container can help Docker ignore some errors it’s getting due to running in a nested environment.


Jekyll is a simple, blog-aware, static site generator for personal, project, or organization sites.

Github.io support Jekyll for personal site

Some notes on Jekyll

Collection: A set of posts
navigation.yml: define elements in the page, such as header

Display pdf in the page

It seems Safari does not handle object and embed tag well to display a pdf file (No problem in Chrome).
The img tag works well in Safari, but multiple-page pdf will have to be splitted into single pages.
Current solution is to use iframe tag

A local Jekyll manager

I installed a local Jekyll plugin jekyll-manager.

bundle exec jekyll serve


Installation of Jekyll-manager in macOS:

Add the following to your site’s Gemfile

gem 'jekyll-manager', group: :jekyll_plugins


bundle install

However, Xcode changed path of dependencies. If errors were popped up, clear ruby installation and reinstall

In Samtools manual, the SEQ field is not fully defined.

SEQ: segment SEQuence. This field can be a ‘ * ’ when the sequence is not stored. If not a ‘*’, the lengthof the sequence must equal the sum of lengths ofM/I/S/=/Xoperations inCIGAR. An ‘=’ denotes thebase is identical to the reference base. No assumptions can be made on the letter cases.

Bowtie2 will print read sequence in this field.

if aligned to the reverse strand, reverse-complemented reads sequence will be printed.

Tested, confirmed.

BWA probably does it in the same way.

10 SEQ query SEQuence on the same strand as the reference

No test yet

Samtools fasta/fastq
It dumps SEQ field but in Raw read style. Essentially, raw reads will be output.

For example:

A sequence with flag bit 16, means it is mapped to reverse strand. In SEQ field, a reverse complement sequence is stored in SEQ field. However, when outputing in samtools fasta, original sequence will be written out.