- The Practice of programming - Brian W. Kernighan
- The Unix Programming Environment - Brian W. Kernighan and Rob Pike
- Numerical Recipes in C: The Art of Scientific Computing
- Structure and Interpretation of Computer Programs.
- Higher-Order Perl: Transforming Programs with Programs - Mark Jason Dominus
- Reverse Engineering for Beginners - Dennis Yurichev
- The Pragmatic Programmer: From Journeyman to Master
- The Mythical Man-Month
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
#List all the instrument-data that is imported | |
genome instrument-data list imported "sample.patient.common_name='TST1ds' and sample.extraction_type = 'genomic dna'" | |
genome instrument-data list imported "sample.patient.common_name='TST1ds' and sample.extraction_type = 'rna'" | |
#Define the models based on imported instrument-data, rename the ID's | |
genome model define rna-seq --reference-sequence-build='106942997' --annotation-build='124434505' --cancer-annotation-db='tgi/cancer-annotation/human/build37-20131010.1' --subject='H_NJ-HCC1395ds-HCC1395_RNA' --processing-profile='2762841' --instrument-data='0296e0aeeb3f4daab1e8604cddb2cb70' --model-name='hcc1395ds-tumor-rnaseq' | |
genome model define rna-seq --reference-sequence-build='106942997' --annotation-build='124434505' --cancer-annotation-db='tgi/cancer-annotation/human/build37-20131010.1' --subject='H_NJ-HCC1395ds-HCC1395_BL_RNA' --processing-profile='2762841' --instrument-data='675561c466744c8498f903b77ee9acbe' --model-name='hcc1395ds-normal-rnaseq' | |
ge |
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
#! /bin/Rscript | |
run_em <- function(data, cutoff = 1.50, theta_init = 0.5, iter = 100, tolerance = 1e-4) { | |
missing = data[data == cutoff] | |
observed = data[data != cutoff] | |
n1 = length(observed) | |
n2 = length(missing) | |
n = n1 + n2 | |
theta_current = theta_init | |
theta_new = 0 |
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
ls *tsv | xargs -i echo 'cut -f 1-4,6-9 {} |tr ":" "\t" | cut -f 1-4,6,20,34,48 | perl -ne '\''chomp$_; @array=split("\t"); if($array[3] == $array[4] || $array[3] == $array[5] || $array[3] == $array[6] || $array[3] == $array[7]){next;} else {print "$_\n";}'\'' > {}.formatted ' |
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
#VEP is on clia1 here - /opt/gms/vep/variant_effect_predictor | |
#An example that I used to run it was, | |
#VEP is installed here /opt/gms/vep/variant_effect_predictor | |
#PERL5LIB=$PERL5LIB:/opt/gms/vep/ perl variant_effect_predictor.pl -i example_GRCh37.vcf --cache --dir_cache /opt/gms/vep/ | |
#another example with required VEP annotations for GEMINI | |
PERL5LIB=$PERL5LIB:/opt/gms/vep/ perl /opt/gms/vep/variant_effect_predictor/variant_effect_predictor.pl -i test.vcf \ | |
--cache --sift b --polyphen b --symbol --numbers --biotype --total_length \ | |
-o snvs.detailed.vep.vcf --vcf --fields Consequence,Codons,Amino_acids,Gene,SYMBOL,Feature,EXON,PolyPhen,SIFT,Protein_position,BIOTYPE \ |
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
#! /bin/bash | |
#This script takes 2 arguments | |
#The first script is the BAM file | |
#The second is the BED file | |
bam=$1 | |
bed=$2 | |
awk -v bam=$bam 'BEGIN { print "new\ngenome hg19\nload "bam"\nsnapshotDirectory ./snapshots/" } { gsub("chr", "", $1); if(NR > 1) print "goto "$1"\t"$2-10"\t"$2+10"\nsort base\ncollapse\nsnapshot"; }' $bed |
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
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
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/Rscript | |
test_read_write <- function() { | |
iris_copy <- read.table("iris_copy.tsv", head = T, sep = "\t") | |
iris_copy$Sepal.Length <- iris$Sepal.Length + 1 | |
write.table(iris_copy, "iris_copy.tsv", row.names = F, quote = F, | |
sep = "\t") | |
} | |
create_original_modified_iris <- function() { |
##Exiting from programs Exceptions aren't the only way. There are times when cerr/exit are acceptable, but personally, I almost never do that. The answer to your question is kind of long.
I tend to think like a library developer (i.e., code reuse is always on my mind). If your function calls exit(), that makes it impossible to use in other contexts that might not care about whatever error condition is causing you to want to exit. "But what about contexts where the error is truly unrecoverable?" In those cases, exit() inhibits debugging, use abort() instead. This should be reserved for truly egregious errors--those which you'll want to get a core dump
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
#Generate the FASTA | |
rm -f test.fa; samtools faidx ../../regtools-test/chr22.fa 22:41475000-41585000 > test.fa | |
sed "1s/.*/>22/" test.fa > new_test.fa; rm -f test.fa; mv new_test.fa test.fa #fix the header | |
samtools faidx test.fa | |
#Generate the GTF | |
rm -f test.gtf; awk -F"\t" '$4> 41480000 && $5 < 41580000 { OFS = "\t"; $4 = $4 - 41475000 + 1; $5 = $5 - 41475000 + 1; print }' ../../regtools-test/genes_chr22.gtf > test.gtf | |
#Create the junctions.bed | |
rm -f test_junctions.bed; awk '$1==22 && $2> 41480000 && $3 < 41580000 { OFS = "\t"; $2=$2 - 41475000 + 1; $3 = $3 - 41475000 + 1; $7=$2; $8=$3; print }' hcc1395_junctions.bed > test_junctions.bed |