Skip to content

Instantly share code, notes, and snippets.

View Vini2's full-sized avatar
🧬
Focusing

Vijini Mallawaarachchi Vini2

🧬
Focusing
View GitHub Profile
-- Create Member table
CREATE TABLE member(
member_id INT PRIMARY KEY,
name VARCHAR (50) NOT NULL,
date_of_birth DATE NOT NULL
);
-- Add records to Member table
INSERT INTO member VALUES (1, 'Alice', '1995-03-03');
INSERT INTO member VALUES (2, 'Bob', '1993-03-05');
@Vini2
Vini2 / Label_Propagation_Demo.ipynb
Created March 6, 2020 04:03
Label propagation demo for a simple graph
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Vini2
Vini2 / analyse.py
Last active March 11, 2020 07:24
Multinomial NB Classification of Tweets
# NLP imports
import nltk
from nltk.tokenize import sent_tokenize
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from nltk.stem import PorterStemmer
# sklearn imports
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import TfidfVectorizer
@Vini2
Vini2 / getdata.py
Created March 1, 2020 09:09
Pulling twitter data
import tweepy as tw
import pandas as pd
import json
# App Auth
consumer_key = 'XXX'
consumer_secret = 'XXX'
access_key = 'XXX'
access_secret = 'XXX'
@Vini2
Vini2 / Visualise_Graph_Demo.ipynb
Last active September 23, 2021 07:47
Visualising Graph Data with python-igraph
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Import modules
from Bio import Phylo
from Bio.Phylo.TreeConstruction import DistanceCalculator
from Bio.Phylo.TreeConstruction import DistanceTreeConstructor
from Bio import AlignIO
# Read the sequences and align
aln = AlignIO.read('msa.phy', 'phylip')
# Print the alignment
# Import Clustal Omega wrapper
from Bio.Align.Applications import ClustalOmegaCommandline
# Define input file
in_file = "/Users/vijinimallawaarachchi/Documents/Python/Acanthaster_planci_Gnomon.fsa"
# Define output file
out_file = "aligned.fasta"
# Get the command for Clustal Omega
>gnl|GNOMON|17969.m Partial model predicted by Gnomon on Acanthaster planci unplaced genomic scaffold, OKI-Apl_1.0 oki_scaffold1752, whole genome shotgun sequence (NW_019093106.1)
AAGCAAAAAGCAGAGAAGGAGAAACCAGGTTTCCTTAGTAGGATCCACCAGGCATTCAGCTTTGAAGAGG
AACAGTCCAGGGATGATGAGCAGGATAGTCAAGACAGCGAGTCCGAGGATGGGAGTATTGACGAAGACCC
TGAGGGCAATGAAAACACGGTGGATCCAATCGACTGTTTGAGTGCCCCACGTGCTGTTGTCACCAAAGAA
GAGCTCATCACTGAGGAG
>gnl|GNOMON|70594930.m Model predicted by Gnomon on Acanthaster planci unplaced genomic scaffold, OKI-Apl_1.0 oki_scaffold1731, whole genome shotgun sequence (NW_019093085.1)
CAAGAACAGTGGATGAAGAAAACAGCAGGCGATAGCAGCGTGGTTGGCGCCTTGCCCCTGGGCTCATCTT
CTAGCATCACTGCCCTGATACGCGAAAGCAGCGTGGTTGGTCCCTTCCTGTGGGCTCATCTTCTGGCATC
ACTGCCCTGATAATGTAAGGCGGTAGCAGCGAGGTTGGTCCCCTGCCTGTGGGCTCATCTTCTGGAATCA
CCACCCT
# Import pairwise2 module
from Bio import pairwise2
# Import format_alignment method
from Bio.pairwise2 import format_alignment
# Define two sequences to be aligned
X = "ACGGGT"
Y = "ACG"
# Import pairwise2 module
from Bio import pairwise2
# Import format_alignment method
from Bio.pairwise2 import format_alignment
# Define two sequences to be aligned
X = "ACGGGT"
Y = "ACG"