Skip to content

Instantly share code, notes, and snippets.

View nylander's full-sized avatar

Johan Nylander nylander

View GitHub Profile
@nylander
nylander / blast2fasta.sh
Created October 10, 2023 11:43
Convert blast output with sseq as last column to fasta
#! /bin/bash
# blast2fasta
# Parse output from blast where we have sseq as the last column.
# For example (argument to blastn): "-outfmt '6 qseqid sseq'".
# Reads from file, writes to stdout.
# By Johan Nylander
# 2023-Oct-10
# Usage: blast2fasta.sh file
file=$1
awk '{printf ">%s", $1; for(i=2;i<NF;i++) printf " %s", $i; printf "\n%s\n", $NF}' "$file"
@nylander
nylander / create_sample_sheet.pl
Created June 15, 2023 09:16
Create a sample sheet from NGI (SciLifeLab) sequencing delivery
#!/usr/bin/env perl
=pod
=encoding utf8
=head1 NAME
create_sample_sheet.pl - Create sample sheet from NGI delivery
@nylander
nylander / FortiClientVPN
Last active May 2, 2024 12:25
Start/stop script for FortiClient VPN on Linux
#!/usr/bin/env bash
# Start/stop FortiClient VPN
# Last modified: ons mar 15, 2023 03:47
# Sign: JN
# To disable starting forticlient after reboot:
# 1. Comment out the command (edit and add an `#` in front of the line) in file
# `/opt/forticlient/start-fortitray-launcher.sh`
# 2. `sudo systemctl disable forticlient-scheduler`
# After step 1 and 2 above, forticlient daemon will not start after reboot. To
@nylander
nylander / gist:162791ff4986abf86864a22896fddc14
Last active April 5, 2022 08:08
Fix error in python for installing nf-core on Ubuntu 20.04, python 3.8
Recently, I tried to upgrade [nf-core](https://nf-co.re/) on my Ubuntu Linux but the execution after installation failed with errors from a python module.
Upgrading the python library ["rich"](https://rich.readthedocs.io/en/stable/introduction.html) solved the issue.
Steps below:
```
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
@nylander
nylander / fasta2nexus.pl
Created May 21, 2021 09:51
Fasta to Nexus converter using BioPerl
#! /usr/bin/env perl
#
# Short description for fasta2nexus.pl
#
# Author nylander <johan.nylander@nrm.se>
# Version 0.1
# Copyright (C) 2021 nylander <johan.nylander@nrm.se>
# Modified On 2021-05-21 10:54
# Created 2021-05-21 10:54
#
@nylander
nylander / ptemplate
Created March 29, 2021 18:00
ptemplate - set up a project file hierarchy
#!/bin/bash
# ptemplate - Create a project structure
# Usage: ptemplate myproject
# Last modified: Mon mar 29, 2021 07:55
# Sign: Johan Nylander
# Description: Create a folder structure
# and, if git is available, initilize git-
# version control. No files in folder private
# is under git control, and only the README file
@nylander
nylander / lw.dat
Last active February 9, 2021 20:51
My standard example data "lw": long-wave rhodopsin for a set of gall wasps (Cynipidae)
8 484
Barbotinia_oraniensis TCTTGGTCCATTTATATGTGAGATATATGCAATGCTTGGCTCCCTATTTGGATGTGGCTCCATTTGGACAATGTGTATGATTGCTTTCGACCGATACAATGTTATCGTAAAAGGTTTAGCTGGCAAGCCATTAACTATCAGTGGTGCAATTCTGCGTATTGTTTTTCTCTGGGTCTGGGCGGTAGTTTGGACCATTGCACCAATGATAGGATGGAATCGG---TACGTTCCCGAGGGCAACATGACAGCTTGTGGAACTGACTATCTAACTAAGGATTGGTTCTCGAGGTCTTACATTCTTGTATACAGCGTCTTCGTATACTTCATGCCACTTTTCCTCATCATCTACAGTTACTATTTCATCATTGCTGCTGTATCTGCTCATGAAAAAGCTATGCGTGAACAGGCCAAAAAGAWGAATGTAGCTTCTCTACGATCATCCGACAATCAAAATACGAGTGCTGAACATAAACTCGCCAAGGCA
Synergus_gallaepomiformis ACTAGGTCCATTTATATGTGAGATGTACGGAATGTTTGGCTCTCTATTCGGATGTGGTTCTATTTGGACAATGTGTATGATTGCTTTCGACCGATACAACGTTATCGTAAAAGGTTTAGTTGGCAAGCCCTTAACTATCAGTGGTGCAATCCTGCGCATTGCTTTTCTCTGGATCTGGGCAGTAATTTGGACAATCGCACCAATGATAGGATGGAATCGG---TACGTTCCGGAGGGTAACATGACAGCTTGCGGAACTGACTACCTGAGTAAGGATTGGTTCTCCAGGTCTTACATCATTGTATACAGCGTCTTTGTATACTTCATGCCACTTTTCCTCATCATATACAGTTACTACTTCATCATTGCTGCTGTATCTGCCCACGAGAAGGCTATGCGTGAACAGGCCAAAAAGATGAATGTAGCTTCTCTACGATCATCCGACAATCAAAATACGAGTGCTGAACATAAAC
@nylander
nylander / gist:c55799686f71a008ec6ccdb37b8bfa5d
Created May 27, 2020 10:49
Alias for better jobinfo output on UPPMAX
# Bash alias for better jobinfo output on UPPMAX.
# Last modified: 2020-05-27
# Sign: Johan Nylander
# Include in your ~/.bash_aliases, and
# check that your ~/.bashrc reads your ~/.bash_aliases by, e.g.,
# including this in your ~/.bashrc:
# if [ -f ~/.bash_aliases ]; then
# . ~/.bash_aliases
# fi
#
@nylander
nylander / restriction.nex
Created April 29, 2020 20:18
Example data of type "restriction" for MrBayes
#NEXUS
[Data from Table 1, Felsenstein, 1992, Evolution, 46(1),1992, pp. 159-173.]
Begin data;
Dimensions ntax=5 nchar=122;
Format datatype=restriction missing=?;
Matrix
Gibbon 11100000110001000010100111100000011100100100111110000001010001100100000000010000011010100111100011011010111111101101011001
Orang 11010110100111000000011000101010010000010101010010001000101000000011000000000010000111001110001000110011101001000111001110
Gorilla 11000101101001010111000001100001110011000000000010100000110100110001011000101011000010000101110000110000101101010110101000
Chimp 10000110100011111010000001000100110010101000000011000111100010110000100110000011100010001101100000110100001001010110111000
# gh-93: Repository surgery: Remove large files accidentally added in the past.
- Last modified: fre aug 09, 2019 12:34
- Sign: JN
## Description
Find large, unnecessary files in the MrBayes GitHub repository and delete them.
Saves approx. 132 MB of space (from 212 to 80 MB).