This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alias ll='ls -lah --color=auto --classify --group-directories-first --time-style=long-iso' | |
| # alias ll='ls -lah --color=auto --classify --group-directories-first --time-style=long-iso --sort=time -r' | |
| alias diff-s='diff -s -wy --suppress-common-lines' | |
| alias squeue_comment="squeue --format='%18i %9P %8j %8u %2t %10M %6D %R %k'" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| awk 'BEGIN { | |
| OFS = "," | |
| print "ID", 0, 1, 2, 5 | |
| } | |
| { | |
| for (i = 2; i <= NF; i++) { | |
| count[$1,$i]++ | |
| } | |
| vals[$1] = $1 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # First compute PCA files using Plink2 from the command line | |
| # Refer to https://www.cog-genomics.org/plink/2.0/strat#pca for how PCA approximation is done | |
| # As suggested in the link above, --maf is applied for variants below 0.01 | |
| # Plink2 command line is: | |
| # plink2 --cow --bfile <mybfile> --keep-allele-order --maf 0.01 --pca approx | |
| ######### plot in R ################ | |
| # Output: a 4 pages pdf file with: pages 1 to 3 are scatterplots of PCx vs PCx (with PCx from 1 to 3), page 4 is a 3D scatterplot of the first 3 PCs. | |
| pacman::p_load(dplyr, data.table, ggplot2, scatterplot3d) | |
| pca_res <- fread(file = "plink2.eigenvec") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pacman::p_load(Hmisc, rrapply) | |
| # loop variables | |
| scenarios <- c("scenario1", "scenario2") | |
| groups <- c("grp1", "grp2", "grp3", "grp4") | |
| # create two lists, one for the plots and one for the statistics only | |
| ALL_stats <- list() | |
| ALL_plots <- list() | |
| for(scenario in scenarios){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # different (similar) ways to check and load pkgs in R | |
| # method 1 | |
| check_pkgs <- function(pkg_list){ | |
| for(pkg in pkg_list) { | |
| if(!require(pkg, character.only = T)){ | |
| stop('Please install the ', pkg, ' package, using "install.packages(', pkg, ')"', call. = F) | |
| } | |
| } | |
| } | |
| check_pkgs(pkg_list = c("asserththat", "ggplot2")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Project_name_WP1 | |
| Project_name project, WP1, [other details]. | |
| ## Project structure | |
| Project structure is initiated with `init_project.sh.` | |
| These are the main directories: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env Rscript | |
| # | |
| # Purpose: what this script does. | |
| # Author: Renzo Bonifazi - dd-mm-yyyy | |
| # Usage: | |
| # # Rscript --vanilla myscript.R --file my_path/myfile.csv --output myoutput.csv | |
| # | |
| # Example: | |
| # # Rscript --vanilla Make_pedigree.R --file Renzo/Documents/file.csv --output Output.csv | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # grep a string in multiple file names and include subdirectories | |
| grep --include 'file1.txt' --include 'file2.txt' -rn --ignore-case TITLE directory1 directory2 |