Skip to content

Instantly share code, notes, and snippets.

View neksa's full-sized avatar

Alexander Goncearenco neksa

View GitHub Profile
@neksa
neksa / add_bfactor.py
Created September 15, 2022 18:17
Pattern for adding values to b-factors with biotite
from biotite.structure.io.pdb import get_structure, PDBFile
#################################################
# residue id, atom name : value in [0..1] domain
# input data
values = {
(1, 'CA'): 0.5,
(2, 'C'): 0.8,
}
@neksa
neksa / conda_env_export.sh
Created August 20, 2020 12:38
export conda packages to environment.yml
conda env export --no-builds | grep -v "prefix" > environment.yml
'1': 5mC>T
'2': AID/APOBEC
'13': AID/APOBEC
'3': HR DDR defect
'4': Tobacco
'10a': Polymerase epsilon
'10b': Polymerase epsilon
'14': Polymerase epsilon + MMR
'15': MMR
'7b': UV light
# from https://www.mdanderson.org/documents/Labs/Wood-Laboratory/human-dna-repair-genes.html
BER:
- UNG
- SMUG1
- MBD4
- TDG
- OGG1
- MUTYH
- MYH
# FROM https://habr.com/ru/post/494546/
#Траектория частицы
Track = True
#длина траектории
Track_time = 5
#Гравитационная постоянная
G = 5
import argparse
class Test():
def __init__(self):
"""INITIALIZE PARSER"""
parser = argparse.ArgumentParser()
parser.add_argument('--name', type=str, required=False, default='World')
parser.add_argument(
@neksa
neksa / factorize.py
Created March 4, 2019 01:40
matrix factorization
#!/usr/bin/python
#
# Created by Albert Au Yeung (2010)
#
# An implementation of matrix factorization
#
try:
import numpy
except:
print "This implementation requires the numpy module."
@neksa
neksa / get_context_ensembl.py
Created September 19, 2018 21:10
Get DNA context for mutations from Ensembl server
import multiprocessing
import json
import requests
import urllib
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
def mp_ensembl_worker(raw_mutations_chunk):
""" Helper function for ENSEMBL API call """
%matplotlib inline
import seaborn as sns
sns.set(style="ticks")
df = sns.load_dataset("iris")
sns.pairplot(df, x_vars=["sepal_length", "sepal_width"], y_vars=["petal_length", "petal_width"], markers=".", kind="reg")
# round(df.corr()**2, 2)
sns.heatmap(df.corr(), cmap=sns.color_palette("RdBu_r", 7), annot=True, fmt=".2f", center=0, vmin=-1.0, vmax=1.0)
import requests
import json
# MUTAGENE_URL = "https://www.ncbi.nlm.nih.gov/research/mutagene"
# MUTAGENE_URL = "https://dev.ncbi.nlm.nih.gov/research/mutagene"
MUTAGENE_URL = "https://mwebdev2/research/mutagene"
# MUTAGENE_URL = "http://localhost:5000"
def get_motifs(fname, assembly=37):