Skip to content

Instantly share code, notes, and snippets.

View sacdallago's full-sized avatar
🏖️
par-time

Christian Dallago sacdallago

🏖️
par-time
View GitHub Profile
@sacdallago
sacdallago / Readme.md
Last active July 12, 2020 15:46
cd-hit clusters to CSV of representatives

First you need to run clstr2txt (it comes with cd-hit). E.g.:

clstr2txt.pl BindingDBTargetSequences_100.fa.clstr > BindingDBTargetSequences_100_clusters.txt

Then, run the python code below, but change the variables (input and output file names):

@sacdallago
sacdallago / index.html
Created March 20, 2019 08:47
D3 two-valued heatmap
<!-- Code from d3-graph-gallery.com -->
<!DOCTYPE html>
<meta charset="utf-8">
<!-- Load d3.js -->
<script src="http://d3js.org/d3.v4.js"></script>
<!-- Create a div where the graph will take place -->
<div id="my_dataviz"></div>
@sacdallago
sacdallago / README.md
Last active March 19, 2019 07:33
Hippie entry name to uniprot ID

Prerequisites:

Node.js has to be installed. Also parsjs (get it via npm i -g parsjs).

Steps:

  1. Download latest hippie release (the TAB version)
  2. Run parsjs -n -s hippie_current hippie_current.txt
  3. Run node unique.js
  4. Copy the content of current_hippie_identifiers.txt on the uniprot mapping service (https://www.uniprot.org/mapping/)
#!/bin/bash
find . -type f -name '*.trec' -print0 | while IFS= read -r -d '' file; do
echo $file
done > files_to_convert
#!/bin/bash
find . -type f -name '*_converted.avi' -print0 | while IFS= read -r -d '' file; do
echo $file
done > files_converted
#!/bin/bash
while read i; do
echo "------------"
echo $i
ffmpeg -loglevel error -hwaccel vdpau -n -i "$i" -c:a copy -c:v copy "${i/.trec}_converted.avi"
echo "------------"
done < ./files_to_convert
% Compute power of a number
power(1,0,_).
power(X,Y,C):- X1 is X+X, Y1 is Y-1, powerUp(X1,Y1,C).
powerUp(X,1,X).
powerUp(X,Y,C) :- X1 is X+X, Y1 is Y-1, powerUp(X1,Y1,C).
% Sum elements in list.
sum([],0).
@sacdallago
sacdallago / Prolog Project
Last active January 1, 2016 02:58
Prolog Project
% Exercise one, write code to veryfiy second list is duplicate of first and presents same char at end of first list twice.
% ---------------------------------------------------------------------------------------------------------------FINISHED.
duplicar_ultimo([],[]).
duplicar_ultimo(L1,L2):-duplicar_ultimo_accessory(L1,L2).
duplicar_ultimo_accessory([X],[X,X]).
duplicar_ultimo_accessory([X|L1],[X|L2]):-duplicar_ultimo_accessory(L1,L2).