Thursday, November 19, 2020

Regions with average quality BELOW this will be trimmed

BBDuk does not actually do naive quality trimming rather quality trimming is done using the Phred algorithm.

This is nicely explained by author Brian Bushnell in the following thread:

 http://seqanswers.com/forums/showthread.php?t=42776

Imagine a read with this quality profile:

40, 40, 40, 40, 2, 2, 2, 2, 40, 2

The Phred algorithm would trim the last 6 bases, because their average quality (calculated by summing the error probabilities) is 2.79, which is below 10. Trimming regions with average quality below a threshold gives the optimal result in terms of the ratio of retained bases to the expected number of errors.

In the following example, I ran the following command to filter bases at Q30.

bbduk.sh -Xmx6g in1=$R1.fastq in2=$R2.fastq out1=$R1\_bbmap_adaptertrimmed_Q30.fastq out2=$R2\_bbmap_adaptertrimmed_Q30.fastq ref=bbmap/resources/adapters.fa ktrim=r k=23 mink=11 hdist=1 qtrim=rl trimq=30 minavgquality=30

This does not mean that your reads will not have any bases with quality score less than Q30. Because the trimming is not based on naive trimming but phred score quality trimming. Thus, we still end up with bases less than Q30 probably in minor portion of our fastq data. 




Sunday, August 16, 2020

R package installation: Error in dyn.load(file, DLLpath = DLLpath, ...)

Error in dyn.load(file, DLLpath = DLLpath, ...) : 

  unable to load shared object '/home/user/R/x86_64-pc-linux-gnu-library/3.6/rlang/libs/rlang.so':

  /home/user/R/x86_64-pc-linux-gnu-library/3.6/rlang/libs/rlang.so: undefined symbol: R_removeVarFromFrame

Calls: <Anonymous> ... namespaceImport -> loadNamespace -> library.dynam -> dyn.load

Execution halted 


Resolve this by typing following command in R console

install.packages("rlang", type = "source")

Thursday, August 13, 2020

Downgrade R version 4.0 to R version 3.6

I have encountered problem working with R version 4.0 and wanted to downgrade to R version 3.6. Here is a way how to do this:

  1. Remove the currently installed R version using the following commands:

    sudo apt-get remove r-base-core
    sudo apt-get autoremove 
  2. Find the version that you need by running the following command:

    apt-cache showpkg r-base

The output should look something like this: 

Provides: 
4.0.2-1.1804.0 - 
4.0.1-1.1804.0 - 
4.0.0-1.1804.0 - 
3.6.3-1bionic - 
3.6.2-1bionic - 
3.6.1-3bionic - 
3.6.1-1bionic - 
3.6.0-2bionic - 
3.6.0-1bionic - 
3.5.3-1bionic - 
3.5.2-1bionic - 
3.5.1-2bionic - 
3.5.1-1bionic - 
3.5.0-1bionic - 
3.4.4-1ubuntu1 - 

So, I want to install 3.6.3-1bionic version. This can be achieved using the following command:

sudo apt-get install r-base-core=3.6.3-1bionic