Skip to content

Instantly share code, notes, and snippets.

View jvfe's full-sized avatar
🐢
slow and steady...

João Cavalcante jvfe

🐢
slow and steady...
View GitHub Profile
@jvfe
jvfe / Nextflow_on_NPAD_UFRN.md
Last active April 10, 2024 20:42 — forked from iaradsouza1/Nextflow_on_NPAD_UFRN.md
Run Nextflow pipelines and RStudio at NPAD local cluster

This a basic guideline to set some basic configurations in order to run nextflow pipelines at the NPAD.

First, I'm assuming that your analysis will take more than 9 GB (your home quota), then you'll need to use the scratch disk to store the results and the singularity images.

0. Install conda and nf-core

Here I recomend to use conda to install the nextflow and nf-core.

Download and install conda: https://docs.conda.io/en/latest/miniconda.html

Install nf-core with conda: https://nf-co.re/docs/usage/installation#bioconda-installation

@jvfe
jvfe / snippet.nf
Created February 1, 2023 17:47
Difference between using mix and set with value channels
ch = Channel.empty()
ch2 = Channel.empty()
ch = ch.mix(Channel.value('database'))
Channel.value('database').set{ ch2 }
println(ch)
println(ch2)
@jvfe
jvfe / GSoC2021.md
Last active August 22, 2021 20:57
GSoC 2021 Project Summary - R Community Explorer - Exploration of the R community on Twitter
@jvfe
jvfe / diamond.m8
Created May 13, 2021 11:16
Annotate example data
read1 WP_005581541.1 98.2 40 1 0 129 299 1 57 7.7e-22 113.6
read2 WP_005575885.1 100.0 60 0 0 181 2 1 60 2.2e-24 122.1
read3 WP_005580014.1 100.0 50 0 0 2 151 385 434 3.6e-19 104.8
read4 WP_005576929.1 100.0 98 0 0 296 3 308 405 6.7e-42 180.3
read5 ELY74166.1 98.0 100 2 0 300 1 80 179 7.9e-43 183.3
read5 WP_015233403.1 98.0 100 2 0 300 1 98 197 7.9e-43 183.3
read6 WP_005578121.1 100.0 52 0 0 1 156 124 175 1.6e-22 115.9
read7 WP_005576999.1 92.0 100 8 0 1 300 14 113 1.1e-47 199.5
read8 WP_005579760.1 98.0 100 2 0 2 301 214 313 1.8e-42 182.2
read8 AFZ74922.1 98.0 100 2 0 2 301 188 287 1.8e-42 182.2
@jvfe
jvfe / mkignore
Last active October 1, 2020 17:27
Makes my default gitignore
#!/bin/bash
curl https://www.toptal.com/developers/gitignore/api/python,r,linux,visualstudiocode >> .gitignore
@jvfe
jvfe / wikidata_shex_checker.py
Last active September 26, 2020 22:42
Check a wikidata sparql query against a ShEx schema
from pyshex.shex_evaluator import ShExEvaluator
from pyshex.user_agent import SlurpyGraphWithAgent
from pyshex.utils.sparql_query import SPARQLQuery
import pandas as pd
def test_query_against_shex(schema, sparql):
"""Checks the items resulting from a Wikidata query against a shex schema
Using PyShEx, we can check the validity of multiple items against a predefined
@jvfe
jvfe / docx2pdf.sh
Created September 9, 2020 10:57
Simple snippet I use all the time to convert docx to pdf
#!/bin/bash
libreoffice --headless --convert-to pdf:writer_pdf_Export "$1" --outdir .
@jvfe
jvfe / wikidata_utils.py
Last active August 6, 2020 21:32
A few utilities to easily get data from Wikidata into a dataframe
from collections import defaultdict
import pandas as pd
import requests
def perform_query(query):
"""Performs a SPARQL query to the wikidata endpoint
Args:
query: A string containing a functional sparql query
@jvfe
jvfe / plot_network.py
Created August 6, 2020 17:59
Make a nice network plot with bokeh
from bokeh.io import show
from bokeh.models import Range1d, Plot, Circle, HoverTool, MultiLine
from bokeh.models.graphs import NodesAndLinkedEdges
from bokeh.plotting import from_networkx
import networkx as nx
def plot_network(network, tooltip, layout=nx.kamada_kawai_layout):
"""Makes a nice network plot with Bokeh
Mostly stuff I pieced together from the bokeh tutorials.
get_summary <- function(geneids){
summary_list <- entrez_summary("gene", id = geneids, ) %>%
extract_from_esummary(elements = c("uid", "summary"), simplify = TRUE) %>%
as_tibble() %>%
unnest()
gene_names <- summary_list %>%
slice(1) %>%
as.character()