This file contains 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/sh | |
# Convert a TSV (tab) file to a CSV (comma) file | |
# | |
# Please note that this will surround all values with | |
# double-quotes. All other double-quotes will be escaped. | |
# | |
# Example usage: | |
# ./tab2csv.sh myfile.tsv > myfile.csv |
This file contains 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
# Sorts a file by chromosomal position | |
# | |
# Input file must have the following format: | |
# - Column 1: chromosome (e.g. chr1, chr10 *OR* 1, 10) | |
# - Column 2: start position (e.g. 4325484) | |
# - All other columns can be ordered in any way | |
# | |
# Input file sample: | |
# chr17:5432542:G>A ......... | |
# 17:5432542:G>A ......... |
This file contains 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
# Swaps the nucleotide sequence to the opposite strand | |
# | |
# This means if the sequence is on the forward strand, | |
# then the function will return the corresponding sequence | |
# on the reverse strand, and vice versa. | |
# | |
# For example: | |
# Original: TCCAGACAC | |
# Swapped: GTGTCTGGA | |
# |
This file contains 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 | |
# Split a file into N parts | |
# | |
# Each resulting file will have a .ptXX suffix | |
# | |
# Example - split file into 30 parts: | |
# ./parts.sh myfile.txt 30 | |
split -dl$((`wc -l < $1`/$2+1)) $1 $1.pt |
This file contains 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 | |
## | |
# Remove Duplicates in a VCF | |
# | |
# A duplicate variant is when multiple records have the same | |
# CHROM, POS, REF, and ALT. This script will pick *one* of the | |
# duplicate variants and discard the rest. The record that is | |
# picked is the one that comes first in sorting order. | |
# |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
/** | |
* STEP 1: Write queries to import files into an SQLite database | |
**/ | |
/* Set file input mode */ | |
.mode tabs | |
/* Import tables from TSV files */ | |
.import file1.tsv table1 | |
.import file2.tsv table2 |
This file contains 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 -wFf <(cut -f__COL1__-__COL2__ __FILE__ | sort | uniq -d) __FILE__ |
This file contains 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
ALTER TABLE `__TABLE__` | |
ADD `__COL__` | |
VARCHAR(255) NULL | |
DEFAULT NULL | |
COMMENT '__COMMENT__' | |
AFTER `__ANOTHER_COL__` ; |
OlderNewer