This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mtcars %>% | |
mutate( | |
selected = case_when( | |
cyl == 6 & carb == 4 ~ "yes", | |
cyl == 8 & carb == 8 ~ "yes", | |
TRUE ~ "no" | |
) | |
) %>% | |
filter(selected == "yes") %>% | |
select(-selected) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Some proc are stolen from | |
# https://github.com/jhbadger/nimbioseq | |
import sequtils, strutils, math, tables, osproc, streams, os, typetraits | |
type Record* = object | |
## This type represents a genetic sequence with optional quality | |
id*: string | |
description*: string | |
quality*: string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ClusterBlast scores for /home/wms_joe/PVCs/other_genomes/multigene/operon_genbank/PVCcif_ATCC43949.gbk | |
Table of genes, locations, strands and annotations of query cluster: | |
PAU_01961 8 457 + T4-like_virus_tail_tube_protein_gp19 no_locus_tag | |
PAU_01962 521 1618 + major_tail_sheath_protein no_locus_tag | |
PAU_01963 1799 3280 + tail_sheath_protein no_locus_tag | |
PAU_01964 3334 4533 + tail_sheath_protein no_locus_tag | |
PAU_01965 4547 5005 + T4-like_virus_tail_tube_protein_gp19 no_locus_tag | |
PAU_01966 5002 5181 + hypothetical_protein no_locus_tag | |
PAU_01967 5168 5851 + hypothetical_protein no_locus_tag |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while read id; do curl "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&id="$id"&rettype=fasta&retmode=text" > "$id".fasta; done < ecoli_ref.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:8.6 | |
LABEL author="Maxime Garcia" \ | |
description="HTSlib 1.4 image for use in CAW" \ | |
maintainer="[email protected]" | |
# Dockefile for mosdepth is based on Dockerfile for HTSlib 1.4 by Maxime Garcia | |
# I just added few lines for quick building a docker image for mosdepth | |
# Install libraries | |
RUN apt-get update && apt-get install -y --no-install-recommends \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#reference https://unix.stackexchange.com/questions/136371/how-to-download-a-folder-from-google-drive-using-terminal | |
#get cookie and code | |
wget --save-cookies cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/Code: \1\n/p' | |
#download the file | |
wget --load-cookies cookies.txt 'https://docs.google.com/uc?export=download&confirm=CODE_FROM_ABOVE&id=FILEID' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm(list = ls()) | |
# Le Viet Thanh | |
# May 31st 2017 | |
# Demo script for converting a data frame of nucleotide column to phydat format | |
# Asked by Dung Nguyen Chi | |
library(seqRFLP) | |
library(readr) | |
library(dplyr) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SAM to consensus FASTA code golf, inspired by http://lab.loman.net/2015/07/28/calling-haploid-consensus-sequence/ | |
# Starting with a SAM: | |
samtools view -bS seqs.sam | samtools sort - seqs # Generate and sort BAM | |
samtools index seqs.bam # Index BAM | |
# Starting with an indexed BAM: | |
samtools mpileup -ud 1000 -f seqs_ref.fasta seqs.bam | bcftools call -c | vcfutils.pl vcf2fq | seqtk seq -a - > seqs.consensus.fa # Generate pileup, call variants, convert to fq, convert to fa | |
# Who can do better? The bar is set low... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function total(n,k=3) | |
rfib(n) = n < 2 ? n : rfib(n-1) + k*rfib(n-2) | |
return rfib(n) | |
end | |
total(5,3) |
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 7 columns, instead of 3 in line 6.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
value,chuong,dieu,khoan,diem,ma_loi,muc_phat | |
Chương I,Chương I,NA,NA,NA,Chương I.NA.NA,[cá nhân: NA-NA] | |
NHỮNG QUY ĐỊNH CHUNG,Chương I,NA,NA,NA,Chương I.NA.NA,[cá nhân: NA-NA] | |
Điều 1. Phạm vi điều chỉnh,Chương I,Điều 1,NA,NA,Chương I.Điều 1.NA,[cá nhân: NA-NA] | |
"1. Nghị định này quy định về hành vi vi phạm hành chính; hình thức, mức xử phạt, biện pháp khắc phục hậu quả đối với từng hành vi vi phạm hành chính; thẩm quyền lập biên bản, thẩm quyền xử phạt, mức phạt tiền cụ thể theo từng chức danh đối với hành vi vi phạm hành chính trong lĩnh vực giao thông đường bộ và đường sắt.",Chương I,Điều 1,1,NA,Chương I.Điều 1.1,[cá nhân: NA-NA] | |
2. Các hành vi vi phạm hành chính trong các lĩnh vực quản lý nhà nước khác liên quan đến lĩnh vực giao thông đường bộ và đường sắt mà không quy định tại Nghị định này thì áp dụng quy định tại các Nghị định quy định về xử phạt vi phạm hành chính trong các lĩnh vực đó để xử phạt.,Chương I,Điều 1,2,NA,Chương I.Điều 1.2,[cá nhân: NA-NA] | |
Điều 2. Đối tượng áp dụng,Chương I,Điều |