Tuesday, March 31, 2015

Multiple fastq files mapping in a loop

If you have multiple fastq files e.g. from 4 sequencing lanes that belong to the same sample.





And you want to run mapping algorithm in a loop to map them separately (then connect outputs with samtools) use a loop that will call left and right reads from one lane and put mapping code in a loop.

for j in {1..4}

                echo MAPPING $Reads1
                echo MAPPING  $Reads2

#mapping code $Reads1 $Reads2

Monday, March 30, 2015

How to comment multiple lines in Unix

If you have a shell script and want to comment multiple lines at once (and not to write # in front of every line) use the following.




All the code in between will not be executed when you source the file, and instead will be sent to a "here"-document.

Thursday, March 26, 2015

Source with sudo privileges

To run a list of commands from a file using source and give sudo privileges in the same time, command sudo source will not work since there is no executable to run for sudo, source is a shell built-in.

sudo bash -c "source file_name"

Sunday, March 15, 2015

Clustering of genes: treatment vs individual

Here I have used DESeq to cluster RNASeq data from top 100 expressed genes in human smooth muscle cells from coronary arteries, from two different individuals, treated 1h or 6 hours with TGF beta.

Interestingly, the clustering has grouped cells from the same individual, and not from the same treatment.

Even though here we have only two samples, we might hypothesize the following.

Transcriptomes (or at least the part that is intensively expressed) are thus highly specific for the individual and resistant to the changes that the highly efficient and perturbing molecule like TGF beta would introduce into the cell, and they would stay in a stable equilibrium i.e. in the intrinsic state of the system that is specific for the each individual.

Only the PCA plot would reveal that the complete transcriptome has begun to shift under the influence of the drug and that the effect of the drug on the variance is almost equal as the effect of the individual. Still, even that the effect of the growth factor is visible, the biggest component of the variance, PC1, remains the individual donor of the cells.

Monday, March 2, 2015

How to move files with rsync

To move files using rsync i.e. to sync and then delete original folder use the following line:

sudo rsync -av --ignore-existing --remove-source-files /old/path/to/folder/ /new/path/to/folder/ && rsync -av --delete `mktemp -d`/ /old/path/to/folder/ && rmdir /old/path/to/folder/

removes files from original folder but not the original folder structure.
rsync -av --delete `mktemp -d`/ /old/path/to/folder/
removes subdirectories from original folder
rmdir /old/path/to/folder/
removes original folder