Skip to content

Instantly share code, notes, and snippets.

@almasaeed2010
almasaeed2010 / use_protein_id_as_seq_name.php
Created January 30, 2019 19:07
Uses the [protein_id=*] to extract the protein name.
<?php
if ($argc <= 1) {
echo "Please supply a file name\n";
exit(1);
}
$input = $argv[1];
$file = fopen($input, 'r');
while ($line = fgets($file)) {
@almasaeed2010
almasaeed2010 / biomaterials_to_matrix.py
Created November 9, 2018 14:38
Convert ht_seq output of biomaterial files to a matrix
import sys
if len(sys.argv) < 2:
print ('Please provide a file name')
exit(1)
files = sys.argv[1:]
matrix = {}
biomaterials = {}
genes = {}
@almasaeed2010
almasaeed2010 / blast-top-25.py
Last active September 24, 2019 13:09
Sort BLAST by e-value and keep only the top 25 hits
#!/data/apps/python/3.2.1/bin/python
import re
import sys
import getopt
import heapq
import xml.etree.ElementTree as ET
from pprint import pprint
input_xml = sys.argv
<?php
/**
* Add a fasta line to a file
*
* @param $FILE file handle
* @param $uniquename the unique identifier
* @param $data any data on the first line after the unique identifier
* @param $sequence the sequence to print under the first line
*/
function fputfasta($FILE, $uniquename, $data, $sequence) {
CREATE TABLE IF NOT EXISTS `continents` (
`code` CHAR(2) NOT NULL COMMENT 'Continent code',
`name` VARCHAR(255),
PRIMARY KEY (`code`)
) ENGINE=InnoDB;
INSERT INTO `continents` VALUES
('AF', 'Africa'),
('AS', 'Asia'),
('EU', 'Europe'),