Skip to content

Instantly share code, notes, and snippets.

View yuifu's full-sized avatar

Haruka Ozaki yuifu

View GitHub Profile
@yuifu
yuifu / extract_specific_length_fastq.sh
Last active October 30, 2015 14:10
Extract FASTQ entries with a specific sequence length
awk 'BEGIN{l=100}{if(NR%4==1){x=$0};if(length($0)==l){print x; print; getline; print; getline; print}}' foo.fastq
path_gtf = "merged.asm/merged.gtf"
path_ofile = "merged.asm/merged.gtf.txt"
arr_attr = Array{Any,1}()
d_attr = Dict{Any,Any}()
# Extract all attributes
f = open(path_gtf)
R --slave -e 'library(Biostrings); seqs <- readDNAStringSet("test.fa"); write.table(data.frame(name=names(seqs), length=width(seqs)),stdout(), quote=F, row.names=F)' > hoge.txt
# Installation
# install.packages("dplyr")
library(dplyr)
df1 = data.frame(
A=c("A1", "A2", "A3", "A4")
)
df2 = data.frame(
minialign: malloc.c:2365: sysmalloc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed.
install.packages("tidyverse")
install.packages("magrittr")
source("https://bioconductor.org/biocLite.R")
biocLite()

この文章の目的

たまにしかpythonを使わない人のためのメモ

数値

  • int()で文字列を整数にできる

文字列

  • + で結合できる
  • str() で数値を文字列にできる
  • シングルクォーテーションとダブルクォーテーションが同じ意味
@yuifu
yuifu / count_number_of_files_in_channel.nf
Last active June 18, 2019 05:42
I want to count the number of input and output files to check all files are properly processed. -> Solved!!
#!/usr/bin/env nextflow
Channel.fromPath("*.txt")
.map{[
file(it),
file(it).baseName
]}.into{
input_files
input_files_
input_files__
@yuifu
yuifu / gist:ad58bf1638450098979bf3d2210636a0
Created March 19, 2020 14:12
EdgeR, strange case (too many DEGs)
###############
# mat_count: 60668 x 28 matrix, gene expression levels
# mat_count_rmlow: 18186 x 28 matrix
# group: A vector of factor: factor(rep(1:7, each=4))
###############
### Remove low-count genes and round count
is_lowgenes = rowMeans(mat_count) < 5
mat_count_rmlow <- mat_count[!is_lowgenes,]
dim(mat_count_rmlow)
@yuifu
yuifu / gist:01d7f07ab165fcb3cb568d32636b4190
Created April 20, 2020 07:44
Error massage while using Fire.jl
$ julia cli/run.jl relcov examples/data/RamDA_72h_A09.uniq.q40.bam examples/data/gencode.vM15.primary_assembly.annotation.protein_coding.head.bed zzz_experiments/_fire_test_relcov
Start calculating relative gene body coverage...
- bam: examples/data/RamDA_72h_A09.uniq.q40.bam
- bed12: examples/data/gencode.vM15.primary_assembly.annotation.protein_coding.head.bed
- output: zzz_experiments/_fire_test_relcov.geneBodyCoverage.txt
zzz_experiments/_fire_test_relcov.geneBodyCoverage.pdf
- transcript_length_cut: 100
- max_depth: 0
- N_bin: 100