Skip to content
Snippets Groups Projects
Commit 52554283 authored by Deepankar Chakroborty's avatar Deepankar Chakroborty
Browse files

Squashed commit of the following:

commit fe050d47
Author: Deepankar Chakroborty <deepankar.chakroborty@utu.fi>
Date:   Fri Jul 31 12:57:11 2020 +0300

    Include usage instruction inside function body

    Include usage instruction inside function body, so on typing just the function name to display the R code, the instructions will appear.
    Also stated things clearly in the T&C

commit fedbca4a
Author: Deepankar Chakroborty <deepankar.chakroborty@utu.fi>
Date:   Thu Jul 30 12:50:20 2020 +0300

    Updates

    1. Improve readability
    2. Manage differing lengths of breaks and labels.

commit fb32fb91
Author: Deepankar Chakroborty <deepankar.chakroborty@utu.fi>
Date:   Thu Jul 30 12:43:20 2020 +0300

    skip.steps works as expected

    skip.steps = 1, now skips 1 observation.

commit 00a8bbcf
Author: Deepankar Chakroborty <deepankar.chakroborty@utu.fi>
Date:   Thu Jul 30 12:32:16 2020 +0300

    add script to calculate breaks for axes in ggplot2

    calculates breaks and labels for axes in ggplot2 with user defined gaps
parent f9f647c1
No related branches found
No related tags found
No related merge requests found
# Installing dependencies
dependencies <- c("stringi", "doParallel")
missing_packages <- dependencies[!(dependencies %in% installed.packages()[, "Package"])]
if(length(missing_packages)) install.packages(missing_packages)
rm(missing_packages,dependencies)
IsolateCanonicalVariant <- function (AAchangeAnnotations){
# #<----------------------------> # #<---------------------------->
# # Please include this section when distributing and/or using this code. # # You must include this section when:
# # Please read and abide by the terms of the included LICENSE # # Distributing, Using and/or Modifying this code.
# # Please read and abide by the terms of the included LICENSE.
# # Copyright 2020, Deepankar Chakroborty, All rights reserved.
# # # #
# # Author : Deepankar Chakroborty (https://gitlab.utu.fi/deecha) # # Author : Deepankar Chakroborty (https://gitlab.utu.fi/deecha)
# # Report issues: https://gitlab.utu.fi/deecha/shared_scripts/-/issues # # Report issues: https://gitlab.utu.fi/deecha/shared_scripts/-/issues
# # License: https://gitlab.utu.fi/deecha/shared_scripts/-/blob/master/LICENSE # # License: https://gitlab.utu.fi/deecha/shared_scripts/-/blob/master/LICENSE
# # # #<---------------------------->
# # PURPOSE: # # PURPOSE:
# # From a given vector of annotations for a particular DNA change # # From a given vector of annotations for a particular DNA change
# # this function selects the canonical variant (if present) # # this function selects the canonical variant (if present)
# # by cross referencing the MANE Select and RefSeq Select sets. # # by cross referencing the MANE Select and RefSeq Select sets.
# #
# # Logic flow: # # LOGIC FLOW:
# # - If there is only one annotation; that is selected # # - If there is only one annotation; that is selected
# # - If canonical transcript is not found in MANE Select + RefSeq select # # - If canonical transcript is not found in MANE Select + RefSeq select
# # or a matching transcript ID is not found in the annotation then; # # or a matching transcript ID is not found in the annotation then;
# # The mutation with to the the highest position (residue number) is selected. # # The mutation with to the the highest position (residue number) is selected.
# # - If a match for canonical isoform is found then; # # - If a match for canonical isoform is found then;
# # that particular mutation is selected # # that particular mutation is selected
# #
# #<---------------------------->
# Installing dependencies
dependencies <- c("stringi", "doParallel")
missing_packages <- dependencies[!(dependencies %in% installed.packages()[, "Package"])]
if(length(missing_packages)) install.packages(missing_packages)
rm(missing_packages,dependencies)
IsolateCanonicalVariant <- function (AAchangeAnnotations){
# importing resources # importing resources
library(doParallel) library(doParallel)
refseq <- readRDS(url("https://gitlab.utu.fi/deecha/shared_scripts/-/raw/master/asset/RefSeqSelect_Gene_Transcript.RDS"),"rb") refseq <- readRDS(url("https://gitlab.utu.fi/deecha/shared_scripts/-/raw/master/asset/RefSeqSelect_Gene_Transcript.RDS"),"rb")
......
# Installing missing dependencies
dependencies <- c("stringi")
missing_packages <- dependencies[!(dependencies %in% installed.packages()[, "Package"])]
if(length(missing_packages)) install.packages(missing_packages)
rm(missing_packages,dependencies)
MutSiteFind <- function(MutationColumn){
# #<----------------------------> # #<---------------------------->
# # Please include this section when distributing and/or using this code. # # You must include this section when:
# # Please read and abide by the terms of the included LICENSE # # Distributing, Using and/or Modifying this code.
# # Please read and abide by the terms of the included LICENSE.
# # Copyright 2020, Deepankar Chakroborty, All rights reserved.
# # # #
# # Author : Deepankar Chakroborty (https://gitlab.utu.fi/deecha) # # Author : Deepankar Chakroborty (https://gitlab.utu.fi/deecha)
# # Report issues: https://gitlab.utu.fi/deecha/shared_scripts/-/issues # # Report issues: https://gitlab.utu.fi/deecha/shared_scripts/-/issues
# # License: https://gitlab.utu.fi/deecha/shared_scripts/-/blob/master/LICENSE # # License: https://gitlab.utu.fi/deecha/shared_scripts/-/blob/master/LICENSE
# # # #<---------------------------->
# # PURPOSE: # # PURPOSE:
# # For a given vector of amino acid changes like A123T, V256F, E746_A750del # # For a given vector of amino acid changes like A123T, V256F, E746_A750del
# # this function returns c(123, 256, 746) as amino acid positions of # # this function returns c(123, 256, 746) as amino acid positions of
# # the mutated residue. # # the mutated residue.
# # In case of indels, it doesn't return the range!! (returns only the start position) # # In case of indels, it doesn't return the range!!
# # # # (i.e. returns only the start position)
# #<---------------------------->
dependencies <- c("stringi")
missing_packages <- dependencies[!(dependencies %in% installed.packages()[, "Package"])]
if(length(missing_packages)) install.packages(missing_packages)
rm(missing_packages,dependencies)
MutSiteFind <- function(MutationColumn){
return(unlist(x = stringi::stri_extract_first_regex(str = MutationColumn,pattern = "[[:digit:]]+"), use.names = F)) return(unlist(x = stringi::stri_extract_first_regex(str = MutationColumn,pattern = "[[:digit:]]+"), use.names = F))
} }
......
ggplotBreaks <- function(range,tick,skip.steps=0){
# #<----------------------------> # #<---------------------------->
# # Please include this section when distributing and/or using this code. # # You must include this section when:
# # Please read and abide by the terms of the included LICENSE # # Distributing, Using and/or Modifying this code.
# # Please read and abide by the terms of the included LICENSE.
# # Copyright 2020, Deepankar Chakroborty, All rights reserved.
# # # #
# # Author : Deepankar Chakroborty (https://gitlab.utu.fi/deecha) # # Author : Deepankar Chakroborty (https://gitlab.utu.fi/deecha)
# # Report issues: https://gitlab.utu.fi/deecha/shared_scripts/-/issues # # Report issues: https://gitlab.utu.fi/deecha/shared_scripts/-/issues
# # License: https://gitlab.utu.fi/deecha/shared_scripts/-/blob/master/LICENSE # # License: https://gitlab.utu.fi/deecha/shared_scripts/-/blob/master/LICENSE
# # # #<---------------------------->
# # PURPOSE: # # PURPOSE:
# # Returns a list of vectors containing breaks and labels # # Returns a list of vectors containing breaks and labels
# # for a continuous variable mapped to one of the axes for use with ggplot2 # # for a continuous variable mapped to one of the axes for use with ggplot2
...@@ -20,12 +25,8 @@ ...@@ -20,12 +25,8 @@
# # 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 # # 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150
# # # #
# # $labels # # $labels
# # "0" " " "20" " " "40" " " "60" " " "80" " " "100" " " # # "0" " " "20" " " "40" " " "60" " " "80" " " "100" " " "120" " " "140" " "
# # "120" " " "140" " "
# #
# #<---------------------------->
ggplotBreaks <- function(range,tick,skip.steps=0){
if (length(range) != 2){ if (length(range) != 2){
stop("Correct format for: range = c(min_value,max_value)") stop("Correct format for: range = c(min_value,max_value)")
} }
......
# Installing missing dependencies
dependencies <- c("stringi", "progress")
missing_packages <- dependencies[!(dependencies %in% installed.packages()[, "Package"])]
if(length(missing_packages)) install.packages(missing_packages)
rm(missing_packages,dependencies)
unparalog <- function(DATA, paralog_separator = ";", annotation_separator = ",", GeneColName , AnnotationColName ){
# #<----------------------------> # #<---------------------------->
# # Please include this section when distributing and/or using this code. # # You must include this section when:
# # Please read and abide by the terms of the included LICENSE # # Distributing, Using and/or Modifying this code.
# # Please read and abide by the terms of the included LICENSE.
# # Copyright 2020, Deepankar Chakroborty, All rights reserved.
# # # #
# # Author : Deepankar Chakroborty (https://gitlab.utu.fi/deecha) # # Author : Deepankar Chakroborty (https://gitlab.utu.fi/deecha)
# # Report issues: https://gitlab.utu.fi/deecha/shared_scripts/-/issues # # Report issues: https://gitlab.utu.fi/deecha/shared_scripts/-/issues
# # License: https://gitlab.utu.fi/deecha/shared_scripts/-/blob/master/LICENSE # # License: https://gitlab.utu.fi/deecha/shared_scripts/-/blob/master/LICENSE
# # # #<---------------------------->
# # PURPOSE: # # PURPOSE:
# # In the gene column in your SNV annotation if you see something like: # # In the gene column in your SNV annotation if you see something like:
# # e.g. PRAMEF7;PRAMEF8 OR PRAMEF7,PRAMEF8 # # e.g. PRAMEF7;PRAMEF8 OR PRAMEF7,PRAMEF8
# # then your mutations annotations have gene paralogs. # # then your mutations annotations have gene paralogs.
# # This script aims to de-couple those paralogs into individual their rows. # # This script aims to de-couple those paralogs into individual their rows.
# # # #
# ------------------------
### Info on what to pass as the function parameters: # # INFO on what to pass as the function parameters:
# Assign correct paralog_separator found in the gene column of your SNV annotations # e.g. if the Gene column has entries like PRAMEF7;PRAMEF8 # Assign correct paralog_separator found in the gene column of your SNV annotations # e.g. if the Gene column has entries like PRAMEF7;PRAMEF8
# then the paralog_separator is ";" # then the paralog_separator is ";"
# or set it to whatever separator is used by your SNV annotation software. # or set it to whatever separator is used by your SNV annotation software.
...@@ -29,13 +39,6 @@ ...@@ -29,13 +39,6 @@
# <---------------> # <--------------->
# Installing missing dependencies
dependencies <- c("stringi", "progress")
missing_packages <- dependencies[!(dependencies %in% installed.packages()[, "Package"])]
if(length(missing_packages)) install.packages(missing_packages)
rm(missing_packages,dependencies)
unparalog <- function(DATA, paralog_separator = ";", annotation_separator = ",", GeneColName , AnnotationColName ){
# Sanity checks # Sanity checks
check_paralog_sep <- !any(stringi::stri_detect_fixed(str = DATA$Gene.refGene,pattern = paralog_separator)) check_paralog_sep <- !any(stringi::stri_detect_fixed(str = DATA$Gene.refGene,pattern = paralog_separator))
check_annotation_sep <- !any(stringi::stri_detect_fixed(str = DATA$AAChange.refGene, pattern = annotation_separator)) check_annotation_sep <- !any(stringi::stri_detect_fixed(str = DATA$AAChange.refGene, pattern = annotation_separator))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment