Skip to content

Instantly share code, notes, and snippets.

View bmpvieira's full-sized avatar

Bruno Vieira bmpvieira

  • Lifebit
View GitHub Profile

Setting up Crashplan on FreeNAS Goals

Be able to backup from the FreeNAS box to offsite Crashplan Central. Allow incoming Crashplan backups from other devices. Install the CrashPlan plugin

Install the plugin into a jail: Click on Plugins, then the Available tab, the "crashplan" line and finally the Install button. Once the installation completes, on the left tree, expand Plugins and click on CrashPlan. Accept the Java EULA. Start the Crashplan plugin: Plugins->Installed and make sure the Crashplan plugin is in the "ON" position.

@bmpvieira
bmpvieira / r-base-lea.sh
Created February 25, 2015 09:14
Setup R with LEA package (because it segfaults on OSX) http://membres-timc.imag.fr/Olivier.Francois/LEA/software.htm
# Setup R with LEA package (because it segfaults on OSX)
# http://membres-timc.imag.fr/Olivier.Francois/LEA/software.htm
# Run one by one the following commands
brew install boot2docker docker
boot2docker init
boot2docker up
docker run -it -v ~/Downloads:/Downloads r-base
docker run -it r-base
install.packages("/Downloads/LEA_0.2.tar", repos = NULL, type = "source")
@bmpvieira
bmpvieira / nodejs-install.sh
Created February 10, 2015 14:03
Script to do one-line non-root install of Node.js on Ubuntu and OSX
#!/bin/bash
# Script to do one-line non-root install of Node.js on Ubuntu and OSX
# Depends on curl which sometimes isn't preinstalled on Ubuntu, so do:
# sudo apt-get install curl
INSTALL_PATH=$HOME/.nodejs
# Install n (Node.js versions manager)
cd /tmp
echo "Downloading n (Node.js versions manager)"
@bmpvieira
bmpvieira / dnadigest-private-genomes.md
Last active August 29, 2015 14:10
DNAOpenSci - How do you share and control/limit the data

How do you share and control/limit the data

How to limit the data:

  • Masking the mendelian variants / restrict access to particular region of genome
  • Aggregate the information to the population level
  • Encrypt the data to still keep the patterns but not disclose the raw data

Issues:

  • We might still get privacy concerning information from non-mendelian variants
  • Population information might not be relevant for individuals (complex genes interactions, etc)
  • Gets in the way of the research, and personalised medicine
@bmpvieira
bmpvieira / filterRepeats.js
Created November 21, 2014 15:10
Filter number of repeated elements in a text file list based on minimum number
#!/usr/bin/env node
// Usage: ./filterRepeats.js <minimum> <file path>
// Example: ./filterRepeats.js 10 list.txt
var fs = require('fs')
var min = process.argv[2]
var listPath = process.argv[3]
var list = fs.readFileSync(listPath, 'utf8').split('\n')
var counter = {}
list.forEach(count)
@bmpvieira
bmpvieira / aws-blast-msc.sh
Last active August 29, 2015 14:09
Setup an Amazon Instance (16 CPU, 122 GB RAM, 320 GB SDD) with Ubuntu 14.04 and NCBI BLAST+ from Bio-Linux 8
# Get Amazon AWS Command Line tool
brew install awscli
# Setup instance
aws configure # key, secret, eu-west-1, table
aws ec2 create-key-pair --key-name MyKeyPair --query 'KeyMaterial' --output text > MyKeyPair.pem
aws ec2 run-instances --image-id ami-f0b11187 --instance-type r3.4xlarge --region eu-west-1 --key-name MyKeyPair
aws ec2 describe-instances
aws ec2 authorize-security-group-ingress --group-id sg-86bfxxxx --protocol tcp --port 22 --cidr 0.0.0.0/0
getCountryAgainstElevation <- function(genus) {
table1 <- read.csv('http://bmpvieira.github.io/temp/alabamaants-myrmicinaepheidole_obscurithorax.csv', h=T)
table2 <- read.csv('http://bmpvieira.github.io/temp/allantwebants-myrmicinaesolenopsis_invicta.csv', h=T)
mergedtable <- # put code here to merge table1 and table2
# Once you have the merged table:
# 1. Subset the table to a new one with only the rows that match the Genus provided by the argument of the function
# 2. Use the function table() to get Country against Elevation
# e.g., something like table(countryColumn, elevationColumn)
# 3. return the resulting table
# The output should look like this:
getCoordinates <- function(genus) {
table1 <- read.csv('http://bmpvieira.github.io/temp/alabamaants-myrmicinaepheidole_obscurithorax.csv', h=T)
table2 <- read.csv('http://bmpvieira.github.io/temp/allantwebants-myrmicinaesolenopsis_invicta.csv', h=T)
mergedtable <- # put code here to merge table1 and table2
# Once you have the merged table:
# 1. Subset the table to a new one with only the rows that match the Genus provided by the argument of the function
# 2. Limit the new one to only the columns DateCollectedStart, LocLatitude and LocLongitude.
# 3. Remove rows that have NA values
# 4. return the resulting table
}
@bmpvieira
bmpvieira / bionode-fastq-solenopsis.sh
Created October 28, 2014 16:22
bionode - Get all reads FASTQ for Solenopsis invicta assembly
bionode-ncbi search genome Solenopsis invicta | tool-stream extractProperty assemblyid | bionode-ncbi search assembly - | tool-stream extractProperty uid | bionode-ncbi link assembly bioproject - | tool-stream extractProperty destUID | bionode-ncbi link bioproject sra - | tool-stream extractProperty destUID | bionode-ncbi search sra - | grep -e 20kb -e 8kb| tool-stream extractProperty uid24418
# Gives:
#23917
#23918
#23919
#23920
#23951
#23952
#23953
@bmpvieira
bmpvieira / index.js
Created September 6, 2014 18:39
requirebin sketch
var fasta = require('bionode-fasta')
var data = ">contig1\nAGTCGATCTACGTA\nATGATCATGCGTAC\n>contig2\nAGTACGTACTGCATG\ACTGCATCG\n"
var parser = fasta.obj() // Returns objects
parser.write(data)
parser.end()
parser.on('data', function(data) { console.log(data) })