Fuente: https://gist.github.com/manwar
Ideas y código para problemas de genómica de plantas, biología computacional y estructural
Hi, today I just want to share a tool to prepare nice pictures from
genomic data files. It can be used straight-forward with some
commands and arguments, but an interesting point about this
is that actually uses an intermediate configuration file which can be
smoothly edited. We will go deeper on that later. A remarkable fact
is that is easy to use, as well as manageable in huge amount of
parameters, but also very well described, intuitive, and overwhelming
in details.
First, find here the documents and all guides of usage, and the
reference paper as well.
As mentioned, it takes different output files from several omics, from
widely used bed or FASTAs types, MAFs, GTFs… up to some others
(which I have not tested yet) such as HiC matrix, or epigenetic
annotation Epilogos.
It is coded in python. It can be easily installed using pip
$ pip install pyGenomeTracks
All dependencies should be automatically installed. I personally
recommend having a conda environment for pyGenomeTracks.
To use it, pyGenomeTracks needs a configuration file describing the
requirements for the tracks included in the projected image. Something
like the “instructions” or “cooking recipe”.
Using terminal command lines, it is possible to build this file. Basic
arguments are input files, from which the plot will grab the data and
build the plot, and the output tracks.ini file. This is the configuration file,
and will be shaped according to the type of file that you are providing as
input.
$ make_tracks_file --trackFiles <bigwig file> <bed file> etc. -o tracks.ini
Once you have the configuration file, go for the command which will
generate the image.
$ pyGenomeTracks --tracks tracks.ini -o image.png
Depending on the plot type, you may have to provide some other
arguments. For instance, if your input is a .bed file, you maybe want to
capture a specific region:
$ make_tracks_file --trackFiles <bed file> --region chr1:1000000-4000000
-o tracks.ini
And some other stuff such as title, font, width/height or resolution. In
summary, you can re-use a single configuration file to try and try to plot
as many times your data without re-editing the parameters you probably
expended some time before optimizing them.
And, about this time to prepare the parameters about the plot, here it comes
the most interesting part. You can edit the instruction file from a command
line, but, since it is at the end a text file that stores parameters in each line,
it allows building it manually. Having the guide from all parameters of a plot
types, and keeping an intuitive structure, you are able to control a wide set
of variables, colours, styles… And it is even possible to stack plots,
increasing the possibilities up to the limit of your imagination.
I don’t want to make this post longer. Almost forgot, I’m Joan, a training
researcher. Developing some tasks, I wasn’t able to find an adequate tool to
quickly plot some haplotypes I am working on, and I faced pyGenomeTracks.
Have a look at one of my beautiful and colourful images, as an example.
Hope to write often here!
Hola,
hoy explicaré cómo he configurado ColabFold para ejecutarlo en hardware local, en concreto en una máquina con Ubuntu 20.04 que tiene una CPU Xeon CascadeLake Silver 4210R y una tarjeta gráfica NVIDIA RTX 3090. Puedes leer más sobre AlphaFold y ColabFold aquí o en este vídeo.
1) Necesité actualizar cuda, en concreto con la versión 11.8, algo que hice como se explica aquí:
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub
sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
sudo apt update
sudo apt install cuda-toolkit-11-8
2) Tras reinicar, actualicé la variable de ambiente $PATH añadiendo estas líneas a mi fichero .bashrc:
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
3) Seguí las instrucciones para Linux en https://github.com/YoshitakaMo/localcolabfold?tab=readme-ov-file#for-linux . En mi caso tardó unos pocos minutos y sumó 15G al disco duro.
4) Probé que todo funciona con un fichero FASTA qee contiene varias secuencias, guardando los resultados en la carpeta multi/ :
colabfold_batch test.multi.faa multi/Ahora resumo los resultados que obtuve:
Hasta pronto,
Bruno
PD Cuando acabes de instalar deberías tener algo similar en tu fichero $HOME/.bashrc:
Cuando no vayas a usar colabfold comenta estas líneas para usar perl y python del sistema
PD2 Me comentan colegas de ULiverpool que haciendo 800-900 MSAs al día en https://api.colabfold.com no han tenido problemas
PD3 Si no reconoce tu GPU mira posibles soluciones en https://github.com/YoshitakaMo/localcolabfold/issues/210
PD4: Puedes bloquear la versión de CUDA que hayas instalado con algo como:
sudo apt-mark hold cuda-toolkit-11-8
De vez en cuando en este blog toca escribir sobre Perl, uno de los lenguajes que usamos en nuestro trabajo, en mi caso el que más uso la verdad.
Voy a traducir y resumir https://two-wrongs.com/why-perl , porque creo que plasma mi experiencia bastante bien [en negrita mis comentarios]:
"A veces me preguntan porqué uso tanto el Perl. No soy acaso fan de los lenguajes fuertemente tipados? Sí. Pídeme que escriba algo que sepa a ciencia cierta que se convertirá en un gran sistema y elegiré un lenguaje fuertemente tipado sin duda [...]. Pero la mayor parte de lo que escribo nunca se convertirá en un gran sistema. Esto es lo que Perl hace bien:
Estos requerimientos están ordenados por prioridad, siendo el primero el más importante. Cuando quiero hacer un prototipo rápidamente no quiero que mi primera tarea sea 'Primero instala el ambiente ...'. Como los prototipos suelen usarse más allá de lo que inicialmente pensamos, es importante que sea posible escribir software en ese lenguaje que se pueda mantener y que funcione mientras haya personas interesadas en usarlo.
En general estoy bastante de acuerdo con esta carta de presentación del lenguaje. Creo que el principal problema de Perl es que su extrema flexibilidad permite escribir programas que pueden ser difíciles de leer por otros, queda en tu mano documentar y estructurar bien el código para que eso no ocurra,
Bruno
Hola,
si programas en Python o usas software escrito en este lenguaje es posible que te hayas enfrentado a la necesidad de usar una versión concreta que no tienes instalada en tu sistema, por ejemplo la versión 3.7.9. En esta entrada explico una manera de resolver este problema en Linux con ayuda de pyenv, que de hecho te permite tener múltiples versiones en paralelo, cada una con su propio espacio de dependencias. Espero que aquí quede más claro que en esta otra entrada.
Lo primero que necesitas es una partición en tu disco para pyenv:
export
PYENV_ROOT=
"/mi/particion/.pyenv"
curl https:
//pyenv
.run |
bash
# install python 3.7.9 (EOF June 2023)
pyenv
install
3.7.9
Si todo va bien ahora debes añadir las siguientes líneas al final de tu fichero .bashrc:
if [[ -d " ]]; then export PYENV_ROOT= "
export PATH= "$PYENV_ROOT/bin:$PATH" eval "$(pyenv init --path)" eval "$(pyenv virtualenv-init -)" fi |
Ahora ya puedes crear un entorno virtual sobre esta versión de Python, por ejemplo 'proyectox', e instalar dependencias específicas de ese proyecto:
pyenv virtualenv 3.7.9 proyectox pyenv local proyectox pip install --upgrade pip # dependencias, tras clonar https://github.com/proyextox (ejemplo, no existe) pip install -r proyectox/requirements .txt |
Finalmente, ya puedes trabajar dentro de ese entorno:
pyenv local proyectox
Hasta pronto,
Bruno
Hi, Carlos Cantalapiedra and me recently put together teaching material about scripting in the linux terminal.
The material can be found at repository https://github.com/eead-csic-compbio/scripting_linux_shell
There are five sessions and the goal is for you to learn the basics of the Linux shell and scripting for data sciences such as genomics and plant breeding:
session | title | required time | URL | |
---|---|---|---|---|
0 | Setup | prior to course | session 0 | |
1 | Linux basics and files | 2h | session 1 | |
2 | Processes and scripts | 2h | session 2 | |
3 | Parsing with regular expressions | 2h | session 3 | |
4 | Perl one-liners | 2h | session 4 | |
5 | Advanced scripts | 2h | session 5 |
Figure of the standard streams, taken from https://en.wikipedia.org/wiki/Standard_streams
If you spot errors please send pull requests, hope this helps some of you out there,
Bruno
PD si prefieres aprender en español echa un vistazo a https://github.com/vinuesa/intro2linux
sudo curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
# agrego pyenv a .bashrc
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
# instalo python 3.6 y actualizo pip
pyenv install 3.6.0
pyenv local 3.6.0
pip install --upgrade pip
pip install jupyter
# creo un ecosistema/virtualenv al que llamo DL
pyenv virtualenv 3.6.0 DL
pyenv shell DL
# instalo las dependencias del libro de Jon Krohn
# en mi caso tuve que poner TMPDIR=/particion_grande/ antes de pip
# porque se llenaba la particion /tmp
pip install tensorflow
pip install keras
# otra librería de aprendizaje prodfundo alternativa a keras & tensorflow
pip install mxnet
$ pyenv shell DL
jupyter nbconvert --to script deep-learning-illustrated/notebooks/regression_in_keras.ipynb
python deep-learning-illustrated/notebooks/regression_in_keras.py
Model: "sequential_1"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
dense_1 (Dense) (None, 32) 448
_________________________________________________________________
batch_normalization_1 (Batch (None, 32) 128
_________________________________________________________________
dense_2 (Dense) (None, 16) 528
_________________________________________________________________
batch_normalization_2 (Batch (None, 16) 64
_________________________________________________________________
dropout_1 (Dropout) (None, 16) 0
_________________________________________________________________
dense_3 (Dense) (None, 1) 17
=================================================================
Total params: 1,185
Trainable params: 1,089
Non-trainable params: 96
Train on 404 samples, validate on 102 samples
Epoch 1/32
8/404 [..............................] - ETA: 30s - loss: 865.3292
80/404 [====>.........................] - ETA: 2s - loss: 720.8563
152/404 [==========>...................] - ETA: 1s - loss: 644.4068
232/404 [================>.............] - ETA: 0s - loss: 602.0502
304/404 [=====================>........] - ETA: 0s - loss: 578.7887
376/404 [==========================>...] - ETA: 0s - loss: 588.8638
404/404 [==============================] - 1s 2ms/step - loss: 583.1135 - val_loss: 786.3666
....
8/404 [..............................] - ETA: 0s - loss: 18.8216
88/404 [=====>........................] - ETA: 0s - loss: 34.8777
168/404 [===========>..................] - ETA: 0s - loss: 37.6842
248/404 [=================>............] - ETA: 0s - loss: 48.3836
328/404 [=======================>......] - ETA: 0s - loss: 45.0179
404/404 [==============================] - 0s 761us/step - loss: 43.5160 - val_loss: 133.9931