Skip to content

Instantly share code, notes, and snippets.

View IgorFobia's full-sized avatar

Fabio Gori IgorFobia

  • The Hague
View GitHub Profile
@IgorFobia
IgorFobia / concatenate_sequences_fasta.sh
Last active April 26, 2016 12:06
Concatenate the sequences of a multi-FASTA file and make a new FASTA file with the new sequence
#!/bin/bash
# Concatenate the sequences of a multi-FASTA file and make a new FASTA file with the new sequence
INPUT_FILE=$1
OUTPUT_FILE=$2
(echo ">concantenated"; grep -i '^[ACGTURYKMSWBDHVNX\-]*$' $INPUT_FILE | tr -d '\n' | fold -w 60; echo) > $OUTPUT_FILE
@IgorFobia
IgorFobia / roll_fasta.py
Created August 5, 2013 00:30
Roll a FASTA file of a circular sequence, changing the starting base of the FASTA sequence
#!/usr/bin/python
# Roll a FASTA file of a circular sequence, changing the starting base of the FASTA sequence to new_startN
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
import sys
import os
import numpy as np
from scipy.stats import chisqprob, chisquare
def gtest(f_obs, f_exp=None, ddof=0):
"""
http://en.wikipedia.org/wiki/G-test
The G test can test for goodness of fit to a distribution
Parameters