Skip to content

Instantly share code, notes, and snippets.

@rmrao
rmrao / countseqs
Created June 12, 2023 21:26
Count the number of sequences or the total number of amino acids in a fasta file
#!/bin/bash
count_nseqs() {
file="$1"
if [ -f "$file" ]; then
if [[ "$file" == *.gz ]]; then
count=$(zcat "$file" | grep -c "^>")
else
count=$(grep -c "^>" "$file")
fi
@rmrao
rmrao / .pymol_functions.py
Last active May 31, 2022 16:20
My pymol rc script
from pymol import preset, cmd
from glob import glob
from os.path import sep, basename
from pathlib import Path
def bns(sel: str = "bb."):
preset.ball_and_stick(selection=sel, mode=1)
@rmrao
rmrao / smithwaterman_torch.py
Last active October 26, 2021 14:12
Initial implementation of vecorized smithwaterman in torch
from typing import Tuple
import torch
import torch.nn.functional as F
import itertools
from timeit import default_timer as timer
class SoftmaxWeightedMean(torch.autograd.Function):
@staticmethod
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rmrao
rmrao / auc_extract.ipynb
Created May 8, 2020 21:59
Various ways of extracting info from ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.