Skip to content

Instantly share code, notes, and snippets.

View leahkemp's full-sized avatar

Leah Kemp leahkemp

  • Garvan Institute of Medical Research
  • Taranaki, New Zealand
View GitHub Profile
@leahkemp
leahkemp / add_large_files_to_git_ignore.sh
Created August 17, 2021 00:57
Add all files greater than a certain size to the .gitinore file
# Note. 2G is the maximum file size to be pushed to github with Git Large File Storage
echo "# Files over 2G" >> .gitignore
find * -size +2G -type f -print >> .gitignore
@leahkemp
leahkemp / get_num_reads_per_fastq.sh
Created August 17, 2021 00:48
Generate a csv file with number of reads in each fastq in a directory of fastq files
#!/bin/bash
##### INFO #####
# this script generates a csv file with the number of reads in each fastq file in a directory of
# fastq files
##### USER PARAMETERS #####
# Set the fastq directory
fastq_dir="/home/user/fastq"
@leahkemp
leahkemp / unique_chromosomes_vcf
Created July 27, 2020 00:32
Return unique chromosome values in vcf
zgrep -v "#" file.gz | awk '{print $1}' | uniq
@leahkemp
leahkemp / white_spaces_to_tab_spaces.sh
Last active July 20, 2020 22:06
Convert white spaces to tab spaces
# Code by Miles Benton
# An example pedigree file
# Using cat
cat pedigree.ped | tr ' ' '\t'
# Using sed
sed -i 's/ /\t/g' pedigree.ped
@leahkemp
leahkemp / monitor_gpu_usage.sh
Last active July 20, 2020 21:57
Monitor GPU usage
nvidia-smi
nvtop
@leahkemp
leahkemp / ftp_directory_download.sh
Last active July 22, 2020 21:43
Download everything from an ftp directory in parallel
# Code by Miles Benton
# An example for downloading everything from the GATK resource bundle (b37)
curl -l ftp://ftp.broadinstitute.org/bundle/b37/ --user gsapubftp-anonymous | \
sed -e 's/^/ftp:\/\/ftp.broadinstitute.org\/bundle\/b37\//' | \
parallel -j15 wget --user=gsapubftp-anonymous --password=""
curl -l ftp://ftp.broadinstitute.org/bundle/b37/ --user gsapubftp-anonymous | sed -e 's/^/ftp:\/\/ftp.broadinstitute.org\/bundle\/b37\//' > ftp-files.txt \
cat ftp-files.txt | parallel -j5 wget --user=gsapubftp-anonymous --password=""
@leahkemp
leahkemp / leaflet_transform.R
Last active February 25, 2020 22:19
Transform a Shape file to correctly work in Leaflet
"shape <- shapefile("../data.shp") %>%
st_as_sf()"
shape_transformed <- shape %>% as_Spatial() %>% spTransform(CRS("+proj=longlat +datum=WGS84 +no_defs +lon_wrap=180"))