Skip to content

Instantly share code, notes, and snippets.

View gatoravi's full-sized avatar

Avinash R gatoravi

View GitHub Profile
@gatoravi
gatoravi / velocyto_install_notes.md
Created January 16, 2020 18:47
Installing velocyto.R on Mac

On a Mac, the linker ld looks at the variable $LIBRARY_PATH

I was trying to install Velocyto.R on Rstudio.

One of the pre-reqs is boost, I installed boost using brew install boost, this links the boost libraries under /usr/local/Cellar/boost/ to /usr/local/lib.

However R was unable to find the boost libraries when installing velocyto.R I had to tell the linker to find the required boost library by setting the environment variable: Sys.setenv(LIBRARY_PATH = "/usr/local/lib") This R command sets the environment variable LIBRARY_PATH and the linking program ld can then find the required boost libraries.

@gatoravi
gatoravi / 2mer.cc
Last active September 30, 2019 23:33
Takes a kmer and fasta as input and lists all positions //within the fasta for that kmer
/*
Copyright 2019 Avinash Ramu
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR O
first_time <- function() {
t1 <- read.table("../ALL.chrY.phase3_integrated_v1b.20130502.genotypes.vcf.gz")
print(nrow(t1))
nucs <- c('A', 'C', 'G', 'T')
t1 <- t1[t1$V4 %in% nucs & t1$V5 %in% nucs, ]
print(nrow(t1))
t2 <- t1[, 10:ncol(t1)]
t2 <- sapply(t2, as.character)
save(t2, file = "t2")
}
@gatoravi
gatoravi / estimate_negative_binomial.R
Last active May 29, 2018 20:05
Estimate parameters of a negative binomial distribution using method of moments
> counts <- rnbinom(1000, size = 10, p = 0.1)
> mu <- mean(counts)
> p <- mu/var(counts)
> r <- mu ^ 2/(var(counts) - mu)
> hist(counts, freq = F)
> curve(dnbinom(x, size = r, prob = p), from = 0, to = max(counts), n = max(counts) + 1)
@gatoravi
gatoravi / git-file-limit.md
Created July 16, 2017 20:22
Set file limits in git

The default soft (warning) and hard (error) size limits are set to 500,000 and 10,000,000 bytes but can be overriden through the hooks.filesizesoftlimit and hooks.filesizehardlimit settings respectively:

$ git config hooks.filesizesoftlimit 100000
$ git config hooks.filesizehardlimit 4000000
@gatoravi
gatoravi / slurm_commands.md
Created May 16, 2017 19:23
Slurm information
sacct -u aru
      JobID    JobName  Partition    Account  AllocCPUS      State ExitCode
------------ ---------- ---------- ---------- ---------- ---------- --------
5718685      interacti+ interacti+      dcl          1  COMPLETED      0:0
5718686      interacti+ interacti+      dcl          1  COMPLETED      0:0
sacct -j 5719109 --format=JobID,JobName,MaxRSS,Elapsed
JobID JobName MaxRSS Elapsed
@gatoravi
gatoravi / movies.md
Last active November 11, 2020 21:29
Movies to watch
  • Aaranya kaandam
  • Madras
  • Thani oruvan
  • Joker (2016)
  • Pariyerum Perumal BA.BL
  • Andhadhun
  • Ittefaq
  • Evaru (same as Badla)
@gatoravi
gatoravi / to_read_from_ramharish.md
Last active May 11, 2017 04:45
Books to read from @ramare
  • Intelligent investor, genuinely serious book on investing and how to read markets...but like a textbook
  • Short history of nearly everything by Bill Bryson, must read - damn cool book
  • Good to Great...amazing book if u want to learn how to study companies...seemingly easy to read but can make it tough for yourself if u want to get into nitty gritty...
  • Buffett by Roger Lowenstein
  • Barbarians at the Gate, for fiction feel of a non fiction story...good time pass...
  • Rise and Fall of Nations by Ruchir sharma
  • Fooled by randomness, book about stats and how markets are
@gatoravi
gatoravi / cis_ase_generate_testdata.sh
Created June 30, 2016 20:20
cis_ase_generate_testdata
rm -f simulated_hets.bam && python simulate_bam_reads.py ~/dat/ref/hs37d5/all_sequences.fa 0.5 1:100000 1:100200 1:10040 0 1:100600 1:100800 | samtools view -bh > simulated_hets.bam && samtools index simulated_hets.bam
rm -f simulated_hets.bam && python simulate_bam_reads.py ~/dat/ref/hs37d5/all_sequences.fa 1.0 1:100000 1:100200 1:10040 0 1:100600 1:100800 | samtools view -bh > simulated_homs.bam && samtools index simulated_homs.bam
rm -f cis_ase_tumor_rna.bam && python simulate_bam_reads.py ~/src/regtools/tests/integration-test/data/fa/test_chr22.fa 0 22:1050 22:1550 22:1950 22:2050 22:2550 22:2950 22:3050 22:3550 22:3950 | samtools view -bh > cis_ase_tumor_rna.bam && samtools index cis_ase_tumor_rna.bam
rm -f cis_ase_tumor_dna.bam && python simulate_bam_reads.py ~/src/regtools/tests/integration-test/data/fa/test_chr22.fa 0.5 22:1050 22:1550 22:1950 22:2050 22:2550 22:2950 22:3050 22:3550 22:3950 | samtools view -bh > cis_ase_tumor_dna.bam && samtools index cis_ase_tumor_dn
@gatoravi
gatoravi / check_inodes.txt
Created June 10, 2016 02:43
To check inodes - lsf disk usage
df $path and df -i $path to check space and inodes