keyword stringclasses 7
values | repo_name stringlengths 8 98 | file_path stringlengths 4 244 | file_extension stringclasses 29
values | file_size int64 0 84.1M | line_count int64 0 1.6M | content stringlengths 1 84.1M ⌀ | language stringclasses 14
values |
|---|---|---|---|---|---|---|---|
2D | rpestourie/fdfd_local_field | examples/consolidate_dataset.jl | .jl | 769 | 27 | using DelimitedFiles
function consolidate_dataset(substring, dir_name)
"""
this function goes through all the files in dir_names and consolidates the dataset for the files containing substring
"""
datafull = []
for file in cd(readdir, dir_name)
if occursin(substring, file)
if da... | Julia |
2D | rpestourie/fdfd_local_field | examples/growing_dataset.jl | .jl | 825 | 26 | using DelimitedFiles
function generate_datasets(namedir, application_name, nbpoints)
"""
This function takes the full dataset and sets the first nbpoints points in a test set,
then creates an ever growing train dataset by increments of nboints"""
fulldataset = readdlm("examples/data/consolidated_d... | Julia |
2D | mitenjain/nanopore | __init__.py | .py | 0 | 0 | null | Python |
2D | mitenjain/nanopore | nanopore/pipeline.sh | .sh | 715 | 10 | #!/bin/bash
#Cleanup the old files
rm -rf ${2} ${3}
#Set the python path to just these local directories
export PYTHONPATH=:./:./submodules:${PYTHONPATH}
#Preferentially put the local binaries at the front of the path
export PATH=:./submodules/sonLib/bin:./submodules/cactus/bin:./submodules/jobTree/bin:./submodules/bw... | Shell |
2D | mitenjain/nanopore | nanopore/__init__.py | .py | 0 | 0 | null | Python |
2D | mitenjain/nanopore | nanopore/pipeline.py | .py | 12,152 | 216 | import os
from optparse import OptionParser
from jobTree.scriptTree.target import Target
from jobTree.scriptTree.stack import Stack
from jobTree.src.bioio import getLogLevelString, isNewer, logger, setLoggingFromOptions
from nanopore.analyses.abstractAnalysis import AbstractAnalysis
from nanopore.analyses.mutate_refer... | Python |
2D | mitenjain/nanopore | nanopore/metaAnalyses/ROC_marginAlign.R | .R | 2,119 | 46 | #!/usr/bin/env Rscript
args <- commandArgs(trailingOnly = T)
library(lattice)
cols <- max(count.fields(args[1], sep="\t"))
data <- read.table(args[1], fill=T, sep="\t", col.names=paste("V",seq_len(cols)))
#find # of algorithms, coverages and proportions heldout used
algorithms <- length(unique(data[,2]))
coverage <-... | R |
2D | mitenjain/nanopore | nanopore/metaAnalyses/hmmMetaAnalysis.py | .py | 6,877 | 107 | import os
from nanopore.metaAnalyses.abstractMetaAnalysis import AbstractMetaAnalysis
import xml.etree.cElementTree as ET
from jobTree.src.bioio import *
import itertools
import numpy as np
class HmmMetaAnalysis(AbstractMetaAnalysis):
def run(self):
#Call base method to do some logging
AbstractMeta... | Python |
2D | mitenjain/nanopore | nanopore/metaAnalyses/unmapped_mapped_distributions.R | .R | 1,871 | 35 | #!/usr/bin/env Rscript
#
args <- commandArgs(trailingOnly = T)
unmapped <- read.table(args[1])
mapped <- read.table(args[2])
analysis <- args[4]
if (length(unmapped[,1]) >= 1 && length(mapped[,1]) >= 1) {
pdf(args[3])
b <- max(c(unmapped[,1], mapped[,1]))
m <- hist(mapped[,1], breaks = seq(1,b+100,100), pl... | R |
2D | mitenjain/nanopore | nanopore/metaAnalyses/unmappedLengthDistributionAnalysis.py | .py | 2,509 | 31 | from nanopore.metaAnalyses.abstractUnmappedAnalysis import AbstractUnmappedMetaAnalysis
import os, sys
from jobTree.src.bioio import system
class UnmappedLengthDistributionAnalysis(AbstractUnmappedMetaAnalysis):
"""runs length distribution analysis on all mapped/unmapped per read Type
as well as per reference"... | Python |
2D | mitenjain/nanopore | nanopore/metaAnalyses/comparePerReadMappabilityByMapper.py | .py | 1,652 | 26 | from nanopore.metaAnalyses.abstractUnmappedAnalysis import AbstractUnmappedMetaAnalysis
import os, sys
import xml.etree.cElementTree as ET
from jobTree.src.bioio import system
import re
from collections import OrderedDict as od
class ComparePerReadMappabilityByMapper(AbstractUnmappedMetaAnalysis):
"""Finds which b... | Python |
2D | mitenjain/nanopore | nanopore/metaAnalyses/coverageSummaryPlots.R | .R | 4,603 | 91 | #!/usr/bin/env Rscript
args <- commandArgs(trailingOnly = T)
summary <- read.csv(args[1], header=T, row.names=1)
name <- args[2]
summary <- summary[order(rownames(summary)),]
if (dim(summary)[1] >= 1) {
num <- 1
names <- vector()
for (i in 1:length(rownames(summary))){
tmp <- as.numeric(strsp... | R |
2D | mitenjain/nanopore | nanopore/metaAnalyses/mappable_kmer_analysis.R | .R | 1,528 | 48 | #!/usr/bin/env Rscript
args <- commandArgs(trailingOnly = T)
data <- read.table(args[1], row.names=1, header=T)
outf <- args[2]
outsig <- args[3]
outplot <- args[4]
library(stats)
library(lattice)
num_trials <- 1000
trial_size <- 5000
trial_fn <- function(d, t) {
matrix(table(factor(sample(1024, t, prob=d, re... | R |
2D | mitenjain/nanopore | nanopore/metaAnalyses/coverageSummary.py | .py | 6,668 | 125 | from nanopore.metaAnalyses.abstractMetaAnalysis import AbstractMetaAnalysis
import os, sys
import xml.etree.cElementTree as ET
from jobTree.src.bioio import system
import re
from itertools import product, izip
from collections import Counter
class Entry(object):
def __init__(self, readType, readFastqFile, referenc... | Python |
2D | mitenjain/nanopore | nanopore/metaAnalyses/__init__.py | .py | 0 | 0 | null | Python |
2D | mitenjain/nanopore | nanopore/metaAnalyses/abstractUnmappedAnalysis.py | .py | 2,488 | 52 | from nanopore.metaAnalyses.abstractMetaAnalysis import AbstractMetaAnalysis
import os, sys
import xml.etree.cElementTree as ET
from jobTree.src.bioio import system, fastqRead
from nanopore.analyses.utils import samIterator
import pysam
class Read():
"""stores a individual read and everything about it"""
def __... | Python |
2D | mitenjain/nanopore | nanopore/metaAnalyses/abstractMetaAnalysis.py | .py | 1,355 | 32 | from jobTree.scriptTree.target import Target
import re
class AbstractMetaAnalysis(Target):
"""Base class to for meta-analysis targets. Inherit this class to create a meta-analysis.
"""
def __init__(self, outputDir, experiments):
Target.__init__(self)
self.experiments = experiments
s... | Python |
2D | mitenjain/nanopore | nanopore/metaAnalyses/marginAlignMetaAnalysis.py | .py | 9,458 | 135 | from nanopore.metaAnalyses.abstractMetaAnalysis import AbstractMetaAnalysis
import os, sys
import xml.etree.cElementTree as ET
from jobTree.src.bioio import system, fastqRead, fastaRead
from nanopore.analyses.utils import samIterator
from itertools import product
import numpy
class MarginAlignMetaAnalysis(AbstractMeta... | Python |
2D | mitenjain/nanopore | nanopore/metaAnalyses/coverageDepth.py | .py | 3,529 | 99 | from nanopore.metaAnalyses.abstractMetaAnalysis import AbstractMetaAnalysis
from sonLib.bioio import system
import os, sys, glob, subprocess, numpy
from nanopore.analyses.utils import samToBamFile
import pysam
class Fastaseq():
"""
fasta reader
"""
def __init__(self):
self.id = None
self.seq = ''
self.length... | Python |
2D | mitenjain/nanopore | nanopore/metaAnalyses/customTrackAssemblyHub.py | .py | 4,927 | 132 | from nanopore.metaAnalyses.abstractMetaAnalysis import AbstractMetaAnalysis
from sonLib.bioio import system
import os, sys, glob
from nanopore.analyses.utils import samToBamFile
import pysam
class Fastaseq():
"""
fasta reader
"""
def __init__(self):
self.id = None
self.seq = ''
self.length = ''
@staticm... | Python |
2D | mitenjain/nanopore | nanopore/metaAnalyses/vennDiagram.R | .R | 11,873 | 286 | #!/usr/bin/env Rscript
#
args <- commandArgs(trailingOnly = T)
data <- read.table(args[1], header = T)
library(methods)
##############################################################################
#### R script to
#### Produce Venn Diagrams with 1 to 5 groups
#### an extension on the code from the limma ... | R |
2D | mitenjain/nanopore | nanopore/metaAnalyses/unmappedKmerAnalysis.py | .py | 2,617 | 52 | from nanopore.metaAnalyses.abstractUnmappedAnalysis import AbstractUnmappedMetaAnalysis
import os, sys
from jobTree.src.bioio import system
import itertools
from collections import Counter
from math import log
class UnmappedKmerAnalysis(AbstractUnmappedMetaAnalysis):
"""Calculates kmer statistics for all reads (in... | Python |
2D | mitenjain/nanopore | nanopore/metaAnalyses/coveragePlots.R | .R | 4,741 | 115 | #!/usr/bin/env Rscript
args <- commandArgs(trailingOnly = T)
if (file.info(args[1])$size != 0) {
cols <- max(count.fields(args[1], sep=","))
dist <- read.table(args[1], fill=T, sep=",", row.names=1, col.names=paste("V",seq_len(cols)))
dist <- dist[order(rownames(dist)),]
}
if (! is.null(dim(dist)) && dim(... | R |
2D | mitenjain/nanopore | nanopore/metaAnalyses/coverageDepth_plot.R | .R | 1,274 | 41 | #!/usr/bin/env Rscript
args <- commandArgs(trailingOnly = T)
library(lattice)
inFile <- args[1]
pdf(args[2])
library(boot)
depthFile = read.delim(inFile, sep="\t", header=F)
obs_cov <- unlist(depthFile[3])
avg <- mean(unlist(depthFile[3]))
dev <- sd(unlist(depthFile[3]))
samples <- length(obs_cov)
outlier_pos <- ... | R |
2D | mitenjain/nanopore | nanopore/mappers/combinedMapper.py | .py | 2,410 | 58 | from nanopore.mappers.abstractMapper import AbstractMapper
from nanopore.mappers.last_params import LastParams
from nanopore.mappers.lastzParams import LastzParams
from nanopore.mappers.bwa_params import BwaParams
from nanopore.mappers.blasr_params import BlasrParams
import pysam
import os
from nanopore.analyses.util... | Python |
2D | mitenjain/nanopore | nanopore/mappers/blasr_params.py | .py | 1,283 | 40 | from nanopore.mappers.blasr import Blasr
from sonLib.bioio import system
import os
class BlasrParams(Blasr):
def run(self):
Blasr.run(self, args="-sdpTupleSize 8 -bestn 1 -m 0")
#system("blasr %s %s -sdpTupleSize 8 -bestn 1 -clipping hard -nproc 8 -sam -out %s -m 0" % (self.readFastqFile, self.refe... | Python |
2D | mitenjain/nanopore | nanopore/mappers/bwa.py | .py | 974 | 30 | from nanopore.mappers.abstractMapper import AbstractMapper
from sonLib.bioio import system
import os
class Bwa(AbstractMapper):
def run(self, args=""):
localReferenceFastaFile = os.path.join(self.getLocalTempDir(), "ref.fa") #Because BWA builds these crufty index files, copy to a temporary directory
... | Python |
2D | mitenjain/nanopore | nanopore/mappers/__init__.py | .py | 0 | 0 | null | Python |
2D | mitenjain/nanopore | nanopore/mappers/lastzParams.py | .py | 1,004 | 32 | from nanopore.mappers.lastz import Lastz
import pysam
import os
from nanopore.analyses.utils import pathToBaseNanoporeDir
class LastzParams(Lastz):
def run(self):
#scoreFile = os.path.join(pathToBaseNanoporeDir(), "nanopore", "mappers", "last_em_575_M13_2D_scores.txt")
#Lastz.run(self, args="--hsp... | Python |
2D | mitenjain/nanopore | nanopore/mappers/blasr.py | .py | 1,615 | 44 | from nanopore.mappers.abstractMapper import AbstractMapper
from nanopore.analyses.utils import getFastqDictionary
from sonLib.bioio import system
import os
import pysam
class Blasr(AbstractMapper):
def run(self, args=""):
tempSamFile = os.path.join(self.getLocalTempDir(), "temp.sam")
system("blasr ... | Python |
2D | mitenjain/nanopore | nanopore/mappers/last_params.py | .py | 1,208 | 40 | from nanopore.mappers.abstractMapper import AbstractMapper
from nanopore.mappers.last import Last
from sonLib.bioio import system, fastaRead, fastqRead, fastaWrite
import os
class LastParams(Last):
def run(self):
Last.run(self, params="-s 2 -T 0 -Q 0 -a 1")
class LastParamsChain(LastParams):
d... | Python |
2D | mitenjain/nanopore | nanopore/mappers/lastz.py | .py | 1,384 | 41 | from nanopore.mappers.abstractMapper import AbstractMapper
from sonLib.bioio import system, fastaRead
from nanopore.analyses.utils import normaliseQualValues
import pysam
import os
class Lastz(AbstractMapper):
def run(self, args=""):
tempFastqFile = os.path.join(self.getLocalTempDir(), "temp.fastq")
... | Python |
2D | mitenjain/nanopore | nanopore/mappers/last.py | .py | 1,928 | 46 | from nanopore.mappers.abstractMapper import AbstractMapper
from sonLib.bioio import system, fastaRead, fastqRead, fastaWrite
import os
class Last(AbstractMapper):
def run(self, params=""):
localReferenceFastaFile = os.path.join(self.getLocalTempDir(), "ref.fa") #Because we don't want to have any crufty fil... | Python |
2D | mitenjain/nanopore | nanopore/mappers/bwa_params.py | .py | 667 | 27 | from nanopore.mappers.bwa import Bwa
from sonLib.bioio import system
import os
class BwaParams(Bwa):
def run(self):
Bwa.run(self, args="-x pacbio")
class BwaParamsChain(BwaParams):
def run(self):
BwaParams.run(self)
self.chainSamFile()
class BwaParamsRealign(BwaParams):
de... | Python |
2D | mitenjain/nanopore | nanopore/mappers/abstractMapper.py | .py | 2,064 | 40 | from jobTree.scriptTree.target import Target
from nanopore.analyses.utils import chainSamFile, realignSamFileTargetFn
import os
from sonLib.bioio import system
from nanopore.analyses.utils import AlignedPair, getFastaDictionary, getFastqDictionary, getExonerateCigarFormatString, samIterator, pathToBaseNanoporeDir
clas... | Python |
2D | mitenjain/nanopore | nanopore/analyses/qualimap.py | .py | 903 | 21 | from nanopore.analyses.abstractAnalysis import AbstractAnalysis
from sonLib.bioio import system
from nanopore.analyses.utils import samToBamFile, samIterator
import os
import pysam
class QualiMap(AbstractAnalysis):
def run(self):
AbstractAnalysis.run(self) #Call base method to do some logging
empty... | Python |
2D | mitenjain/nanopore | nanopore/analyses/substitutions.py | .py | 4,018 | 82 | from nanopore.analyses.abstractAnalysis import AbstractAnalysis
from nanopore.analyses.utils import AlignedPair, getFastaDictionary, getFastqDictionary, samIterator
import os
import pysam
import xml.etree.cElementTree as ET
from jobTree.src.bioio import reverseComplement, prettyXml, system
from itertools import product... | Python |
2D | mitenjain/nanopore | nanopore/analyses/coverage_plot.R | .R | 5,998 | 108 | #!/usr/bin/env Rscript
args <- commandArgs(trailingOnly = T)
#thanks SO: http://stackoverflow.com/questions/6602881/text-file-to-list-in-r
raw <- strsplit(readLines(args[1]), "[[:space:]]+")
data <- lapply(raw, tail, n = -1)
names(data) <- lapply(raw, head, n = 1)
data <- lapply(data, as.numeric)
library(lattice)
f... | R |
2D | mitenjain/nanopore | nanopore/analyses/mutate_reference.py | .py | 2,066 | 38 | import os, sys, random
from sonLib.bioio import fastaRead, fastaWrite
'''
Inserts SNPs and 20% of SNPs as InDels
Outputs Two files for every file - reference.fasta
1. mutated reference - reference_X_percent_SNPs_Y_percent_InDels.fasta
2. mutation index for true and mutated reference - reference_X_percent_SNPs_Y_percen... | Python |
2D | mitenjain/nanopore | nanopore/analyses/consensus.py | .py | 2,943 | 75 | from nanopore.analyses.abstractAnalysis import AbstractAnalysis
from sonLib.bioio import system
from nanopore.analyses.utils import samToBamFile
import os
import pysam
def formatConsensusFastq(inputConsensusFastq, outputConsensusFastq):
infile = open(inputConsensusFastq, "r")
outfile = open(outputConsensusFast... | Python |
2D | mitenjain/nanopore | nanopore/analyses/__init__.py | .py | 0 | 0 | null | Python |
2D | mitenjain/nanopore | nanopore/analyses/hmm.py | .py | 4,792 | 88 | import os
from nanopore.analyses.abstractAnalysis import AbstractAnalysis
from nanopore.analyses.utils import AlignedPair, getFastaDictionary, getFastqDictionary, samIterator
import xml.etree.cElementTree as ET
from jobTree.src.bioio import *
class Hmm(AbstractAnalysis):
"""Calculates stats on indels.
"""
... | Python |
2D | mitenjain/nanopore | nanopore/analyses/read_sampler.py | .py | 1,961 | 41 | import pysam
import os, sys, glob, random
# using generator and yield function to read 4 lines at a time
def getStanza (infile):
while True:
fasta_id = infile.readline().strip()
fasta_seq = infile.readline().strip()
qual_id = infile.readline().strip()
qual_scr = infile.readline().st... | Python |
2D | mitenjain/nanopore | nanopore/analyses/marginAlignSnpCaller.py | .py | 20,859 | 310 | from nanopore.analyses.abstractAnalysis import AbstractAnalysis
from nanopore.analyses.utils import AlignedPair, getFastaDictionary, getFastqDictionary, getExonerateCigarFormatString, samIterator, pathToBaseNanoporeDir
import os
import pysam
import numpy
import math
import random
import xml.etree.cElementTree as ET
fro... | Python |
2D | mitenjain/nanopore | nanopore/analyses/indelKmerAnalysis.py | .py | 3,300 | 70 | from nanopore.analyses.abstractAnalysis import AbstractAnalysis
from jobTree.src.bioio import fastqRead, fastaRead, system
from nanopore.analyses.utils import samIterator, getFastaDictionary, UniqueList
import pysam, os, itertools
from collections import Counter
from math import log
class IndelKmerAnalysis(AbstractAna... | Python |
2D | mitenjain/nanopore | nanopore/analyses/channel_plots.R | .R | 7,317 | 159 | #!/usr/bin/env Rscript
args <- commandArgs(trailingOnly = T)
data <- read.table(args[1], row.names=1, header=T)
library(lattice)
#below is hard coded positions on the nanopore
labels <- c(125, 126, 127, 128, 253, 254, 255, 256, 381, 382, 383, 384, 509, 510, 511, 512,
121, 122, 123, 124, 249, 250, 251, 2... | R |
2D | mitenjain/nanopore | nanopore/analyses/match_hist.R | .R | 273 | 15 | #!/usr/bin/env Rscript
args <- commandArgs(trailingOnly = T)
data <- read.table(args[1], sep="\t")
if ( dim(data)[1] > 0 & sum(data, na.rm=T) > 0 ) {
pdf(args[2])
hist(t(data), main = "Average Posterior Match Probability", xlab="Probability")
dev.off()
} | R |
2D | mitenjain/nanopore | nanopore/analyses/fastqc.py | .py | 272 | 9 | from nanopore.analyses.abstractAnalysis import AbstractAnalysis
from sonLib.bioio import system
import os
class FastQC(AbstractAnalysis):
def run(self):
AbstractAnalysis.run(self)
system("fastqc %s --outdir=%s" % (self.readFastqFile, self.outputDir))
| Python |
2D | mitenjain/nanopore | nanopore/analyses/kmer_analysis.R | .R | 1,978 | 53 | #!/usr/bin/env Rscript
args <- commandArgs(trailingOnly = T)
data <- read.table(args[1], row.names=1, header=T)
if (sum(data$refCount) > 1000 && sum(data$readCount) > 10000 ){
outf <- args[2]
outsig <- args[3]
outplot <- args[4]
library(stats)
library(lattice)
num_trials <- 1000
trial_... | R |
2D | mitenjain/nanopore | nanopore/analyses/coverage.py | .py | 9,851 | 167 | from nanopore.analyses.abstractAnalysis import AbstractAnalysis
from nanopore.analyses.utils import AlignedPair, getFastaDictionary, getFastqDictionary, samIterator
import os
import numpy
import pysam
import xml.etree.cElementTree as ET
from jobTree.src.bioio import reverseComplement, fastaRead, fastqRead, prettyXml, s... | Python |
2D | mitenjain/nanopore | nanopore/analyses/emissions_plot.R | .R | 746 | 33 | #!/usr/bin/env Rscript
args <- commandArgs(trailingOnly = T)
library(lattice)
f <- args[1]
out <- args[2]
myPanel <- function(x, y, z, ...) {
panel.levelplot(x, y, z, ...)
panel.text(x, y, round(z,3))
}
d <- read.table(f, header = T)
if ( dim(d)[1] > 0 && sum(d) > 0) {
pdf(out)
p <- levelplot(t... | R |
2D | mitenjain/nanopore | nanopore/analyses/indelPlots.R | .R | 2,415 | 44 | #!/usr/bin/env Rscript
args <- commandArgs(trailingOnly = T)
indels <- read.table(args[1], fill=T, sep="\t", header=T, na.strings="None", comment.char="")
g <- function(p, x) {p*(1-p)^(x-1)} #geometric parameterized to start at 1
if (dim(indels)[1] > 2) {
pdf(args[2])
par(mfrow=c(2,1))
if ( ! is.null(indels$re... | R |
2D | mitenjain/nanopore | nanopore/analyses/utils.py | .py | 28,935 | 631 | import pysam, sys, os, collections
from jobTree.src.bioio import reverseComplement, fastaRead, fastqRead, cigarReadFromString, PairwiseAlignment, system, fastaWrite, fastqWrite, cigarRead, logger, nameValue, absSymPath
from cactus.bar import cactus_expectationMaximisation
from cactus.bar.cactus_expectationMaximisation ... | Python |
2D | mitenjain/nanopore | nanopore/analyses/kmerAnalysis.py | .py | 2,599 | 59 | from nanopore.analyses.abstractAnalysis import AbstractAnalysis
from jobTree.src.bioio import fastqRead, fastaRead, system, reverseComplement
from nanopore.analyses.utils import samIterator
import pysam, os, itertools
from collections import Counter
from math import log
class KmerAnalysis(AbstractAnalysis):
"""Ru... | Python |
2D | mitenjain/nanopore | nanopore/analyses/channelMappability.py | .py | 1,887 | 31 | from nanopore.analyses.abstractAnalysis import AbstractAnalysis
from nanopore.analyses.utils import getFastqDictionary, samIterator
import os
import pysam
import xml.etree.cElementTree as ET
from jobTree.src.bioio import reverseComplement, prettyXml, system
from collections import Counter
import re
class ChannelMappa... | Python |
2D | mitenjain/nanopore | nanopore/analyses/alignmentUncertainty.py | .py | 4,503 | 73 | from nanopore.analyses.abstractAnalysis import AbstractAnalysis
from nanopore.analyses.utils import AlignedPair, getFastaDictionary, getFastqDictionary, getExonerateCigarFormatString, samIterator, pathToBaseNanoporeDir
import os
import pysam
import numpy
import xml.etree.cElementTree as ET
from jobTree.src.bioio import... | Python |
2D | mitenjain/nanopore | nanopore/analyses/abstractAnalysis.py | .py | 1,550 | 42 | from jobTree.scriptTree.target import Target
from sonLib.bioio import logger
import os
class AbstractAnalysis(Target):
"""Base class to for analysis targets. Inherit this class to create an analysis.
"""
def __init__(self, readFastqFile, readType, referenceFastaFile, samFile, outputDir):
Target.__i... | Python |
2D | mitenjain/nanopore | nanopore/analyses/substitution_plot.R | .R | 557 | 31 | #!/usr/bin/env Rscript
args <- commandArgs(trailingOnly = T)
library(lattice)
f <- args[1]
out <- args[2]
inf <- args[3]
myPanel <- function(x, y, z, ...) {
panel.levelplot(x, y, z, ...)
panel.text(x, y, paste(100 * round(exp(-z),4), "%", sep=""))
}
d <- read.table(f, header = T, row.names = 1)
if ( dim... | R |
2D | mitenjain/nanopore | nanopore/analyses/indels.py | .py | 6,347 | 111 | from nanopore.analyses.abstractAnalysis import AbstractAnalysis
from nanopore.analyses.utils import AlignedPair, getFastaDictionary, getFastqDictionary, samIterator
import os
import pysam
import numpy
import xml.etree.cElementTree as ET
from jobTree.src.bioio import reverseComplement, prettyXml, system
class IndelCou... | Python |
2D | mitenjain/nanopore | nanopore/analyses/running_likelihood.R | .R | 992 | 35 | #!/usr/bin/env Rscript
args <- commandArgs(trailingOnly = T)
f <- args[1]
out <- args[2]
tryCatch({
dist <- read.table(f)
if (dim(dist)[1] > 1) {
m <- max(dist)
pdf(out)
r <- topo.colors(length(rownames(dist)))
n <- 0
plot(x=seq(1,dim(dist)[2]),y=as.vector(dist[1,]... | R |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bam_import.c | .c | 16,461 | 490 | #include <zlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#ifdef _WIN32
#include <fcntl.h>
#endif
#include "kstring.h"
#include "bam.h"
#include "sam_header.h"
#include "kseq.h"
#include "khash.h"
KSTREAM_INIT(gzFile, gzread, 16384)
KHASH_MA... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/sample.c | .c | 2,984 | 108 | #include <stdlib.h>
#include <string.h>
#include "sample.h"
#include "khash.h"
KHASH_MAP_INIT_STR(sm, int)
bam_sample_t *bam_smpl_init(void)
{
bam_sample_t *s;
s = calloc(1, sizeof(bam_sample_t));
s->rg2smid = kh_init(sm);
s->sm2id = kh_init(sm);
return s;
}
void bam_smpl_destroy(bam_sample_t *sm)
{
int i;
khi... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bam_plcmd.c | .c | 22,175 | 607 | #include <math.h>
#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#include <getopt.h>
#include "sam.h"
#include "faidx.h"
#include "kstring.h"
#include "sam_header.h"
static inline int printw(int c, FILE *fp)
{
char buf[16];
int l, x;
if (c == 0... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/knetfile.h | .h | 1,611 | 76 | #ifndef KNETFILE_H
#define KNETFILE_H
#include <stdint.h>
#include <fcntl.h>
#ifndef _WIN32
#define netread(fd, ptr, len) read(fd, ptr, len)
#define netwrite(fd, ptr, len) write(fd, ptr, len)
#define netclose(fd) close(fd)
#else
#include <winsock2.h>
#define netread(fd, ptr, len) recv(fd, ptr, len, 0)
#define netwrit... | Unknown |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bam_pileup.c | .c | 12,954 | 438 | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
#include "sam.h"
typedef struct {
int k, x, y, end;
} cstate_t;
static cstate_t g_cstate_null = { -1, 0, 0, 0 };
typedef struct __linkbuf_t {
bam1_t b;
uint32_t beg, end;
cstate_t s;
struct __linkbuf_t *next;
} lbnode_t;
/* --- BEGIN... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bam2bcf.c | .c | 14,804 | 468 | #include <math.h>
#include <stdint.h>
#include <assert.h>
#include "bam.h"
#include "kstring.h"
#include "bam2bcf.h"
#include "errmod.h"
#include "bcftools/bcf.h"
extern void ks_introsort_uint32_t(size_t n, uint32_t a[]);
#define CALL_ETA 0.03f
#define CALL_MAX 256
#define CALL_DEFTHETA 0.83f
#define DEF_MAPQ 20
#de... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bam2bcf_indel.c | .c | 18,351 | 499 | #include <assert.h>
#include <ctype.h>
#include <string.h>
#include "bam.h"
#include "bam2bcf.h"
#include "kaln.h"
#include "kprobaln.h"
#include "khash.h"
KHASH_SET_INIT_STR(rg)
#include "ksort.h"
KSORT_INIT_GENERIC(uint32_t)
#define MINUS_CONST 0x10000000
#define INDEL_WINDOW_SIZE 50
void *bcf_call_add_rg(void *_h... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bam_tview_curses.c | .c | 7,879 | 298 | #undef _HAVE_CURSES
#if _CURSES_LIB == 0
#elif _CURSES_LIB == 1
#include <curses.h>
#ifndef NCURSES_VERSION
#warning "_CURSES_LIB=1 but NCURSES_VERSION not defined; tview is NOT compiled"
#else
#define _HAVE_CURSES
#endif
#elif _CURSES_LIB == 2
#include <xcurses.h>
#define _HAVE_CURSES
#else
#warning "_CURSES_LIB is n... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bam_rmdup.c | .c | 5,631 | 207 | #include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <zlib.h>
#include <unistd.h>
#include "sam.h"
typedef bam1_t *bam1_p;
#include "khash.h"
KHASH_SET_INIT_STR(name)
KHASH_MAP_INIT_INT64(pos, bam1_p)
#define BUFFER_SIZE 0x40000
typedef struct {
uint64_t n_checked, n_removed;
khash_t(pos) *best_has... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bam_reheader.c | .c | 1,506 | 63 | #include <stdio.h>
#include <stdlib.h>
#include "knetfile.h"
#include "bgzf.h"
#include "bam.h"
#define BUF_SIZE 0x10000
int bam_reheader(BGZF *in, const bam_header_t *h, int fd)
{
BGZF *fp;
bam_header_t *old;
int len;
uint8_t *buf;
if (in->is_write) return -1;
buf = malloc(BUF_SIZE);
old = bam_header_read(in)... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/faidx.h | .h | 3,188 | 104 | /* The MIT License
Copyright (c) 2008 Genome Research Ltd (GRL).
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use... | Unknown |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/sample.h | .h | 396 | 18 | #ifndef BAM_SAMPLE_H
#define BAM_SAMPLE_H
#include "kstring.h"
typedef struct {
int n, m;
char **smpl;
void *rg2smid, *sm2id;
} bam_sample_t;
bam_sample_t *bam_smpl_init(void);
int bam_smpl_add(bam_sample_t *sm, const char *abs, const char *txt);
int bam_smpl_rg2smid(const bam_sample_t *sm, const char *fn, const ... | Unknown |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bam_lpileup.c | .c | 4,976 | 199 | #include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "bam.h"
#include "ksort.h"
#define TV_GAP 2
typedef struct __freenode_t {
uint32_t level:28, cnt:4;
struct __freenode_t *next;
} freenode_t, *freenode_p;
#define freenode_lt(a,b) ((a)->cnt < (b)->cnt || ((a)->cnt == (b)->cnt && (a)->level < (b)->l... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bam_cat.c | .c | 5,803 | 186 | /*
bam_cat -- efficiently concatenates bam files
bam_cat can be used to concatenate BAM files. Under special
circumstances, it can be used as an alternative to 'samtools merge' to
concatenate multiple sorted files into a single sorted file. For this
to work each file must be sorted, and the sorted files must be given... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/khash.h | .h | 17,815 | 529 | /* The MIT License
Copyright (c) 2008, 2009, 2011 by Attractive Chaos <attractor@live.co.uk>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without ... | Unknown |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bam2bcf.h | .h | 1,889 | 68 | #ifndef BAM2BCF_H
#define BAM2BCF_H
#include <stdint.h>
#include "errmod.h"
#include "bcftools/bcf.h"
#define B2B_INDEL_NULL 10000
#define B2B_FMT_DP 0x1
#define B2B_FMT_SP 0x2
#define B2B_FMT_DV 0x4
typedef struct __bcf_callaux_t {
int capQ, min_baseQ;
int openQ, extQ, tandemQ; // for indels
int min_support, ma... | Unknown |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/kprobaln.h | .h | 1,568 | 50 | /* The MIT License
Copyright (c) 2003-2006, 2008, 2009 by Heng Li <lh3@live.co.uk>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation... | Unknown |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/errmod.h | .h | 442 | 25 | #ifndef ERRMOD_H
#define ERRMOD_H
#include <stdint.h>
struct __errmod_coef_t;
typedef struct {
double depcorr;
struct __errmod_coef_t *coef;
} errmod_t;
errmod_t *errmod_init(float depcorr);
void errmod_destroy(errmod_t *em);
/*
n: number of bases
m: maximum base
bases[i]: qual:6, strand:1, base:4
q[i*m+j]: ... | Unknown |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bam_tview.h | .h | 1,880 | 76 | #ifndef BAM_TVIEW_H
#define BAM_TVIEW_H
#include <ctype.h>
#include <assert.h>
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <stdarg.h>
#include "bam.h"
#include "faidx.h"
#include "bam2bcf.h"
#include "sam_header.h"
#include "khash.h"
KHASH_MAP_INIT_STR(kh_rg, const char *)
typedef struct Abstr... | Unknown |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/razip.c | .c | 4,110 | 142 | #include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "razf.h"
#define WINDOW_SIZE 4096
static int razf_main_usage()
{
printf("\n");
printf("Usage: razip [options] [file] ...\n\n");
printf("Options: -c write on standard output, keep ori... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bam.h | .h | 25,785 | 794 | /* The MIT License
Copyright (c) 2008-2010 Genome Research Ltd (GRL).
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights t... | Unknown |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bam_mate.c | .c | 4,553 | 129 | #include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "kstring.h"
#include "bam.h"
void bam_template_cigar(bam1_t *b1, bam1_t *b2, kstring_t *str)
{
bam1_t *swap;
int i, end;
uint32_t *cigar;
str->l = 0;
if (b1->core.tid != b2->core.tid || b1->core.tid < 0) return; // coordinateless or not on the s... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/razf.c | .c | 24,343 | 854 | /*
* RAZF : Random Access compressed(Z) File
* Version: 1.0
* Release Date: 2008-10-27
*
* Copyright 2008, Jue Ruan <ruanjue@gmail.com>, Heng Li <lh3@sanger.ac.uk>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the fo... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bam_endian.h | .h | 1,064 | 43 | #ifndef BAM_ENDIAN_H
#define BAM_ENDIAN_H
#include <stdint.h>
static inline int bam_is_big_endian()
{
long one= 1;
return !(*((char *)(&one)));
}
static inline uint16_t bam_swap_endian_2(uint16_t v)
{
return (uint16_t)(((v & 0x00FF00FFU) << 8) | ((v & 0xFF00FF00U) >> 8));
}
static inline void *bam_swap_endian_2p(v... | Unknown |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/sam.c | .c | 6,051 | 187 | #include <string.h>
#include <unistd.h>
#include "faidx.h"
#include "sam.h"
#define TYPE_BAM 1
#define TYPE_READ 2
bam_header_t *bam_header_dup(const bam_header_t *h0)
{
bam_header_t *h;
int i;
h = bam_header_init();
*h = *h0;
h->hash = h->dict = h->rg2lib = 0;
h->text = (char*)calloc(h->l_text + 1, 1);
memcp... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bam2depth.c | .c | 5,844 | 144 | /* This program demonstrates how to generate pileup from multiple BAMs
* simutaneously, to achieve random access and to use the BED interface.
* To compile this program separately, you may:
*
* gcc -g -O2 -Wall -o bam2depth -D_MAIN_BAM2DEPTH bam2depth.c -L. -lbam -lz
*/
#include <stdlib.h>
#include <string.h>
#i... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bamtk.c | .c | 5,403 | 120 | #include <stdio.h>
#include <unistd.h>
#include <assert.h>
#include <fcntl.h>
#include "bam.h"
#ifdef _USE_KNETFILE
#include "knetfile.h"
#endif
int bam_taf2baf(int argc, char *argv[]);
int bam_mpileup(int argc, char *argv[]);
int bam_merge(int argc, char *argv[]);
int bam_index(int argc, char *argv[]);
int bam_sort(... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/errmod.c | .c | 3,485 | 131 | #include <math.h>
#include "errmod.h"
#include "ksort.h"
KSORT_INIT_GENERIC(uint16_t)
typedef struct __errmod_coef_t {
double *fk, *beta, *lhet;
} errmod_coef_t;
typedef struct {
double fsum[16], bsum[16];
uint32_t c[16];
} call_aux_t;
static errmod_coef_t *cal_coef(double depcorr, double eta)
{
int k, n, q;
lo... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bamshuf.c | .c | 3,603 | 142 | #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "sam.h"
#include "ksort.h"
#define DEF_CLEVEL 1
static inline unsigned hash_Wang(unsigned key)
{
key += ~(key << 15);
key ^= (key >> 10);
key += (key << 3);
key ^= (key >> 6);
key += ~(ke... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/knetfile.c | .c | 18,332 | 633 | /* The MIT License
Copyright (c) 2008 by Genome Research Ltd (GRL).
2010 by Attractive Chaos <attractor@live.co.uk>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software wi... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/razf.h | .h | 4,137 | 135 | /*-
* RAZF : Random Access compressed(Z) File
* Version: 1.0
* Release Date: 2008-10-27
*
* Copyright 2008, Jue Ruan <ruanjue@gmail.com>, Heng Li <lh3@sanger.ac.uk>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the ... | Unknown |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bam_md.c | .c | 12,942 | 390 | #include <unistd.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include "faidx.h"
#include "sam.h"
#include "kstring.h"
#include "kaln.h"
#include "kprobaln.h"
#define USE_EQUAL 1
#define DROP_TAG 2
#define BIN_QUAL 4
#define UPDATE_NM 8
#define UPDATE_MD 16
#define HASH_QNM 32
ch... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/faidx.c | .c | 10,934 | 438 | #include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include "faidx.h"
#include "khash.h"
typedef struct {
int32_t line_len, line_blen;
int64_t len;
uint64_t offset;
} faidx1_t;
KHASH_MAP_INIT_STR(s, faidx1_t)
#ifndef _NO_RAZF
#include "razf.h"
#else
#ifdef _WIN32
#def... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/kaln.h | .h | 2,072 | 68 | /* The MIT License
Copyright (c) 2003-2006, 2008, 2009 by Heng Li <lh3@live.co.uk>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation... | Unknown |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/padding.c | .c | 17,140 | 480 | #include <string.h>
#include <assert.h>
#include <unistd.h>
#include "kstring.h"
#include "sam_header.h"
#include "sam.h"
#include "bam.h"
#include "faidx.h"
bam_header_t *bam_header_dup(const bam_header_t *h0); /*in sam.c*/
static void replace_cigar(bam1_t *b, int n, uint32_t *cigar)
{
if (n != b->core.n_cigar) {
... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bedidx.c | .c | 3,882 | 163 | #include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <zlib.h>
#ifdef _WIN32
#define drand48() ((double)rand() / RAND_MAX)
#endif
#include "ksort.h"
KSORT_INIT_GENERIC(uint64_t)
#include "kseq.h"
KSTREAM_INIT(gzFile, gzread, 8192)
typedef struct {
int n, m;
uint64_t *a;
int *idx... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/sam_header.c | .c | 21,248 | 811 | #include "sam_header.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdarg.h>
#include "khash.h"
KHASH_MAP_INIT_STR(str, const char *)
struct _HeaderList
{
struct _HeaderList *last; // Hack: Used and maintained only by list_append_to_end. Maintained in the root node o... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bgzip.c | .c | 5,903 | 207 | /* The MIT License
Copyright (c) 2008 Broad Institute / Massachusetts Institute of Technology
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without li... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bam_rmdupse.c | .c | 4,127 | 160 | #include <math.h>
#include "sam.h"
#include "khash.h"
#include "klist.h"
#define QUEUE_CLEAR_SIZE 0x100000
#define MAX_POS 0x7fffffff
typedef struct {
int endpos;
uint32_t score:31, discarded:1;
bam1_t *b;
} elem_t, *elem_p;
#define __free_elem(p) bam_destroy1((p)->data.b)
KLIST_INIT(q, elem_t, __free_elem)
typede... | C |
2D | mitenjain/nanopore | submodules/samtools-0.1.19/bam_sort.c | .c | 18,685 | 572 | #include <stdlib.h>
#include <ctype.h>
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "bam.h"
#include "ksort.h"
static int g_is_by_qname = 0;
static int strnum_cmp(const char *_a, const char *_b)
{
const unsigned char *a = (const unsigned char*)_a, *b = (c... | C |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.