sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e570b69ad43fe03ff60024bb2a81eaea7092297e39bd1eae383aea34ae5f1224
Go
1,381
42
// Command Group: "Statistics & Population Genetics" // Provides information about the number of scaffolds, including the N50, number of scaffolds, and distribution of lengths of assembled scaffolds. package main import ( "flag" "fmt" "log" "github.com/vertgenlab/gonomics/fasta" ) func assemblyStats(infile stri...
b1a961a15bfe855f6cbc182d7fbcee3c222db0eb869183ba78bef02678122652
Go
1,389
53
package main import ( "github.com/vertgenlab/gonomics/axt" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fasta" "github.com/vertgenlab/gonomics/fileio" "github.com/vertgenlab/gonomics/genomeGraph" "github.com/vertgenlab/gonomics/vcf" ) func convertAxt(axtFile, format, targetFa, outp...
6074b0d8f8bd2e100d69be876fec957b60794bcaf1797c230f56dee91eabd75c
Go
1,390
53
package genomeGraph import ( "bytes" "github.com/vertgenlab/gonomics/cigar" "github.com/vertgenlab/gonomics/dna" "github.com/vertgenlab/gonomics/numbers/parse" "github.com/vertgenlab/gonomics/sam" "strings" ) func calcExtension(seq []dna.Base) int64 { var maxScore int64 = 0 for bases := 0; bases < len(seq); b...
711f2c8b72e2861da395ec647004209774707ead45a53711088bc142bd5f7f66
Go
1,390
40
package main import ( "os" "testing" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" ) var MultFaVisualizerTests = []struct { Infile string Outfile string ExpectedFile string Start int End int NoMask bool Linelength int E...
c08834b8376a4e668cef8a11411c7b1579e73f89ff322d07459c0971cfee37a3
Go
1,397
44
package pFasta import ( "github.com/vertgenlab/gonomics/dna/pDna" "strings" ) // AllAreEqual returns true if two []pFasta data structures are determined // to be equal, false otherwise. // Two []pFasta data structures are said to be equal if: (1) they are of the same // length. (2) Each component pFasta struct in '...
3caf403e7febd046482b1444908ff77742abc77bf954c0693ee61e01fba184c1
Go
1,398
50
// Command Group: "BED Tools" // Converts bedGraph to wig. Wig scores will be equal to the bedGraph dataValue field across the range of the bedGraph entry package main import ( "flag" "fmt" "log" "github.com/vertgenlab/gonomics/chromInfo" "github.com/vertgenlab/gonomics/convert" "github.com/vertgenlab/gonomics...
7d03cc7e60786a1795875ba96a25d2aa2b521c53ac09721aef9f2f08492124d3
Go
1,400
47
// Command Group: "Data Conversion" // Reference-based diploid assembly of aligned short reads package main import ( "flag" "fmt" "log" ) const bufferSize = 10_000_000 func usage() { fmt.Print( "ANCoRA - Ancient-DNA Nucleotide-damage Correction and Reference-guided Assembly.\n" + "This program builds refer...
9447f75f2c5ce9162aae6d8f581871a7d081831475029fe285fcfaf2245cd32a
Go
1,404
60
package main import ( "os" "testing" "github.com/vertgenlab/gonomics/bed" "github.com/vertgenlab/gonomics/exception" ) var PeaksTests = []struct { InWig string ChromSizes string OutBed string ExpectedBed string Threshold float64 FindMinima bool DefaultValue float64 }{ {InWig: "testda...
fd4f681a42dd4b76873981a8647a3bb6ead8797b99aae561603987a2845a5e8c
Go
1,405
50
package numbers import ( "log" "math" ) // AverageFloat64 returns the mean value of type float64 from a slice of type float64. func AverageFloat64(f []float64) float64 { answer := 0.0 for i := range f { answer = answer + f[i] } return answer / float64(len(f)) } // VarianceFloat64 returns the variance (type f...
cac45c670af13ca019e511244adc95b1a5afb699e1a9555d5253084567ba092c
Go
1,407
61
// Command Group: "FASTA and Multi-FASTA Tools" // A collection of tools for manipulating pFasta files package main import ( "flag" "fmt" "log" ) func usage() { fmt.Printf( "pFaTools - a collection of tools for manipulating pFasta files.\n" + "Usage:\n" + "\tpFaTools entropyTrack in.pfa out.wig\n" + "...
a087a176efd392802da06e2f550900842792f0368132f0f797c2bf61799aa45d
Go
1,408
40
package wig // Smooth performs moving average smoothing on an input Wig struct using a user-specified windowSize and a value that represents missing data in the Wig. func Smooth(w Wig, windowSize int, missing float64) Wig { var j, k, midPoint int var sum float64 var missingFound bool = false //first we make a fres...
1bf382eb8d846b849ad07cc26859994cb78cc3c377843b1ec760e58d7444b625
Go
1,413
38
package genomeGraph /* import ( "github.com/vertgenlab/gonomics/fastq" "github.com/vertgenlab/gonomics/sam" "log" "sync" "time" ) func GswSingleReadWrap(ref *SimpleGraph, readOne string, output string, threads int, seedLen int, stepSize int, scoreMatrix [][]int64, header *sam.SamHeader) { log.SetFlags(log.Ldate...
9d0fd35a080e51e4cbe6afcc244f5a19651454f8613190373ccb7472b78c418f
Go
1,420
50
package genePred import ( "testing" "github.com/vertgenlab/gonomics/fileio" ) var genePred1 = GenePred{Id: "test", Chrom: "0", Strand: '+', TxStart: 0, TxEnd: 1001, CdsStart: 0, CdsEnd: 901, ExonNum: 4, ExonStarts: []int{0, 18, 500, 800}, ExonEnds: []int{3, 21, 503, 803}} var genePred2 = GenePred{Id: "test", Chrom...
1526ae567f036eb082954364098ca878603354c708aff087dbf5cb3bc9085c67
Go
1,428
74
// Command Group: "Ontology Tools" // Filter gaf file. package main import ( "flag" "fmt" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" "github.com/vertgenlab/gonomics/ontology/gaf" "log" "strings" ) type Settings struct { InFile string OutFile string RemoveNot boo...
84aa5a016e5b6ef5682385744a14b558eb1072ad631c75bcaa6954db81ab506a
Go
1,439
52
// Copyright 2020 Google Inc. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in wr...
19d2575d8c2157d25e3e24f860249cccff87647ef877e4724fe2af130802025b
Go
1,443
65
package main import ( "os" "testing" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" ) var VcfAfsTests = []struct { inputFile string outputFile string expectedFile string unPolarized bool plotSelectionLikelihood string lef...
da86d481f0b28e2ccb2c16c89f993055573357e73ed67e9c96ec553e7fbd17ee
Go
1,443
42
package main import ( "github.com/vertgenlab/gonomics/bed" "github.com/vertgenlab/gonomics/bed/bedpe" "os" "testing" ) var s = []struct { truth []bedpe.BedPe test []bed.Bed expectedFreq float64 expectedBedMatches []bed.Bed expectedNonMatches []bed.Bed }{ {truth: bedpe.Read("...
105e94619768014e13a9b3f1a8f969697e8865291356e37ed70a884c3d6c472d
Go
1,449
61
package numbers import ( "math" "testing" ) var NegativeBinomialCdfTests = []struct { X float64 R float64 P float64 Expected float64 }{ {X: 3, R: 4, P: 0.9, Expected: 0.99727, }, } func TestNegativeBinomialCdf(t *testing.T) { var currAnswer float64 for _, v := range...
9bbdb5cca26521e040dc02a96de0f6e9471b852af0ef765980917c315b26ba1c
Go
1,465
54
package binaryGiraf import ( "reflect" "sync" "testing" "github.com/vertgenlab/gonomics/giraf" ) const ( TestGiraf = "testdata/test.giraf" TestGraph = "testdata/test.gg" TestGiraffe = "testdata/test.giraf.fe" ) func TestReadToSlice(t *testing.T) { data := Read(TestGiraffe, TestGraph) correct := giraf.R...
fdf60c75a8e65d90808cc69612e5486ed76dbc60cdee10c433e2371a1661c228
Go
1,466
43
package dnaTwoBit import ( "github.com/vertgenlab/gonomics/dna" "github.com/vertgenlab/gonomics/numbers" ) func NewTwoBitRainbow(inSeq []dna.Base) []*TwoBit { var start, end, sliceLenNeeded int = 0, 0, 0 clone := make([]dna.Base, len(inSeq)) copy(clone, inSeq) answer := make([]*TwoBit, 32) for startOffset := 0...
8d1d798cba2b02c2b4b82f7cfd4e3a1817883acde10a9e590d24fb1a96655e89
Go
1,473
52
package fasta import ( "sort" "github.com/vertgenlab/gonomics/dna" ) // IsEqual returns true if two input Fasta structs have an equal name and sequence. func IsEqual(alpha Fasta, beta Fasta) bool { if alpha.Name == beta.Name && dna.CompareSeqsCaseSensitive(alpha.Seq, beta.Seq) == 0 { return true } return fals...
6a8bad6c3f91c20d27e7d63024bd1d79efc7fc53ef1848c10d29faba5d31db85
Go
1,479
57
package numbers import ( "log" "math" ) // NegativeBinomialCdf returns the CDF of the negative binomial distribution for an input score x for a distribution // defined by parameters R and P. func NegativeBinomialCdf(x float64, R float64, P float64) float64 { return RegularizedIncompleteBeta(R, x+1, P) } // Regula...
b52d9c7b9377e2cec6f78df963b92fe06cadd9f0102a4ad9fc7ff7ea57aa1e8e
Go
1,486
49
package gene import ( "testing" "github.com/vertgenlab/gonomics/dna" ) var isEqualTest Gene = Gene{ id: "test_gene_id", startPos: 0, posStrand: true, cdsStarts: []int{2, 7, 11}, cdsEnds: []int{4, 9, 13}, genomeSeq: dna.StringToBases("ACATGCACCGTTAACG"), cdnaSeq: dna.StringTo...
e1eccecbfc4bc634fa6809b44cd0d255c6c85f3b768d3426da43209e26ae9e61
Go
1,487
50
package numbers import ( "github.com/vertgenlab/gonomics/fileio" "github.com/vertgenlab/gonomics/numbers/parse" "os" "strings" "testing" ) var PlotTests = []struct { f func(float64) float64 left float64 right float64 bins int outFile string answerX []float64 answerFofX []fl...
841031c7080594cde80bc9499c1e9bdec8639ae40a627654510b3311f1011af0
Go
1,491
66
package main import ( "os" "testing" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" ) var MultiFaToChainTests = []struct { InFile string tName string qName string OutFile string SwapTandQ bool ExpectedFile string QuerySeqName string }{ {InFi...
89aeac43b557521374298ca87878e7d22b8430425ab8749a683be338403b0c11
Go
1,505
57
package numbers import ( "testing" ) func negativeNormalClosure(mu float64, sigma float64) func(float64) float64 { return func(x float64) float64 { return -1 * NormalDist(x, mu, sigma) } } func negativeGammaClosure(alpha float64, beta float64) func(float64) float64 { return func(x float64) float64 { return -...
6a10f1691f09318c168745012617ec38281629bf9a7179ca472ea9ba92889bad
Go
1,508
49
// Command Group: "Sorting" // External sort of giraf records based on topological ordering of nodes in input graph package main import ( "flag" "fmt" "log" "github.com/vertgenlab/gonomics/genomeGraph" "github.com/vertgenlab/gonomics/sort" ) func usage() { fmt.Print( "girafSort - External sort of giraf reco...
32eb90edb903722cff85f0c2c118a03cdac4c0d1df1e8c1bee1fb4087541af73
Go
1,512
47
package fileio import ( "testing" ) var httpTestingLookUp = []struct { local string internet string }{ {"testdata/humanGenomeAbstract.txt", "https://raw.githubusercontent.com/vertgenlab/gonomics/main/fileio/testdata/humanGenomeAbstract.txt"}, } // TestHttpReader will parse a local text file and a file uploade...
1ebc1db10959614999ea95c2678fcd2ac0eeb1b4409a676138bdcc2d0240ff08
Go
1,513
67
// Command Group: "FASTA and Multi-FASTA Tools" // Pull unique sequences from a fasta file package main import ( "flag" "fmt" "log" "github.com/vertgenlab/gonomics/dna" "github.com/vertgenlab/gonomics/fasta" ) func faUniq(inFile string, outFile string) { allSeqs := fasta.Read(inFile) seqsSeen := make(map[st...
1c2c92925375fa5e1c8eb75c91880252892e68b3863c5fbc0d4633a13256fc77
Go
1,521
54
package dnaThreeBit import ( "testing" ) //func Append(fragment *ThreeBit, b ThreeBitBase) *ThreeBit { // too confusing to have Append and append (from std lib) in this package? //func Cat(a *ThreeBit, b *ThreeBit) { // I was tempted to call this ligate //func Copy(a *ThreeBit) *ThreeBit { var dnaSeqs = []string{ ...
3f6edf54185383fc505a2f538617e1116ac325bbd729076a44a95038d5461e4a
Go
1,523
49
package pFasta import ( "fmt" "github.com/vertgenlab/gonomics/bed" "github.com/vertgenlab/gonomics/dna/pDna" "log" ) // Extract returns a new pFa that is a subsequence of the input pFa, defined by a // start (inclusive) and end (exclusive) position, like in bed; makes memory copy func Extract(input []PFasta, star...
00536a7a6cd724cf96ea15d187b2a86ece00569b065359cc575990ed7cd466ee
Go
1,533
65
package numbers import ( "math" "testing" ) var Float64Tests = []struct { Input []float64 Average float64 Variance float64 StdDev float64 }{ { Input: []float64{5, 8, 8, 3, 9, 7, 6, 7, 12, 9, 3, 1}, Average: 6.5, Variance: 9.545454545454545, StdDev: 3.089571903266623, }, } func TestFloat64...
3ca80111acfaaedeb8c36e1a80b2699b8e0b04d3e0c20e000b4c938d74619511
Go
1,533
46
package bed import ( "log" "strings" ) // negatePrevBed is a helper function to get regions as a bed that comes prev this bed. func negatePrevBed(curr Bed, prev int) (int, Bed) { if curr.ChromStart == 0 { log.Fatalf("Error: this helper function does not deal with the 0th base...\n") return 0, Bed{} } else { ...
575c8800f4ac4b4473b0b64f21e68203c0b6443232eadeaf3e5dc7e660ae7524
Go
1,533
56
package main import ( "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" "log" "os" "testing" "github.com/vertgenlab/gonomics/axt" "github.com/vertgenlab/gonomics/dna" "github.com/vertgenlab/gonomics/fasta" ) var axtStatsTests = []struct { inAXT string outStats string...
470815b34d0494ef868d79ab799547d294a104001757a24a02477fdbce8223df
Go
1,534
51
// Command Group: "Data Simulation" // Returns pseudorandomly generated DNA sequences in fasta format package main import ( "flag" "fmt" "log" "math/rand" "github.com/vertgenlab/gonomics/fasta" "github.com/vertgenlab/gonomics/fileio" "github.com/vertgenlab/gonomics/simulate" ) func randSeq(outFile string, GC...
d13798a72b17cd2ecfb5c600450fa95aa19b78726ac9d0098a2f23928945e19e
Go
1,538
62
// Command Group: "Data Conversion" // Convert a maf alignment into a multiple fasta alignment package main import ( "flag" "fmt" "log" "github.com/vertgenlab/gonomics/fasta" "github.com/vertgenlab/gonomics/fileio" "github.com/vertgenlab/gonomics/maf" ) func mafToMultiFa(inMaf string, inFa string, inSpeciesLi...
0d9f9cafba50fce6bf81d5c60b76b90ad21e623628ef8b42ad72fffa4ca8659f
Go
1,555
46
package genomeGraph import ( "log" "sort" ) func printSeedDev(a []*SeedDev) { for i := range a { log.Printf("tId:%d\ttStart:%d\tqStart:%d\tLen:%d\ttotalLen:%d\tposStrand:%t\n", a[i].TargetId, a[i].TargetStart, a[i].QueryStart, a[i].Length, a[i].TotalLength, a[i].PosStrand) } } func SortSeedDevByLen(seeds []*Se...
a1d67f3c3782695c0a987741b9cc9c37f81387c921684b5efd0015f7fe246fb8
Go
1,586
60
// Command Group: "Variant Calling & Annotation" // Adds ancestral allele to the INFO column of entries in a VCF file package main import ( "flag" "fmt" "log" "github.com/vertgenlab/gonomics/fasta" "github.com/vertgenlab/gonomics/fileio" "github.com/vertgenlab/gonomics/vcf" ) func vcfAncestorAnnotation(inFile...
d72ebfe238e38ae2f472955590bca6b7f0f7edca6279ff8198d471f61fb5e10d
Go
1,589
56
package popgen import ( "testing" "github.com/vertgenlab/gonomics/exception" ) var MaximumLikelihoodTests = []struct { VcfFile string Left float64 Right float64 Error float64 UnPolarized bool DivergenceAscertainment bool D ...
dc76f33a0d5fc40b8c45fd757551343b6a07279f144317308cd30637b4a24a18
Go
1,593
68
package fasta import ( "strings" "github.com/vertgenlab/gonomics/dna" ) // Remove fasta record with index i from slice of fasta. func Remove(slice []Fasta, i int) []Fasta { return append(slice[:i], slice[i+1:]...) } // RemoveGaps from all fasta records in a slice. func RemoveGaps(records []Fasta) []Fasta { for ...
10bcc73cd7524bc6c3c3670448c8f5a4e01151cdea199793569f3e98774e3aa0
Go
1,601
39
package main import ( "os" "testing" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" ) var MultiFaToVcfTests = []struct { inputFa string chromName string outputVcf string expectedVcf string substitutionsOnlyFlag bool retainN...
3ed79ddf2b7f4d7b1805df642163155d3145cad0de066965e1aa921de1facd0b
Go
1,611
62
// Package exception provides globally available functions to simplify exit after unrecoverable errors are encountered. package exception import ( "log" "math/rand" "os" "strings" ) // init is run as the exception package is imported and modifies the GODEBUG variable to contain // randautoseed=0 so that functions...
d10e9bc5124c235d6793482afe4ca082626cef5a268e64ebc1b0502bcd6ee20b
Go
1,612
62
package main import ( "os" "testing" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" ) var SubsequenceSwapTestCases = []struct { InFile string BackgroundName string ForegroundName string SwapRegions string ChromName string OutFile string ExpectedFi...
e5214e991e9130c45221296c1e22f3e991b408de4240a4042729294f2b3ad81d
Go
1,615
48
package motif import ( "github.com/vertgenlab/gonomics/fileio" "github.com/vertgenlab/gonomics/numbers" "github.com/vertgenlab/gonomics/numbers/parse" "strings" ) // AlmostEquals determines if floating-point numbers within two files are equal within a specified epsilon level. func ApproxEquals(alpha, beta string,...
2d7c5b3917eaa504f24f6d902043fbfc943c1c21ab35ab8b9b480c0db5fc54f5
Go
1,618
56
package interval type AggregateInterval struct { chr string start int end int tree map[string]*IntervalNode } func (a *AggregateInterval) GetChrom() string { return a.chr } func (a *AggregateInterval) GetChromStart() int { return a.start } func (a *AggregateInterval) GetChromEnd() int { return a.end } //...
62bf1e3507a3103f032587e96599dae95ac12e2539a03786340221d1ce147d4e
Go
1,618
64
package main import ( "flag" "fmt" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" "github.com/vertgenlab/gonomics/ontology/obo" "log" "os" ) type MappingSettings struct { InFile string OutFile string Force bool } func mappingUsage(mappingFlags *flag.FlagSet) { fmt.Pr...
60f3d16ef0a2f20b5056e1da446308c69cc3987c9c18443f962e0e73ddc662cb
Go
1,619
104
package parse import ( "testing" "golang.org/x/exp/constraints" "golang.org/x/exp/slices" ) func intContains(s []int, v int) bool { for i := range s { if s[i] == v { return true } } return false } func genericContains[E comparable](s []E, v E) bool { for i := range s { if s[i] == v { return true ...
580f15bfd686e43276efc46426d5b8c101f0fabc0a783ee761cf818e65e227a1
Go
1,620
54
package bedGraph import ( "os" "testing" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" ) var b1 BedGraph = BedGraph{Chrom: "chr1", ChromStart: 100, ChromEnd: 200, DataValue: 40.5} var b2 BedGraph = BedGraph{Chrom: "chr2", ChromStart: 400, ChromEnd: 900, DataValue: 10.2} var b...
27126038dbc8b84d9adcf8f0a241354965dd9d7c0e3cf99e7d66eb2f25b184fb
Go
1,622
58
package chain import ( "log" ) // TPosToQPos converts a target position in a chain to the corresponding query position. // The bool returns true if the returned TPos was found in a (Size) section of a Chain, and // false otherwise, as in when the TPos fell in TBases. func TPosToQPos(c Chain, TPos int) (int, bool) { ...
deb2f338cb13ed4225c41fcae3396490592567afefc413fbc56f1f283b965bfa
Go
1,626
58
// Command Group: "FASTA and Multi-FASTA Tools" // Align two or more sequences by "chunks" of bases instead of by single bases. Each sequence must // have a length that is divisible by the chunk size package main import ( "flag" "fmt" "github.com/vertgenlab/gonomics/align" "github.com/vertgenlab/gonomics/exceptio...
6d2bcacbb9014ec75c4f3f8462e3ced915bed39b721d74d33ac551ba72778bf9
Go
1,630
65
package interval import ( "fmt" "path" "github.com/vertgenlab/gonomics/axt" "github.com/vertgenlab/gonomics/bed" "github.com/vertgenlab/gonomics/chain" "github.com/vertgenlab/gonomics/sam" "github.com/vertgenlab/gonomics/vcf" ) // GoReadToChan reads Interval interfaces to a channel from an input file (bed, ax...
5eddcf4675b32f6d94fb21100e8bb74cb370d4c44eaac10f0a5007a284b7c468
Go
1,631
51
package vcf import ( "strings" "github.com/vertgenlab/gonomics/dna" ) // FixAllVcf runs FixVcf on each element in a slice of vcf structs. // Along with the slice of vcfs, it also needs the reference genome // in the form of chromosome names mapping to DNA sequences. func FixAllVcf(query []Vcf, ref map[string][]dna...
ad3aaf4b8bf2c42a28fe1c03bf5a6a7745e6fab2406dbe9aefb52688eab474cf
Go
1,638
68
// Command Group: "Genome Graph Tools" // GIRAF <-> GIRAF.FE conversion, for more information, see the giraf package package main import ( "flag" "fmt" "log" "path/filepath" "strings" "github.com/vertgenlab/gonomics/genomeGraph" "github.com/vertgenlab/gonomics/giraf/binaryGiraf" ) func usage() { fmt.Print( ...
fb288774a72e22bedbf53df1e081c6dcd14fc5e667198528f1b92aa5c83f590b
Go
1,642
71
package main import ( "os" "testing" "github.com/vertgenlab/gonomics/exception" //"github.com/vertgenlab/gonomics/exception". "github.com/vertgenlab/gonomics/fileio" "github.com/vertgenlab/gonomics/popgen" ) var SelectionMleTests = []struct { inputFile string outFile string exp...
627e786508d6e1302c1d1ad1df5a7786394b5144a280591fd1f6e873babe7c82
Go
1,645
80
package vcf import ( "os" "testing" ) var readWriteTests = []struct { filename string // input }{ {"testdata/test.vcf"}, {"testdata/GP_DP_Samples.vcf"}, {"testdata/SingleHapData.vcf"}, } func TestReadToChan(t *testing.T) { alpha, _ := Read("testdata/test.vcf") var beta []Vcf vcfPipe, _ := GoReadToChan("test...
c1d913c8d6d2224e73b1a08fab1335fa9aabd6e539a78fd57105cc22ff41d536
Go
1,647
54
// Command Group: "FASTA and Multi-FASTA Tools" // Provides human-readable multiple alignment from a given multiFa package main import ( "flag" "fmt" "github.com/vertgenlab/gonomics/browser" "github.com/vertgenlab/gonomics/numbers/parse" "log" ) func multFaVisualizer(infile string, outfile string, start int, en...
86fa639f6bb9491b681cb2e7ab2fa7a0d81df02112ee2669d5f82d6ef15cfe6e
Go
1,653
61
// Command Group: "Data Conversion" // Extracts sequences from a fasta file from regions specified by an input bed package main import ( "flag" "fmt" "log" "github.com/vertgenlab/gonomics/bed" "github.com/vertgenlab/gonomics/convert" "github.com/vertgenlab/gonomics/fasta" ) func bedToFasta(fastaFile string, b...
993a04695d1e17c3c5e84840fd3d4c80961ca6c884e3d38c4b50843597ea18d3
Go
1,655
87
package pFasta import ( "github.com/vertgenlab/gonomics/dna/pDna" "github.com/vertgenlab/gonomics/fileio" "testing" ) var WriteTests = []struct { OutFile string Records []PFasta Precision float32 }{ {OutFile: "testdata/out.test.pFa", Records: []PFasta{ {Name: "chr1", Seq: []pDna.Float32Base{ ...
22fcd82cfb1a6e1214a22c3f1d04c751d001cfbbbf3f1e93488f7df8094a32c9
Go
1,693
82
package fasta import ( "testing" "github.com/vertgenlab/gonomics/dna" ) func TestSeek(t *testing.T) { sr := NewSeeker("testdata/cornerCases.fa", "") ans, err := SeekByName(sr, "beta", 0, 2) if err != nil { t.Error(err) } if dna.BasesToString(ans) != "AG" { t.Error("problem with fasta seek") } ans, err ...
6136d9cc933df827eedc1288e510e2896518543164c88d0875957d7f9ea4bb3f
Go
1,702
64
package main import ( "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" "os" "testing" ) var FastqFormatTests = []struct { InFile string OutFile string ExpectedOutFile string R1InFile string R2InFile string R1OutFile string R...
dd4bc930dbc2e373a0e5d80bdd3123dbd5562754f02032661744c2d21cc50be5
Go
1,705
58
package numbers import ( "math" ) // GoldenSectionMaxSearch returns returns a local maximum for the input range a to b from an input function f with a user specified error epsilon. // For unimodal functions, we are guaranteed to find the maximum if it is contained within the interval a to b. For polymodal functions,...
44f7fa2312e39c4ad00dd7d3127e9068142f29be0e96ed84f89b9df88e596677
Go
1,708
58
package gtf import "sort" // CdnaLength returns the length of the cDNA in nucleotides. func CdnaLength(t *Transcript) int { var answer int = 0 for i := 0; i < len(t.Exons); i++ { answer += t.Exons[i].End - t.Exons[i].Start + 1 } return answer } // CdsLength returns the length of the Cds in nucleotides (after s...
16d56f78fc48b343a069912a8d2d950a91b94878e329688d616398c1a708cea1
Go
1,720
79
package fit import ( "math" "testing" ) var ZeroTruncatedNegativeBinomialTests = []struct { R float64 P float64 }{ { R: 1.0, P: 0.4, }, { R: 2, P: 0.1, }, { R: 2, P: 0.4, }, { R: 6, P: 0.4, }, { R: 6, P: 0.4, }, } func TestZeroTruncatedNegativeBinomial(t *testing.T) { var currR, cu...
e84306ce44875082c2add4021a9d494131ff934c4b5aaa10ed63ce3a3f9c020f
Go
1,722
57
package binaryGiraf import ( "io" "reflect" "testing" "github.com/vertgenlab/gonomics/cigar" "github.com/vertgenlab/gonomics/dna" "github.com/vertgenlab/gonomics/dna/dnaThreeBit" "github.com/vertgenlab/gonomics/fileio" "github.com/vertgenlab/gonomics/giraf" ) var TestQual = []uint8{40, 5, 5, 5, 5, 5, 5, 5, 3...
72ecaabc6050b4618e62428865ed22adc20b94bedd190953f405eca1296464f3
Go
1,733
61
package fit import ( "fmt" "math" "math/rand" "testing" "golang.org/x/exp/slices" ) func TestRunMixtureModel(t *testing.T) { maxIterations := 200 maxResets := 10 countPerComponent := 300 acceptableError := 0.05 var meanA, meanB, stdA, stdB float64 mm := new(MixtureModel) var converged bool data := make(...
d5e66f569d33974d8cf118ea15063317e3bab663d68c6483896ea71f4989cc76
Go
1,733
53
package numbers import ( "math" "math/rand" ) // RandGeometric returns a geometrically-distributed random variate using the inverse transform. // Note the geometric distribution has CDF: F(x) = 1 - (1-p)^x. // The inverse transform is derived as (1-p)^x = 1 - F(x) -> x*log(1-p) = log(1 - F(x)) -> x = log(1 - F(x)) ...
240c49addfeff73b3262a6a158bcd5ea71189b3f46ef40a065a5a8dbb1652375
Go
1,737
44
package main import ( "github.com/vertgenlab/gonomics/exception" "os" "testing" "github.com/vertgenlab/gonomics/fileio" ) var VcfToFaTests = []struct { inputVcfFile string inputFaFile string actualOutputFile string expectedOutputFile string useAlt bool useSamples bool ha...
b86ac75ae58f42df9381293feb3e3b4d4e8cc96c9ac5b9b513c201e7d37345be
Go
1,740
84
package bedpe import ( "os" "testing" "github.com/vertgenlab/gonomics/bed" "github.com/vertgenlab/gonomics/exception" ) var b1 BedPe = BedPe{ A: bed.Bed{ Chrom: "chr2", ChromStart: 200, ChromEnd: 240, Name: "First", Score: 40, Strand: '...
6705890a434d23af588a9922e403e1b2d8a7a6c1150fb5153a7e64a239874e5f
Go
1,741
65
package sam import ( "fmt" "testing" "github.com/vertgenlab/gonomics/chromInfo" "github.com/vertgenlab/gonomics/fileio" ) func TestReadHeaderBytes(t *testing.T) { br := fileio.EasyOpen("testdata/small.sam") header := ReadHeader(br) expectedChrom := chromInfo.ChromInfo{Name: "ref", Size: 45, Order: 0} if len...
995a56b67af7ae4f7fc2c335a11b4955dff5aa53f44e5e1aa8d4eb12f442916d
Go
1,751
70
package genePred import ( "strings" ) // AllAreEqual examines if two genePred files are the same entry by entry. The first unequal record will be returned with a slice of ints that refer to which fields are unequal. func AllAreEqual(a []GenePred, b []GenePred) (bool, []int) { var fields []int var equal bool if l...
751e04a8bcb546a642bcda3d6eb3a1ed41c2ab689b4d7d818ea627fef929d0cf
Go
1,759
48
package main import ( "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" "os" "testing" ) var BedMergeTests = []struct { InFile string ExpectedFile string OutFile string MergeAdjacent bool Pad int LowMem bool KeepAllNames bool }{ {"testdata/t...
9581f2fb176d21e43399ad52cac3395a482d104268d76ea358d548c7bba25969
Go
1,776
40
package main import ( "os" "testing" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" ) var BedPeOverlapTests = []struct { selectFile string inBedPe string outBedPe string bedSelect bool overlapBoth bool overlapThreshold float64 keepName...
c4cd68d1c9dbcfe66775b7b4b8b4726df74058dd84e8bbf1c786a8d7c338305c
Go
1,777
35
// Package vcf contains functions for reading, writing, and manipulating VCF format files. More information on the VCF file format can be found // in its official documentation at https://samtools.github.io/hts-specs/VCFv4.3.pdf. This file is parsed into a struct containing header information // as well as a Vcf struct...
0fe5bf10265d55a3e51c21a35fd7035d72bc2af4a25026f29b3749d7d64f90d0
Go
1,784
56
// Package sketch provides utilities and color palettes for plotting graphs and images package sketch import ( "image" "image/color" "golang.org/x/image/font" "golang.org/x/image/font/basicfont" "golang.org/x/image/math/fixed" ) // HLine draws a horizontal line on the given image between the xStart and xEnd coo...
d17f190d63bd7c45dacce094f0069fabc48cd440c5f31e8c519b605cab5929e8
Go
1,785
117
package convert import ( "log" ) // EnsemblToUCSC converts ensembl-style human chromosome names to the standard UCSC format chromosome names. func EnsemblToUCSC(in string) string { switch in { case "1": return "chr1" case "2": return "chr2" case "3": return "chr3" case "4": return "chr4" case "5": re...
0db30858afb9b006414622d2d63f9f47bfd2424015b3c489bea185ca2c52ef6d
Go
1,786
33
package popgen import ( "github.com/vertgenlab/gonomics/numbers" ) // MleSettings delineates the experimental parameters for running maximum likelihood estimation on a set of variants using selectionMLE. type MleSettings struct { Left float64 //left bound of MLE search space Right ...
c362f47f026b18c18165c9f1c68559e5c7185fa3ce600f1a8152428f6b3059f9
Go
1,808
79
package main import ( "os" "testing" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" ) var SimulateDivergentWindowsVcfTests = []struct { ExpectedUpper string ExpectedLower string TmpUpper string TmpLower string Alpha float64 NumAlleles int...
5f72665e71e8a9683787773d5bd7ff0f598a93a8ad48248d45341a7c96dc9b2a
Go
1,812
71
package main import ( "os" "testing" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" ) var WithIndelsTests = []struct { InputFastaFile string OutFile string BranchLength float64 Lambda float64 PropIndels float64 GcContent float64 SetSeed ...
2a4c1e2d7296362c13dc120634df06dff33346c544abaf8fa2f4258b4917b1ca
Go
1,826
58
package phylo import ( "fmt" "testing" ) var BranchLengthsAlternatingLeastSquaresTests = []struct { D AccelDistancesAndWeights AllowNegative bool Epsilon float64 ExpectedBranchLengths AccelBranchLengths CavalliSforzaQ bool }{ {AccelDistancesAndWeights{ //This p...
d4e9390b39f83dabd82b619bc80bc32a23507c592a29b1f4bea2a30ab9cf2a8e
Go
1,830
63
package fasta import ( "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" "os" "sort" "testing" "github.com/vertgenlab/gonomics/dna" ) var contigOneSeq = dna.StringToBases("ACGTGAGTGAGTAGGACCACGATGACACGANNTGA") var contigTwoSeq = dna.StringToBases("GgtAC") var contigThreeSeq = d...
dc2d7ad79c5ea4757e08f2e114928a2089a4034acd4276bff90cc0f50933cd7e
Go
1,830
54
package gene import "github.com/vertgenlab/gonomics/dna" // Reset reverts all mutations done to a Gene. func Reset(g *Gene) { var hasIndel bool var err error for _, val := range g.changeLog { if len(val.added) != 1 || len(val.removed) != 1 { hasIndel = true break } } if !hasIndel { // Point mutations ...
664a549dee78d090c6a10e0489bbc368d00278afc4b6dbcfa96fe5d920bb7dcb
Go
1,831
59
// Command Group: "VCF Tools" // Returns a sample from a VCF file with a specified number of results package main import ( "flag" "fmt" "log" "math/rand" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" "github.com/vertgenlab/gonomics/vcf" ) // sampleVcf takes a VCF file and...
632ab2fee75d222ab2ba99572ff74a4d0826a6a38386a356911d592d8c8e4be2
Go
1,841
101
package main import ( "os" "testing" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" "github.com/vertgenlab/gonomics/popgen" ) var SimulateWFTests = []struct { OutFile string ExpectedFile string PopSize int MutRate float64 NumGen int GenomeSize ...
d303e09cc3e8a0bdeee0e7f7f0b421c18bba2033ec993e0f32b097286f23f866
Go
1,846
72
package main import ( "flag" "fmt" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" "github.com/vertgenlab/gonomics/sam" "log" "os" ) type ReadLengthSettings struct { InFile string OutFile string } func readLengthUsage(readLengthFlags *flag.FlagSet) { fmt.Printf("samInfo ...
e2490a9f789e09ce235ef6472b819774b1ae042d70a086d5c06851c0db41d812
Go
1,848
28
package tree import ( "testing" ) var treeTests = []struct { treeText string }{ {"(human,chimp)ancestor;"}, {"((human,chimp),rhesus);"}, {"(((human,chimp),(mouse,rat)),dog);"}, {"((platypus,(opossum,((((rat,mouse),rabbit),human),dog))),(lizard,bird));"}, {"(((((((((((((((((((hg19:0.006653,panTro2:0.006643):0.0...
10726db08db286d2751da8a8028b93f27851f9ed8d0265c4fc09fb58077b8770
Go
1,853
73
package main import ( "flag" "fmt" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fasta" "github.com/vertgenlab/gonomics/fastq" "github.com/vertgenlab/gonomics/fileio" "log" "sort" ) func longReadLibStats(inFq string, outfile string, readLengths string) { var lens []int var tot i...
ccde6eb758b94dbe83701875be13935e682fd712db079c604b808e5fc42e3d16
Go
1,853
72
// Command Group: "General Tools" // Returns all regions that contact input genomic regions package main import ( "flag" "fmt" "log" "github.com/vertgenlab/gonomics/bed" "github.com/vertgenlab/gonomics/bed/bedpe" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" "github.com/v...
efcaf811076bc6092094144edce03192a228a765a75f71bb79b66e8d4939d187
Go
1,855
60
// Command Group: "FASTA and Multi-FASTA Tools" // Align two or more sequences by "chunks" of bases instead of by single bases. Each sequence must // have a length that is divisible by the chunk size package main import ( "flag" "fmt" "github.com/vertgenlab/gonomics/align" "github.com/vertgenlab/gonomics/exceptio...
e935a4c4b61365dbcd2f263c1a12ba6975893ace27ac2d5283ab0c53e5675541
Go
1,886
72
// Command Group: "Sequence Evolution & Reconstruction" // Command Usage: "Create PNG of Newick tree" // Reads a newick format text file to a png for tree visualization package main import ( "flag" "fmt" "image" "image/png" "log" "os" "github.com/vertgenlab/gonomics/tree" ) // drawNewickTree takes in a newic...
c396e2107f7d4c08ba38eb11b9f3429c06e8b6ddac3db38eed81de45e0aa05d9
Go
1,889
73
package main import ( "flag" "fmt" "github.com/vertgenlab/gonomics/bed" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" "github.com/vertgenlab/gonomics/interval" "log" "math" ) func bedTrim(trimPercent int, inBed string, outBed string) { var size, toRemoveInt int var toRem...
cec38522b3cba997ff9f3a496cca89040e68de17577fa8196d7757572f180e4c
Go
1,889
66
package fastq import ( "github.com/vertgenlab/gonomics/exception" "math" "strings" ) // SAM format uses ascii offset of 33 to make everything start with individual characters // without adding 33 you get values like spaces and newlines. const asciiOffset uint8 = 33 // ToQualUint8 converts a slice of runes to uint...
9433bd3fac7bfd4051677bd8048fc7e6e133fd6b8446c91b5f4e711cd631376d
Go
1,908
73
package main import ( "flag" "fmt" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/wig" "log" "os" ) // FilterSettings defines the usage settings for the wigTools filter subcommand. type FilterSettings struct { InFile string ChromSizes string OutFile string Chrom ...
681135b8fe0e15903b521eb0538de340a9bc511248822a6846062c256dd3c2fd
Go
1,914
62
package main import ( "os" "testing" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" ) var VcfInfoTests = []struct { InFile string TypesOutFile string DivergenceOutFile string TypesExpectedFile string DivergenceExpectedFile string }{ {"...
b7b98bc895a8a78290eb604ec11919e0eb8c2e065be6d29b3423d8feedb8f257
Go
1,915
75
package main import ( "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" "os" "testing" ) var SamToWigTests = []struct { InFile string Reference string OutFile string ExpectedFile string FragLength int DefaultValue float64 Deletions bool }{ {InFile: "test...
2f750fc8993fcfba9263942917d8aa288c4eed7d5f9842a307c42541cc0b035b
Go
1,919
66
package main import ( "os" "testing" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" ) var haplotypeGeneratorTests = []struct { InputFaFile string InputVcfFile string InputBedFile string OutDir string IncludeRef bool LineLength int Verbose int Out...
fa1259818ad04a0fe8496310d4d19ed110be06c3f593d39ccf2e0ee3ba37546e
Go
1,921
70
// Package chromInfo provides function to read and manipulate chromInfo files package chromInfo import ( "log" "strconv" "strings" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" ) // ChromInfo stores the chromosome name and size of each chromosome as well as the order they ap...
a72f1585b001571b6733bd93f3482057bea5d2826ec446ea5a6509d9b09457a3
Go
1,926
85
package fileio import ( "errors" "log" ) // Close the receiving EasyReader. func (er *EasyReader) Close() error { var gzErr, fileErr error if er.internalGzip != nil { gzErr = er.internalGzip.Close() } if er.File != nil { fileErr = er.File.Close() } else { return errors.New("no file found") } switch { ...
06a39cdf78caf43adcb9a2156d2e32052833c717550f0c998f91cf8e2b97a7b4
Go
1,927
83
package vcf import ( "testing" ) func TestSamplesToString(t *testing.T) { tests := []struct { name string samples []Sample expected string }{ { name: "Single sample", samples: []Sample{ {Alleles: []int16{0, 1}, Phase: []bool{false, false}, FormatData: []string{""}}, }, expected: "0/1",...
e8a6c3c10aa9ab3be7f716073097cb966ef51d5ae6bdb4d8f9107bd55f79d08a
Go
1,929
81
package main import ( "flag" "fmt" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" "github.com/vertgenlab/gonomics/ontology" "github.com/vertgenlab/gonomics/ontology/gaf" "github.com/vertgenlab/gonomics/ontology/obo" "log" "sort" ) func ontologyHistogram(oboFile string, gaf...
5a6b01becb91d25a8299eeb9f27d8949b6c9c25020c9d1224487b92c8be267ad
Go
1,946
75
package main import ( "flag" "fmt" "github.com/vertgenlab/gonomics/bed" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/fileio" "github.com/vertgenlab/gonomics/numbers" "github.com/vertgenlab/gonomics/sam" "log" ) type settings struct { inBam string inBed string outFile strin...