Browsed by
Category: Science

Couldn’t delete a failed R package installation

Couldn’t delete a failed R package installation

Today I faced a strange thing, while I tried to install an update to one of my R-packages. As usually, I installed the latest version from it like this

library("devtools")
install_github("fischuu/GenomicTools")

But the installation failed, and when I tried to reinstall it, I got this error message:

Installing package into ‘/homeappl/home/<user>/R/x86_64-redhat-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
ERROR: failed to lock directory ‘/homeappl/home/<user>/R/x86_64-redhat-linux-gnu-library/4.1’ for modifying
Try removing ‘/homeappl/home/<user>/R/x86_64-redhat-linux-gnu-library/4.1/00LOCK-GenomicTools’
Warning message:
In i.p(...) :
  installation of package ‘/tmp/Rtmp<...>Lv/file3c36<...>34/GenomicTools_0.2.11.tar.gz’ had non-zero exit status

So, I tried to go in said directory and delete the folder manually and there I received another error:

rm: cannot remove '00LOCK-GenomicTools/GenomicTools/libs/.nfs00000001002e2<...>d': Device or resource busy

I tried this and this, but nothing helped to delete that folder, it kept mocking my that the device is busy. Eventually, it helped just to rename the folder list this

mv 00LOCK-GenomicTools/ 00LOCK-GenomicTools-deleteThis/

It is now still hanging there in the folder, but I was able to reinstall the R-package and now I need to revisit the folder in a few days and check, if the device is still busy or if I can delete it then…

Workshop: “Foundation for the Future Agenda”

Workshop: “Foundation for the Future Agenda”

I just noticed I haven’t written anything yet about my attendance at the Shared Workshop: “Foundation for the Future Agenda” in Hinxton, UK, during February. This was a workshop organized by EBI for the three H2020 projects GeneSwitch, BovReg and AquaFAANG.

As always, it was an excellent meeting in Hinxton, with lots of good interaction and talks. Also, a visit to the Red Lion is always a nice experience.

Take a random sample of size k from paired-end FASTQ

Take a random sample of size k from paired-end FASTQ

Today I wrote a bash script that creates a random subset of a paired-end FASTQ file pair. It requires the names of the two FASTQ-files as input and also the amount of reads that the sample should have.

The script is mainly based on this Blog post. This is a rather rough code and it could be more user-friendly and allow for more options, but in its current form, it does what I need it to do.

#!/bin/bash

round() {
    printf "%.2f" "$1"
}

file1=$1
file2=$2
sample=$3
# Input test
 if ! [[ $sample =~ ^-?[0-9]+([.][0-9]+)?$ ]]; then 
>&2 echo "$sample is not a number"; exit 1; 
fi
  
extension1="${file1##*.}"
extension2="${file2##*.}"
filename1="${file1%.*}"
filename2="${file2%.*}"

fn1=$filename1"_"$sample".fastq"
fn2=$filename2"_"$sample".fastq"

if [ $extension1 == "gz" ]; then
  gunzip $file1;
  file1=$filename1;
  filename1="${file1%.*}"
  fn1=$filename1"_"$sample".fastq"
fi
if [ $extension2 == "gz" ]; then
  gunzip $file2;
  file2=$filename2;
  filename2="${file2%.*}"
  fn2=$filename2"_"$sample".fastq"
fi

lines=$(wc -l < $file1)
echo $lines
echo $sample

if (( $(awk 'BEGIN {print ("'$sample'" <= 1)}') )); then
  sample=$(awk 'BEGIN {printf("%.0f", "'$sample'" * "'$lines'")}')
fi

echo $sample

paste $file1 $file1 | \
awk '{ printf("%s",$0); n++; if(n%4==0) { printf("\n");} else { printf("\t");} }' | \
awk -v k=$sample 'BEGIN{srand(systime() + PROCINFO["pid"]); }{ s=x++<k?x- 1:int(rand()*x);
                  if(s<k)R[s]=$0}END{for(i in R)print R[i]}' | \
awk -F"\t" -v file1=$fn1 -v file2=$fn2 '{print $1"\n"$3"\n"$5"\n"$7 > file1;\
                                         print $2"\n"$4"\n"$6"\n"$8 > file2}'
                                         
if [ $extension1 == "gz" ]; then
  gzip $fn1;
  gzip $file1;
fi
if [ $extension2 == "gz" ]; then
  gzip $fn2;
  gzip $file2;
fi
RumenPredict

RumenPredict

Predicting appropriate GHG mitigation strategies based on modelling variables that contribute to ruminant environmental impact.

Objective:


Ruminant production is responsible for ~ 9% of anthropogenic CO2 emission and 37% of CH4 emissions. Release of methane results in 6-12% less energy being available to the animal. Ruminants also contribute towards NO2 within the environment, a persistent gas in the atmosphere which has 296 times more warming potential than CO2. RumenPredict brings together members of the international Rumen Microbial Genomics network (led by IBERS, AU), of which the Hungate 1000 (focussed on sequencing 1000 rumen microbes) and the Rumen Census (focussed on evaluating effects of diet, host genetics and geographical location on the rumen microbiome) are projects within.

RumenPredict brings together key members of the RMG network to generate the necessary data to link rumen microbiome information to host genetics and phenotype and develop feed based mitigation strategies. This will enhance innovative capacity and allow integration of new knowledge with that previously generated to devise geographic and animal-specific solutions to reduce the environmental impact of livestock ruminants. The project members have access to recent data/tools resulting from an array of projects, and RumenPredict will build upon and enhance the integration of knowledge generated from these projects whilst providing innovation through further testing and validation of key hypotheses resulting from the previously obtained data. RumenPredict will provide a platform for predicting how host genetics, feed additives or microbiome may affect emission phenotypes and develop genetic/diet/prediction technologies further for implementation to improve nitrogen use efficiency whilst decreasing environmental impact of ruminants.

Link: https://eragas.eu/research-projects/rumenpredict