Skip to content

Instantly share code, notes, and snippets.

View ToledoEM's full-sized avatar
💭
:-)

Enrique ToledoEM

💭
:-)
View GitHub Profile
@ToledoEM
ToledoEM / Readme.md
Created January 26, 2022 09:40
Setting Flightradar 24 and Flightaware simultaneously in a Raspberry pi.
@ToledoEM
ToledoEM / parallelRDS.R
Created March 9, 2021 15:47 — forked from russellpierce/parallelRDS.R
Provided the right tools are installed, i.e. xz and pigz, will offload the compression handling to an external program and leave R free to do the data import. This ends up being quite a bit more efficient for large files. Some tweaks may be needed for operating systems other than Ubuntu; there may be additional dependencies on the github repo dr…
library(parallel)
saveRDS.xz <- function(object,file,threads=parallel::detectCores()) {
pxzAvail <- any(grepl("(XZ Utils)",system("pxz -V",intern=TRUE)))
if (pxzAvail) {
con <- pipe(paste0("pxz -T",threads," > ",file),"wb")
base::saveRDS(object, file = con)
close(con)
} else {
saveRDS(object,file=file,compress="xz")
@ToledoEM
ToledoEM / new_aes.R
Created October 22, 2019 09:08 — forked from eliocamp/new_aes.R
A way to add multiple color or fill scales to a ggplot2 plot
#' Allows to add another scale
#'
#' @param new_aes character with the aesthetic for which new scales will be
#' created
#'
new_scale <- function(new_aes) {
structure(ggplot2::standardise_aes_names(new_aes), class = "new_aes")
}
#' Convenient functions
@ToledoEM
ToledoEM / Kallisto_bash_2.sh
Created September 16, 2016 09:07
Kallisto bash better file name handling
#!/bin/bash
for file in $(ls SS_1797/*.fastq.gz)
do
start=`date +%s`
outname=$(echo $file | cut -c 22- |rev | cut -c 17- | rev | uniq)
outname=SS_1797/$outname
kallisto quant -i hs_GRCh38_kallisto_ncRNA.idx --single -l 76 -s 3 -b 50 -t 4 -o $outname $file
end=`date +%s`
runtime=$((end-start))
@ToledoEM
ToledoEM / Kallisto_bash.sh
Created August 15, 2016 15:31
Bash throught fastq.gz files for kallisto
#!/bin/bash
# edited https://benchtobioinformatics.wordpress.com/2015/07/10/using-kallisto-for-gene-expression-analysis-of-published-rnaseq-data/
# and https://www.biostars.org/p/191018/
#
# foldername for output -> filename, revert, cut 17 chr, revert, check if it is unique
# outname=$(echo $file | rev | cut -c 17- | rev | uniq)
for file in $(ls folder/*.fastq.gz) #all files fastq.gz in folder
do
# Modified from https://raunakms.wordpress.com/2014/02/22/visualize-cluster-one-mode-projection-of-a-bi-partite-graph/
# Add threshole to function
# Bass, Juan I. Fuxman, et al. "Using networks to measure similarity between genes: association index selection."
# Nature methods 10.12 (2013): 1169-1176.
#
# Variable threshole to avoid nonspecific interactions depending of the data
#
get.csi.t <- function(dat,t) {
mat <- matrix(0, nrow = nrow(dat), ncol = ncol(dat))