Skip to content

Instantly share code, notes, and snippets.

View Juke34's full-sized avatar
:octocat:
🇸🇪 🇫🇷 🇦🇹

Jacques Dainat Juke34

:octocat:
🇸🇪 🇫🇷 🇦🇹
View GitHub Profile
@Juke34
Juke34 / fasta
Last active April 6, 2020 10:15
Manipulating fasta
#filter out fasta sequence by pattern in header
awk '/^>/ {P=index($0,"STRING")==0} {if(P) print} ' in.fasta > out.fasta
#keeping fasta sequence based on pattern in header
awk '/^>/ {ok=index($0,"Escherichia coli");} {if(ok) print;}' in.fasta
# removing empty records (e.g. seq1 here)
#>seq1
#
#>seq2
@Juke34
Juke34 / conda
Last active April 28, 2020 12:41
Manipulating conda
# To save the current env
conda env export > environment.yaml
#conda configuration
conda config --show channels # to view your configuration's current state,
conda config --show-sources # to view config file locations.
# To test locally a new/modified package:
conda create -n bioconda bioconda-utils
conda activate bioconda
@Juke34
Juke34 / falcon-phase
Created March 27, 2020 11:23
related to falcon
#here order of the different step in the falcon pipeline (snakemake)
name-mapping/
placement-split/
placement-chunks/
placement-run/
placement-gathered/
placement-output/
minced_bed/
minced_fasta/
index-pair/
# sort reads by read names
samtools sort -n inputfile > output
# convert sam to bam
samtools view -bS file.sam > file.bam
# convert bam to sam
samtools view -h -o out.sam in.bam
# --- OSX -----
# When following error:
# ld: unknown option: -platform_version
# clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
Here the way to fix it
info=$( ld -v 2>&1 > /dev/null )
platform=$([[ $info =~ ld64-([0-9]*) ]] && echo ${BASH_REMATCH[1]})
add at the end of the compiltaton command: -mlinker-version=$platform

Sublime Text 3 – Tous les raccourcis (WINDOWS)

Préambule

J’ai créé un fork de cette fiche pour permettre un accès à tous, en français et sans fautes de tous les raccourcis par défaut sur Sublime Text 3. Les raccourcis présents sont les raccourcis par défaut. Si vous ajoutez des snippets, ou des plugins, je ne peut garantir la pérénité de ces derniers. Mémoriser tous les raccourcis en un seul bloc est inutile. C’est pourquoi j’ai regroupé les raccourcis en plusieurs catégories :

  • Par ordre alphabétique
  • Par fonctionnalités
  • Par combinaison de touche
@Juke34
Juke34 / Nextflow.md
Last active March 25, 2021 10:27
Related to nextflow

How to sort a tuple

similar to the NF docu example for values

Channel
    .from( 1, 2, 3, 4, 5 )
    .filter { it % 2 == 1 }
    .view()

but addressing the tuple elements as required

Tutorial: Greatly speed up conda by using mamba

From rpolicastro on https://www.biostars.org/p/9461665/

Conda has been my go-to software manager, but it was only recently brought to my attention that a well maintained project has aimed to greatly speed up and improve the conda functions. Mamba is an almost complete rewrite of conda in C++, allows for parallel downloading of data, and has faster (and better) dependency resolving. For working with larger environments I’ve noticed tasks that would take tens of minutes only takes minutes now (if not less).

Below I’ll provide a quick tutorial on working with mamba, which in theory mirrors what one would do with conda. You should have at least miniconda3 installed.

Installing Mamba

Your conda base environment is the environment where the conda software lives, and additionally any software in base gets added to your path. Generally you don’t want to install software into the base environment., however in this particular case you need to install mamba here,

First copy this file: https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
Then add in the bashrc the following lines:
source /path/to/git-prompt.sh
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
GIT_PS1_SHOWSTASHSTATE=true
GIT_PS1_SHOWUPSTREAM="auto"
GIT_PS1_SHOWCOLORHINTS=true
Google Search Operators blog: https://ahrefs.com/blog/google-advanced-search-operators/