Skip to content

Instantly share code, notes, and snippets.

@marpiech
marpiech / 1000-genomes-download.sh
Last active July 26, 2021 07:58
1000-genomes-download.sh
for i in {1..22} X
do
wget http://ftp.1000genomes.ebi.ac.uk/vol1/ftp/data_collections/1000_genomes_project/release/20190312_biallelic_SNV_and_INDEL/ALL.chr"$i".shapeit2_integrated_snvindels_v2a_27022019.GRCh38.phased.vcf.gz
wget http://ftp.1000genomes.ebi.ac.uk/vol1/ftp/data_collections/1000_genomes_project/release/20190312_biallelic_SNV_and_INDEL/ALL.chr"$i".shapeit2_integrated_snvindels_v2a_27022019.GRCh38.phased.vcf.gz.tbi
done
wget ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/release/20130502/integrated_call_samples_v3.20130502.ALL.panel
bcftools concat $(ls *.vcf.gz | grep ALL | sort -k1,1V | tr -s '\n' ' ' | sed 's/ *$//g') | bgzip -c > 1kg.merged.vcf.gz
@marpiech
marpiech / dbsnp-download.sh
Last active July 23, 2021 14:49
Download dbsnp vcf
#!/bin/bash
# Download dbsnp and update chromosome names
export DBSNP_VERSION=155
wget "https://ftp.ncbi.nih.gov/snp/archive/b$DBSNP_VERSION/VCF/GCF_000001405.39.gz"
wget "https://ftp.ncbi.nih.gov/snp/archive/b$DBSNP_VERSION/VCF/GCF_000001405.39.gz.tbi"
wget "https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/001/405/GCF_000001405.39_GRCh38.p13/GCF_000001405.39_GRCh38.p13_assembly_report.txt"
cat GCF_000001405.39_GRCh38.p13_assembly_report.txt | \
ffmpeg -i Desktop/appvideo2.mp4 -r 30 -strict -2 -vf scale=900:1200 Desktop/appvideo-ipad-2.mp4
ffmpeg -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -i Desktop/appvideo-ipad-1.mp4 -shortest -c:v copy -c:a aac Downloads/appvideo-ipad-1.mp4
@marpiech
marpiech / Bioinfo :: python :: convert_scientific
Created May 15, 2014 13:54
The script converts scientific notation to float in VCF files
import re
import sys
pattern="=[0-9]\.[0-9]*E[+-][0-9]*;"
for line in sys.stdin:
if(re.search(pattern, line)):
m = re.search(pattern, line)
g = "=" + str(float(m.group(0)[1:-1])) + ";"
line = re.sub(pattern, g, line, 0)
@marpiech
marpiech / Bioinfo :: snpsift :: scientific error
Created May 15, 2014 13:51
Snpsift error caused by scientific notation
Exception in thread "main" java.lang.RuntimeException: Cannot compare 'String' to 'Float'
at ca.mcgill.mcb.pcingola.snpSift.lang.expression.Expression.compareTo(Expression.java:51)
at ca.mcgill.mcb.pcingola.snpSift.lang.condition.Lt.eval(Lt.java:21)
at ca.mcgill.mcb.pcingola.snpSift.lang.condition.Or.eval(Or.java:18)
at ca.mcgill.mcb.pcingola.snpSift.SnpSiftCmdFilter.evaluate(SnpSiftCmdFilter.java:191)
at ca.mcgill.mcb.pcingola.snpSift.SnpSiftCmdFilter.run(SnpSiftCmdFilter.java:356)
at ca.mcgill.mcb.pcingola.snpSift.SnpSiftCmdFilter.run(SnpSiftCmdFilter.java:322)
at ca.mcgill.mcb.pcingola.snpSift.SnpSift.run(SnpSift.java:233)
at ca.mcgill.mcb.pcingola.snpSift.SnpSift.main(SnpSift.java:60)
# removeVcfInfoField.py script removes selected field from the INFO inside vcf
# usage: python removeVcfInfoField.py [vcf file] [name of the field] > [output vcf]
#
# example: python removeVcfInfoField.py input.vcf AO > output.vcf
import sys
def removeField(line, field):
values = line.split()
INFO = values[7]
@marpiech
marpiech / extend_bed.sh
Created February 27, 2014 10:34
Extending the coordinates entries within a bed file
# create sample bed file
echo -e "chr1\t1000\t2000\nchr2\t1000\t2000" > sample.bed
# use bedtools to extend bed by 100 bases each side
# use -l to extend on the left or -r on the right
bedtools slop -i sample.bed -g ~/tools/bedtools/genomes/mouse.mm9.genome -b 100
# alternatively use bedops
# use --range argument to specify LEFT:RIGHT extension
bedops --range 100:100 --everything sample.bed
@marpiech
marpiech / Bioinfo :: tmap
Created July 3, 2013 07:58
mapping with tmap
tmap mapall -f /tmp/tmap/genome.fa -r /results/analysis/output/Home/Auto_user_PR1-10-Ion_RNA_-_Whole_Transcriptome_-_neurons_32_024/plugin_out/FastqCreator_out/RNA_Barcode_None_001_R_2013_06_27_09_04_01_user_PR1-10-Ion_RNA_-_Whole_Transcriptome_-_neurons_Auto_user_PR1-10-Ion_RNA_-_Whole_Transcriptome_-_neurons_32.fastq -i fastq stage1 map4 > tmap.sam
<dependencies>
<!-- Spring 3 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<!--?xml version="1.0" encoding="UTF-8"?-->
<project xsi:schemalocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelversion>4.0.0</modelversion>
<groupid>org.cremag</groupid>
<artifactid>spring-tutorial</artifactid>
<version>1.0</version>
<name>Spring security</name>