"text":"Preface\nThe first version of OBITools started to be developed in 2005. This was at the beginning of the DNA metabarcoding story at the Laboratoire d’Ecologie Alpine (LECA) in Grenoble. At that time, with Pierre Taberlet and François Pompanon, we were thinking about the potential of this new methodology under development. PIerre and François developed more the laboratory methods, while I was thinking more about the tools for analysing the sequences produced. Two ideas were behind this development. I wanted something modular, and something easy to extend. To achieve the first goal, I decided to implement obitools as a suite of unix commands mimicking the classic unix commands but dedicated to sequence files. The basic unix commands are very useful for automatically manipulating, parsing and editing text files. They work in flow, line by line on the input text. The result is a new text file that can be used as input for the next command. Such a design makes it possible to quickly develop a text processing pipeline by chaining simple elementary operations. The OBITools are the exact counterpart of these basic Unix commands, but the basic information they process is a sequence (potentially spanning several lines of text), not a single line of text. Most OBITools consume sequence files and produce sequence files. Thus, the principles of chaining and modularity are respected. In order to be able to easily extend the OBITools to keep up with our evolving ideas about processing DNA metabarcoding data, it was decided to develop them using an interpreted language: Python. Python 2, the version available at the time, allowed us to develop the OBITools efficiently. When parts of the algorithms were computationally demanding, they were implemented in C and linked to the Python code. Even though Python is not the most efficient language available, even though computers were not as powerful as they are today, the size of the data we could produce using 454 sequencers or early solexa machines was small enough to be processed in a reasonable time.\nThe first public version of obitools was OBITools2 (Boyer et al. 2016), this was actually a cleaned up and documented version of OBITools that had been running at LECA for years and was not really distributed except to a few collaborators. This is where OBITools started its public life from then on. The DNA metabarcoding spring schools provided and still provide user training every year. But OBITools2 soon suffered from two limitations: it was developed in Python2, which was increasingly abandoned in favour of Python3, and the data size kept increasing with the new illumina machines. Python’s intrinsic slowness coupled with the increasing size of the datasets made OBITools computation times increasingly long. The abandonment of all maintenance of Python2 by its developers also imposed the need for a new version of OBITools.\nOBITools3 was the first response to this crisis. Developed and maintained by Céline Mercier, OBITools3 attempted to address several limitations of OBITools2. It is a complete new code, mainly developed in Python3, with most of the lower layer code written in C for efficiency. OBITools3 has also abandoned text files for binary files for the same reason of efficiency. They have been replaced by a database structure that keeps track of every operation performed on the data.\nHere we present OBITools4 which can be seen as a return to the origins of OBITools. While OBITools3 offered traceability of analyses, which is in line with the concept of open science, and faster execution, OBITools2 was more versatile and not only usable for the analysis of DNA metabarcoding data. OBITools4 is the third full implementation of OBITools. The idea behind this new version is to go back to the original design of OBITools which ran on text files containing sequences, like the classic Unix commands, but running at least as fast as OBITools3 and taking advantage of the multicore architecture of all modern laptops. For this, the idea of relying on an interpreted language was
},
{
"objectID": "intro.html#aims-of-obitools",
"href": "intro.html#aims-of-obitools",
"title": "TheOBITools",
"section": "AimsofOBITools",
"text": "AimsofOBITools\nDNAmetabarcodingisanefficientapproachforbiodiversitystudies(Taberletetal.2012).Originallymainlydevelopedbymicrobiologists(e.g.Soginetal.2006),itisnowwidelyusedforplants(e.g.Sønstebøetal.2010;Yoccozetal.2012;Parduccietal.2012)andanimalsfrommeiofauna(e.g.Charitonetal.2010;Baldwinetal.2013)tolargerorganisms(e.g.Andersenetal.2012;Thomsenetal.2012).Interestingly,thismethodisnotlimitedtosensustrictobiodiversitysurveys,butitcanalsobeimplementedinotherecologicalcontextssuchasforherbivore(e.g.Valentinietal.2009;Kowalczyketal.2011)orcarnivore(e.g.Deagle,Kirkwood,andJarman2009;Shehzadetal.2012)dietanalyses.\nWhateverthebiologicalquestionunderconsideration,theDNAmetabarcodingmethodologyreliesheavilyonnext-generationsequencing(NGS),andgeneratesconsiderablenumbersofDNAsequencereads(typicallymillionofreads).ManipulationofsuchlargedatasetsrequiresdedicatedprogramsusuallyrunningonaUnixsystem.Unixisanoperatingsystem,whosefirstversionwascreatedduringthesixties.Sinceitsearlystages,itisdedicatedtoscientificcomputingandincludesalargesetofsimpletoolstoefficientlyprocesstextfiles.Mostofthoseprogramscanbeviewedasfiltersextractinginformationfromatextfiletocreateanewtextfile.Theseprogramsprocesstextfilesasstreams,lineperline,thereforeallowingcomputationonahugedatasetwithoutrequiringalargememory.Unixprogramsusuallyprinttheirresultstotheirstandardoutput(stdout),whichbydefaultistheterminal,sotheresultscanbeexaminedonscreen.ThemainphilosophyoftheUnixenvironmentistoalloweasyredirectionofthestdouteithertoafile,forsavingtheresults,ortothestandardinput(stdin)ofasecondprogramthusallowingtoeasilycreatecomplexprocessingfromsimplebasecommands.AccesstoUnixcomputersisincreasinglyeasierforscientistsnowadays.Indeed,theLinuxoperatingsystem,anopensourceversionofUnix,canbefreelyinstalledoneveryPCmachineandtheMacOSoperatingsystem,runningonApplecomputers,isalsoaUnixsystem.TheOBIToolsprogramsimitateUnixstandardprogramsbecausetheyusuallyactasfilters,readingtheirdatafromtextfilesorthestdinandwritingtheirresultstothestdout.ThemaindifferencewithclassicalUnixprogramsisthattextfilesarenotanalyzedlineperlinebutsequencerecordpersequencerecord(seebelowforadetaileddescriptionofasequencerecord).Comparedtopackagesforsimilarpurposeslikemothur(Schlossetal.2009)orQIIME(Caporasoetal.2010),theOBIToolsmainlyrelyonfilteringandsortingalgorithms.Thisallowsuserstosetupversatiledataanalysispipelines(Figure1),adjustabletothebroadrangeofDNAmetabarcodingapplications.TheinnovationoftheOBIToolsistheirabilitytotakeintoaccountthetaxonomicannotations,ultimatelyallowingsortingandfilteringofsequencerecordsbasedonthetaxonomy.\n\n\n\n\nAndersen,Kenneth,KarenLiseBird,MortenRasmussen,JamesHaile,HenrikBreuning-Madsen,KurtHKjaer,LudovicOrlando,MThomasPGilbert,andEskeWillerslev.2012.“Meta-barcodingofëdirtı́DNAfromsoilreflectsvertebratebiodiversity.”MolecularEcology21(8):1966–79.\n\n\nBaldwin,DarrenS,MatthewJColloff,GavinNRees,AnthonyAChariton,GarthOWatson,LeonNCourt,DianaMHartley,etal.2013.“Impactsofinundationanddroughtoneukaryotebiodiversityinsemi-aridfloodplainsoils.”MolecularEcology22(6):1746–58.https://doi.org/10.1111/mec.12190.\n\n\nCaporaso, J Gregory, Justin Kuczynski, Jesse Stombaugh, Kyle Bittinger, Frederic D Bushman, Elizabeth K Costello, Noah Fierer, et al. 2010. “QIIME allows analysis of high-throughput community sequencing data.” Nature Methods 7 (5): 335–36. https://doi.org/10.1038/nmeth.f.303.\n\n\nChariton, Anthony A, Anthony C Roach, Stuart L Simpson, and Graeme E Batley. 2010. “Influ
"text":"1.1 Availability of the OBITools\nThe OBITools are open source and protected by the CeCILL 2.1 license.\nAll the sources of the OBITools4 can be downloaded from the metabarcoding git server (https://git.metabarcoding.org)."
"text":"1.2 Prerequisites\nThe OBITools4 are developped using the GO programming language, we stick to the latest version of the language, today the 1.21.41.21.4. If you want to download and compile the sources yourself, you first need to install the corresponding compiler on your system. Some parts of the soft are also written in C, therefore a recent C compiler is also requested, GCC on Linux or Windows, the Developer Tools on Mac.\nWhatever the installation you decide for, you will have to ensure that a C compiler is available on your system."
"text":"1.3 Installation with the install script\nAn installation script that compiles the new OBITools on your Unix-like system is available online. The easiest way to run it is to copy and paste the following command into your terminal\n\ncurl -L https://metabarcoding.org/obitools4/install.sh | bash\n\nBy default, the script installs the OBITools commands and other associated files into the /usr/local directory. The names of the commands in the new OBITools4 are mostly identical to those in OBITools2. Therefore, installing the new OBITools may hide or delete the old ones. If you want both versions to be available on your system, the installation script offers two options:\n\n-i, –install-dir Directory where OBITools are installed (as example use /usr/local not /usr/local/bin).\n-p, –obitools-prefix Prefix added to the OBITools command names if you want to have several versions of obitools at the same time on your system (as example -p g will produce gobigrep command instead of obigrep).\n\nYou can use these options by following the installation command:\n\ncurl -L https://metabarcoding.org/obitools4/install.sh | \\\n bash -s -- --install-dir test_install --obitools-prefix k\n\nIn this case, the binaries will be installed in the test_install directory and all command names will be prefixed with the letter k. Thus obigrep will be named kobigrep."
"text":"2.1 The DNA sequence data\nSequences can be stored following various format. OBITools knows some of them. The central formats for sequence files manipulated by OBITools scripts are the FASTA and FASTQ format. OBITools extends the both these formats by specifying a syntax to include in the definition line data qualifying the sequence. All file formats use the IUPAC code for encoding nucleotides.\nMoreover these two formats that can be used as input and output formats, OBITools4 can read the following format :\n\nEBML flat file format (use by ENA)\nGenbank flat file format\necoPCR output files\n\n\n2.1.1 The IUPAC Code\nThe International Union of Pure and Applied Chemistry (IUPAC) defined the standard code for representing protein or DNA sequences.\n\n\n\nCode\nNucleotide\n\n\n\n\nA\nAdenine\n\n\nC\nCytosine\n\n\nG\nGuanine\n\n\nT\nThymine\n\n\nU\nUracil\n\n\nR\nPurine (A or G)\n\n\nY\nPyrimidine (C, T, or U)\n\n\nM\nC or A\n\n\nK\nT, U, or G\n\n\nW\nT, U, or A\n\n\nS\nC or G\n\n\nB\nC, T, U, or G (not A)\n\n\nD\nA, T, U, or G (not C)\n\n\nH\nA, T, U, or C (not G)\n\n\nV\nA, C, or G (not T, not U)\n\n\nN\nAny base (A, C, G, T, or U)\n\n\n\n\n\n2.1.2 The FASTA sequence format\nThe FASTA format is certainly the most widely used sequence file format. This is certainly due to its great simplicity. It was originally created for the Lipman and Pearson FASTA program. OBITools use in more of the classical FASTA format an extended version of this format where structured data are included in the title line.\nIn FASTA format a sequence is represented by a title line beginning with a > character and the sequences by itself following the IUPAC code. The sequence is usually split other severals lines of the same length (expect for the last one)\n>my_sequence this is my pretty sequence\nACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGT\nGTGCTGACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGTGTTT\nAACGACGTTGCAGTACGTTGCAGT\nThis is no special format for the title line excepting that this line should be unique. Usually the first word following the > character is considered as the sequence identifier. The end of the title line corresponding to a description of the sequence. Several sequences can be concatenated in a same file. The description of the next sequence is just pasted at the end of the record of the previous one\n>sequence_A this is my first pretty sequence\nACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGT\nGTGCTGACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGTGTTT\nAACGACGTTGCAGTACGTTGCAGT\n>sequence_B this is my second pretty sequence\nACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGT\nGTGCTGACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGTGTTT\nAACGACGTTGCAGTACGTTGCAGT\n>sequence_C this is my third pretty sequence\nACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGT\nGTGCTGACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGTACGTTGCAGTGTTT\nAACGACGTTGCAGTACGTTGCAGT\n\n2.1.2.1 File extensions\nThere is no standard file extension for a FASTA file, but .fa and .fasta, are commonly used.\n\n\n\n2.1.3 The FASTQ sequence format1\nThe FASTQ format is a text file format for storing both biological sequences (only nucleic acid sequences) and the associated sequence quality scores. Every nucleotide of the sequence and its associated quality score are each encoded by a single ASCII character. This format was originally developed by the Wellcome Trust Sanger Institute to link a FASTA sequence file to the corresponding quality data, but is now became the de facto standard for storing results from high-throughput sequencers (Cock et al. 2010).\nOBITools considers that a FASTQ file uses four lines to encode a sequence record.\n\nLine 1 begins with a ‘@’ character and is followed by a sequence identifier and an optional description (like a FASTA title line).\nLine 2 is the sequence letters, in upper or lower case, but OBITools only write sequences as lower cases.\nLine 3 begins with a ‘+’ character and is optionally followed by the same sequence identifier (and any description) again.\nLin
"text": "3.2Stepbystepanalysis\n\n3.2.1Recoverfullsequencereadsfromforwardandreversepartialreads\nWhenusingtheresultofapaired-endsequencingassaywithsupposedlyoverlappingforwardandreversereads,thefirststepistorecovertheassembledsequence.\nTheforwardandreversereadsofthesamefragmentareatthesamelinepositioninthetwofastqfilesobtainedaftersequencing.Basedonthesetwofiles,theassemblyoftheforwardandreversereadsisdonewiththeobipairingutilitythatalignsthetworeadsandreturnsthereconstructedsequence.\nInourcase,thecommandis:\n\nobipairing--min-identity=0.8\\\n--min-overlap=10\\\n-Fwolf_data/wolf_F.fastq\\\n-Rwolf_data/wolf_R.fastq\\\n>results/wolf.fastq\n\nThe--min-identityand--min-overlapoptionsallowdiscardingsequenceswithlowalignmentquality.Ifafterthealigment,theoverlapingpartsofthereadsisshorterthan10basepairsorthesimilarityoverthisalignedregionisbelow80%ofidentity,intheoutputfile,theforwardandreversereadsarenotalignedbutconcatenated,andthevalueofthemodeattributeinthesequenceheaderissettojoinedinsteadofalignment.\n\n\n3.2.2Removeunalignedsequencerecords\nUnalignedsequences(:pymode=joined)cannotbeused.Thefollowingcommandallowsremovingthemfromthedataset:\n\nobigrep-p'annotations.mode!=\"join\"' \\\n results/wolf.fastq > results/wolf.ali.fastq\n\nThe -p requires a go like expression. annotations.mode != \"join\" means that if the value of the mode annotation of a sequence is different from join, the corresponding sequence record will be kept.\nThe first sequence record of wolf.ali.fastq can be obtained using the following command line:\n\nhead -n 4 results/wolf.ali.fastq\n\nThe folling piece of code appears on thew window of tour terminal.\n@HELIUM_000100422_612GNAAXX:7:108:5640:3823#0/1 {\"ali_dir\":\"left\",\"ali_length\":62,\"mode\":\"alignment\",\"pairing_mismatches\":{\"(T:26)->(G:13)\":62,\"(T:34)->(G:18)\":48},\"score\":484,\"score_norm\":0.968,\"seq_a_single\":46,\"seq_ab_match\":60,\"seq_b_single\":46}\nccgcctcctttagataccccactatgcttagccctaaacacaagtaattaatataacaaaattgttcgccagagtactaccggcaatagcttaaaactcaaaggacttggcggtgctttatacccttctagaggagcctgttctaaggaggcgg\n+\nCCCCCCCBCCCCCCCCCCCCCCCCCCCCCCBCCCCCBCCCCCCC<CcCccbe[`F`accXV<TA\\RYU\\\\ee_e[XZ[XEEEEEEEEEE?EEEEEEEEEEDEEEEEEECCCCCCCCCCCCCCCCCCCCCCCACCCCCACCCCCCCCCCCCCCCC\n\n\n3.2.3 Assign each sequence record to the corresponding sample/marker combination\nEach sequence record is assigned to its corresponding sample and marker using the data provided in a text file (here wolf_diet_ngsfilter.txt). This text file contains one line per sample, with the name of the experiment (several experiments can be included in the same file), the name of the tags (for example: aattaac if the same tag has been used on each extremity of the PCR products, or aattaac:gaagtag if the tags were different), the sequence of the forward primer, the sequence of the reverse primer, the letter T or F for sample identification using the forward primer and tag only or using both primers and both tags, respectively (see obimultiplex for details).\n\nobimultiplex -t wolf_data/wolf_diet_ngsfilter.txt \\\n -u results/unidentified.fastq \\\n results/wolf.ali.fastq \\\n > results/wolf.ali.assigned.fastq\n\nThis command creates two files:\n\nunidentified.fastq containing all the sequence records that were not assigned to a sample/marker combination\nwolf.ali.assigned.fastq containing all the sequence records that were properly assigned to a sample/marker combination\n\nNote that each sequence record of the wolf.ali.assigned.fastq file contains only the barcode sequence as the sequences of primers and tags are removed by the obimultiplex program. Information concerning the experiment, sample, primers and tags is added as attributes in the sequence header.\nFor instance, the first sequence record of wolf.ali.assigned.fastq is:\n@HELIUM_000
"text": "7.3Accessingtothesequenceannotations\nTheannotationsvariableisamapobjectcontainingalltheannotationsassociatedtothecurrentlyprocessedsequence.Indexofthemaparetheattributenames.Itexiststopossibillitiestoretreiveanannotation.Itispossibletousetheclassical[]indexingoperator,puttingtheattributenamequotedbydoublequotesbetweenthem.\nannotations[\"direction\"]\nThe above code retreives the direction annotation. A second notation using the dot (.) is often more convenient.\nannotations.direction\nSpecial attributes of the sequence are accessible only by dedicated methods of the sequence object.\n\nThe sequence identifier : Id()\nTHe sequence definition : Definition()\n\nsequence.Id()"
"text":"11.1 obipairing\n\nReplace the illuminapairedends original OBITools\n\n\nAlignment procedure\nobipairing is introducing a new alignment algorithm compared to the illuminapairedend command of the OBITools V2. Nethertheless this new algorithm has been design to produce the same results than the previous, except in very few cases.\nThe new algorithm is a two-step procedure. First, a FASTN-type algorithm (Lipman and Pearson 1985) identifies the best offset between the two matched readings. This identifies the region of overlap.\nIn the second step, the matching regions of the two reads are extracted along with a flanking sequence of Δ\\Delta base pairs. The two subsequences are then aligned using a “one side free end-gap” dynamic programming algorithm. This latter step is only called if at least one mismatch is detected by the FASTP step.\nUnless the similarity between the two reads at their overlap region is very low, the addition of the flanking regions in the second step of the alignment ensures the same alignment as if the dynamic programming alignment was performed on the full reads.\n\n\nThe scoring system\nIn the dynamic programming step, the match and mismatch scores take into account the quality scores of the two aligned nucleotides. By taking these into account, the probability of a true match can be calculated for each aligned base pair.\nIf we consider a nucleotide read with a quality score QQ, the probability of misreading this base (PEP_E) is : PE=10−Q10\nP_E = 10^{-\\frac{Q}{10}}\n\nThus, when a given nucleotide XX is observed with the quality score QQ. The probability that XX is really an XX is :\nP(X=X)=1−PE\nP(X=X) = 1 - P_E\n\nOtherwise, XX is actually one of the three other possible nucleotides (XE1X_{E1}, XE2X_{E2} or XE3X_{E3}). If we suppose that the three reading error have the same probability :\nP(X=XE1)=P(X=XE3)=P(X=XE3)=PE3\nP(X=X_{E1}) = P(X=X_{E3}) = P(X=X_{E3}) = \\frac{P_E}{3}\n\nAt each position in an alignment where the two nucleotides X1X_1 and X2X_2 face each other (not a gapped position), the probability of a true match varies depending on whether X1=X2X_1=X_2, an observed match, or X1≠X2X_1 \\neq X_2, an observed mismatch.\nProbability of a true match when X1=X2X_1=X_2\nThat probability can be divided in two parts. First X1X_1 and X2X_2 have been correctly read. The corresponding probability is :\nPTM=(1−PE1)(1−PE2)=(1−10−Q110)(1−10−Q210)\n\\begin{aligned}\nP_{TM} &= (1- PE_1)(1-PE_2)\\\\ \n &=(1 - 10^{-\\frac{Q_1}{10} } )(1 - 10^{-\\frac{Q_2}{10}} )\n\\end{aligned}\n\nSecondly, a match can occure if the true nucleotides read as X1X_1 and X2X_2 are not X1X_1 and X2X_2 but identical.\nP(X1==XE1)∩P(X2==XE1)=PE1PE29P(X1==XEx)∩P(X2==XEx)=PE1PE23\n\\begin{aligned}\nP(X_1==X_{E1}) \\cap P(X_2==X_{E1}) &= \\frac{P_{E1} P_{E2}}{9} \\\\\nP(X_1==X_{Ex}) \\cap P(X_2==X_{Ex}) & = \\frac{P_{E1} P_{E2}}{3}\n\\end{aligned}\n\nThe probability of a true match between X1X_1 and X2X_2 when X1=X2X_1 = X_2 an observed match :\nP(MATCH|X1=X2)=(1−PE1)(1−PE2)+PE1PE23\n\\begin{aligned}\nP(MATCH | X_1 = X_2) = (1- PE_1)(1-PE_2) + \\frac{P_{E1} P_{E2}}{3}\n\\end{aligned}\n\nProbability of a true match when X1≠X2X_1 \\neq X_2\nThat probability can be divided in three parts.\n\nX1X_1 has been correctly read and X2X_2 is a sequencing error and is actually equal to X1X_1. Pa=(1−PE1)PE23\nP_a = (1-P_{E1})\\frac{P_{E2}}{3}\n\nX2X_2 has been correctly read and X1X_1 is a sequencing error and is actually equal to X2X_2. Pb=(1−PE2)PE13\nP_b = (1-P_{E2})\\frac{P_{E1}}{3}\n\nX1X_1 and X2X_2 corresponds to sequencing error but are actually the same base XExX_{Ex} Pc=2PE1PE29\nP_c = 2\\frac{P_{E1} P_{E2}}{9}\n\n\nConsequently : P(MATCH|X1≠X2)=(1−PE1)PE23+(1−PE2)PE13+2PE1PE29\n\\begin{aligned}\nP(MATCH | X_1 \\neq X_2) = (1-P_{E1})\\frac{P_{E2}}{3} + (1-P_{E2})\\frac{P_{E1}}{3} + 2\\frac{P_{E1} P_{E2}}{9}\n\\end{aligned}\n\nProbability of a match under the random model\nThe second considered model is a pure random model where every base is equiprobable, hence ha
"text":"12.1 obigrep – filters sequence files according to numerous conditions\nThe obigrep command is somewhat analogous to the standard Unix grep command. It selects a subset of sequence records from a sequence file. A sequence record is a complex object consisting of an identifier, a set of attributes (a key, defined by its name, associated with a value), a definition, and the sequence itself. Instead of working text line by text line like the standard Unix tool, obigrep selection is done sequence record by sequence record. A large number of options allow you to refine the selection on any element of the sequence. obigrep allows you to specify multiple conditions simultaneously (which take on the value TRUE or FALSE) and only those sequence records which meet all conditions (all conditions are TRUE) are selected. obigrep is able to work on two paired read files. The selection criteria apply to one or the other of the readings in each pair depending on the mode chosen (--paired-mode option). In all cases the selection is applied in the same way to both files, thus maintaining their consistency.\n\n12.1.1 The options usable with obigrep\n\n12.1.1.1 Selecting sequences based on their caracteristics\nSequences can be selected on several of their caracteristics, their length, their id, their sequence. Options allow for specifying the condition if selection.\nSelection based on the sequence\nSequence records can be selected according if they match or not with a pattern. The simplest pattern is as short sequence (e.g AACCTT). But the usage of regular patterns allows for looking for more complex pattern. As example, A[TG]C+G matches a A, followed by a T or a G, then one or several C and endly a G.\n\n--sequence|-s PATTERN\n\nRegular expression pattern to be tested against the sequence itself. The pattern is case insensitive. A complete description of the regular pattern grammar is available here.\n\nExamples:\n\nSelects only the sequence records that contain an EcoRI restriction site.\n\n\nobigrep -s 'GAATTC' seq1.fasta > seq2.fasta\n: Selects only the sequence records that contain a stretch of at least 10 A.\nobigrep -s 'A{10,}' seq1.fasta > seq2.fasta\n: Selects only the sequence records that do not contain ambiguous nucleotides.\nobigrep -s '^[ACGT]+$' seq1.fasta > seq2.fasta\n\n--min-count | -c COUNT\n\nonly sequences reprensenting at least COUNT reads will be selected. That option rely on the count attribute. If the count attribute is not defined for a sequence record, it is assumed equal to 11.\n\n--max-count | -C COUNT\n\nonly sequences reprensenting no more than COUNT reads will be selected. That option rely on the count attribute. If the count attribute is not defined for a sequence record, it is assumed equal to 11.\n\nExamples\n\nSelecting sequence records representing at least five reads in the dataset.\n\n\nobigrep -c 5 data_SPER01.fasta > data_norare_SPER01.fasta"
"text":"13.1 obicount\nobicount counts the number of sequence records, the sum of the count attributes, and the sum of the length of all the sequences.\nExample:\nobicount seq.fasta \nPrints the number of sequence records contained in the seq.fasta file and the sum of their count attributes.\nOptions specific to the command\n\n--reads|-r Prints read counts.\n--symbols|-s Prints symbol counts.\n--variants|-v Prints variant counts."
},
{
"objectID":"comm_utilities.html#obidistribute",
"href":"comm_utilities.html#obidistribute",
"title":"13 Utilities",
"section":"13.2 obidistribute",
"text":"13.2 obidistribute"
},
{
"objectID":"comm_utilities.html#obifind",
"href":"comm_utilities.html#obifind",
"title":"13 Utilities",
"section":"13.3 obifind",
"text":"13.3 obifind\n\nReplace the ecofind original OBITools."
},
{
"objectID":"library.html#biosequence",
"href":"library.html#biosequence",
"title":"The GO OBITools library",
"section":"BioSequence",
"text":"BioSequence\nThe BioSequence class is used to represent biological sequences. It allows for storing : - the sequence itself as a []byte - the sequencing quality score as a []byte if needed - an identifier as a string - a definition as a string - a set of (key, value) pairs in a map[sting]interface{}\nBioSequence is defined in the obiseq module and is included using the code\nimport (\n \"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq\"\n)\n\nCreating new instances\nTo create new instance, use\n\nMakeBioSequence(id string, sequence []byte, definition string) obiseq.BioSequence\nNewBioSequence(id string, sequence []byte, definition string) *obiseq.BioSequence\n\nBoth create a BioSequence instance, but when the first one returns the instance, the second returns a pointer on the new instance. Two other functions MakeEmptyBioSequence, and NewEmptyBioSequence do the same job but provide an uninitialized objects.\n\nid parameters corresponds to the unique identifier of the sequence. It mist be a string constituted of a single word (not containing any space).\nsequence is the DNA sequence itself, provided as a byte array ([]byte).\ndefinition is a string, potentially empty, but usualy containing a sentence explaining what is that sequence.\n\nimport (\n \"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq\"\n)\n\nfunc main() {\n myseq := obiseq.NewBiosequence(\n \"seq_GH0001\",\n bytes.FromString(\"ACGTGTCAGTCG\"),\n \"A short test sequence\",\n )\n}\nWhen formated as fasta the parameters correspond to the following schema\n>id definition containing potentially several words\nsequence\n\n\nEnd of life of a BioSequence instance\nWhen an instance of BioSequence is no longer in use, it is normally taken over by the GO garbage collector. If you know that an instance will never be used again, you can, if you wish, call the Recycle method on it to store the allocated memory elements in a pool to limit the allocation effort when many sequences are being handled. Once the recycle method has been called on an instance, you must ensure that no other method is called on it.\n\n\nAccessing to the elements of a sequence\nThe different elements of an obiseq.BioSequence must be accessed using a set of methods. For the three main elements provided during the creation of a new instance methodes are :\n\nId() string\nSequence() []byte\nDefinition() string\n\nIt exists pending method to change the value of these elements\n\nSetId(id string)\nSetSequence(sequence []byte)\nSetDefinition(definition string)\n\nimport (\n \"fmt\"\n \"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq\"\n)\n\nfunc main() {\n myseq := obiseq.NewBiosequence(\n \"seq_GH0001\",\n bytes.FromString(\"ACGTGTCAGTCG\"),\n \"A short test sequence\",\n )\n\n fmt.Println(myseq.Id())\n myseq.SetId(\"SPE01_0001\")\n fmt.Println(myseq.Id())\n}\n\nDifferent ways for accessing an editing the sequence\nIf Sequence()and SetSequence(sequence []byte) methods are the basic ones, several other methods exist.\n\nString() string return the sequence directly converted to a string instance.\nThe Write method family allows for extending an existing sequence following the buffer protocol.\n\nWrite(data []byte) (int, error) allows for appending a byte array on 3’ end of the sequence.\nWriteString(data string) (int, error) allows for appending a string.\nWriteByte(data byte) error allows for appending a single byte.\n\n\nThe Clear method empties the sequence buffer.\nimport (\n \"fmt\"\n \"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq\"\n)\n\nfunc main() {\n myseq := obiseq.NewEmptyBiosequence()\n\n myseq.WriteString(\"accc\")\n myseq.WriteByte(byte('c'))\n fmt.Println(myseq.String())\n}\n\n\nSequence quality scores\nSequence quality scores cannot be initialized at the time of instance creation. You must use dedicated methods to add quality scores to a sequence.\nTo be coherent the length of both the DNA sequence and que quality score sequence must be equal. Bu
},
{
"objectID": "library.html#the-sequence-iterator",
"href": "library.html#the-sequence-iterator",
"title": "TheGOOBIToolslibrary",
"section": "Thesequenceiterator",
"text": "Thesequenceiterator\nThepakageobiterprovidesaniteratormecanismformanipulatingsequences.Themainclassprovidedbythispackageisobiiter.IBioSequence.AnIBioSequenceiteratorprovidesbatchofsequences.\n\nBasicusageofasequenceiterator\nManyfunctions,amongthemfunctionsreadingsequencesfromatextfile,returnaIBioSequenceiterator.Theiteratorclassprovidestwomainmethods:\n\nNext()bool\nGet()obiiter.BioSequenceBatch\n\nTheNextmethodmovestheiteratortothenextvalue,whiletheGetmethodreturnsthecurrentlypointedvalue.Usingthem,itispossibletoloopoverthedataasinthefollowingcodechunk.\nimport(\n\"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiformats\"\n)\n\nfunc main() {\n mydata := obiformats.ReadFastSeqFromFile(\"myfile.fasta\")\n \n for mydata.Next() {\n data := mydata.Get()\n //\n // Whatever you want to do with the data chunk\n //\n }\n}\nAn obiseq.BioSequenceBatch instance is a set of sequences stored in an obiseq.BioSequenceSlice and a sequence number. The number of sequences in a batch is not defined. A batch can even contain zero sequences, if for example all sequences initially included in the batch have been filtered out at some stage of their processing.\n\n\nThe Pipable functions\nA function consuming a obiiter.IBioSequence and returning a obiiter.IBioSequence is of class obiiter.Pipable.\n\n\nThe Teeable functions\nA function consuming a obiiter.IBioSequence and returning two obiiter.IBioSequence instance is of class obiiter.Teeable."
"text":"A.1 Sequence attributes\nali_dir (string)\n\nSet by the obipairing tool\nThe attribute can contain 2 string values left or right.\n\nThe alignment generated by obipairing is a 3’-end gap free algorithm. Two cases can occur when aligning the forward and reverse reads. If the barcode is long enough, both the reads overlap only on their 3’ ends. In such case, the alignment direction ali_dir is set to left. If the barcode is shorter than the read length, the paired reads overlap by their 5’ ends, and the complete barcode is sequenced by both the reads. In that later case, ali_dir is set to right.\nali_length (int)\n\nSet by the obipairing tool\n\nLength of the aligned parts when merging forward and reverse reads\ncount (int)\n\nSet by the obiuniq tool\nGetter : method Count()\nSetter : method SetCount(int)\n\nThe count attribute indicates how-many strictly identical reads have been merged in a single record. It contains an integer value. If it is absent this means that the sequence record represents a single occurrence of the sequence.\nThe Count() method allows to access to the count attribute as an integer value. If the count attribute is not defined for the given sequence, the value 1 is returned\nmerged_* (map[string]int)\n\nSet by the obiuniq tool\n\nThe -m option of the obiuniq tools allows for keeping track of the distribution of the values stored in given attribute of interest. Often this option is used to summarise distribution of a sequence variant accross samples when obiuniq is run after running obimultiplex. The actual name of the attribute depends on the name of the monitored attribute. If -m option is used with the attribute sample, then this attribute names merged_sample.\nmode (string)\n\nSet by the obipairing tool\nThe attribute can contain 2 string values join or alignment.\n\nobitag_ref_index (map[string]string)\n\nSet by the obirefidx tool.\n\nIt resumes to which taxonomic annotation a match to that sequence must lead according to the number of differences existing between the query sequence and the reference sequence having that tag.\n {\"0\":\"9606@Homo sapiens@species\",\n \"2\":\"207598@Homininae@subfamily\",\n \"3\":\"9604@Hominidae@family\",\n \"8\":\"314295@Hominoidea@superfamily\",\n \"10\":\"9526@Catarrhini@parvorder\",\n \"12\":\"1437010@Boreoeutheria@clade\",\n \"16\":\"9347@Eutheria@clade\",\n \"17\":\"40674@Mammalia@class\",\n \"22\":\"117571@Euteleostomi@clade\",\n \"25\":\"7776@Gnathostomata@clade\",\n \"29\":\"33213@Bilateria@clade\",\n \"30\":\"6072@Eumetazoa@clade\"}\npairing_mismatches (map[string]string)\n\nSet by the obipairing tool\n\nseq_a_single (int)\n\nSet by the obipairing tool\n\nseq_ab_match (int)\n\nSet by the obipairing tool\n\nseq_b_single (int)\n\nSet by the obipairing tool\n\nscore (int)\n\nSet by the obipairing tool\n\nscore_norm (float)\n\nSet by the obipairing tool\nThe value ranges between 0 and 1.\n\nScore of the alignment between forward and reverse reads expressed as a fraction of identity."
"text":"Andersen,Kenneth,KarenLiseBird,MortenRasmussen,JamesHaile,\nHenrikBreuning-Madsen,KurtHKjaer,LudovicOrlando,MThomasP\nGilbert,andEskeWillerslev.2012.“Meta-barcodingofëdirtı́DNAfromsoilreflectsvertebrate\nbiodiversity.”MolecularEcology21(8):1966–79.\n\n\nBaldwin,DarrenS,MatthewJColloff,GavinNRees,AnthonyAChariton,\nGarthOWatson,LeonNCourt,DianaMHartley,etal.2013.“Impactsofinundationanddroughtoneukaryote\nbiodiversityinsemi-aridfloodplainsoils.”Molecular\nEcology22(6):1746–58.https://doi.org/10.1111/mec.12190.\n\n\nBoyer, Frédéric, Céline Mercier, Aurélie Bonin, Yvan Le Bras, Pierre\nTaberlet, and Eric Coissac. 2016. “obitools:\na unix-inspired software package for DNA metabarcoding.”\nMolecular Ecology Resources 16 (1): 176–82. https://doi.org/10.1111/1755-0998.12428.\n\n\nCaporaso, J Gregory, Justin Kuczynski, Jesse Stombaugh, Kyle Bittinger,\nFrederic D Bushman, Elizabeth K Costello, Noah Fierer, et al. 2010.\n“QIIME allows analysis of high-throughput\ncommunity sequencing data.” Nature Methods 7 (5):\n335–36. https://doi.org/10.1038/nmeth.f.303.\n\n\nChariton, Anthony A, Anthony C Roach, Stuart L Simpson, and Graeme E\nBatley. 2010. “Influence of the choice of\nphysical and chemistry variables on interpreting patterns of sediment\ncontaminants and their relationships with estuarine macrobenthic\ncommunities.” Marine and Freshwater Research. https://doi.org/10.1071/mf09263.\n\n\nCock, Peter JA, Christopher J Fields, Naohisa Goto, Michael L Heuer, and\nPeter M Rice. 2010. “The Sanger FASTQ File Format for Sequences\nwith Quality Scores, and the Solexa/Illumina FASTQ Variants.”\nNucleic Acids Research 38 (6): 1767–71.\n\n\nDeagle, Bruce E, Roger Kirkwood, and Simon N Jarman. 2009. “Analysis of Australian fur seal diet by pyrosequencing\nprey DNA in faeces.” Molecular Ecology 18 (9):\n2022–38. https://doi.org/10.1111/j.1365-294X.2009.04158.x.\n\n\nKowalczyk, Rafał, Pierre Taberlet, Eric Coissac, Alice Valentini,\nChristian Miquel, Tomasz Kamiński, and Jan M Wójcik. 2011. “Influence of management practices on large herbivore\ndiet—Case of European bison in Białowieża Primeval Forest (Poland).”\nForest Ecology and Management 261 (4): 821–28. https://doi.org/10.1016/j.foreco.2010.11.026.\n\n\nLipman, D J, and W R Pearson. 1985. “Rapid\nand sensitive protein similarity searches.”\nScience 227 (4693): 1435–41. http://www.ncbi.nlm.nih.gov/pubmed/2983426.\n\n\nParducci, Laura, Tina Jørgensen, Mari Mette Tollefsrud, Ellen Elverland,\nTorbjørn Alm, Sonia L Fontana, K D Bennett, et al. 2012. “Glacial survival of boreal trees in northern\nScandinavia.” Science 335 (6072): 1083–86. https://doi.org/10.1126/science.1216043.\n\n\nRiaz, Tiayyba, Wasim Shehzad, Alain Viari, François Pompanon, Pierre\nTaberlet, and Eric Coissac. 2011. “ecoPrimers: inference of new DNA barcode markers from\nwhole genome sequence analysis.” Nucleic Acids\nResearch 39 (21): e145. https://doi.org/10.1093/nar/gkr732.\n\n\nSchloss, Patrick D, Sarah L Westcott, Thomas Ryabin, Justine R Hall,\nMartin Hartmann, Emily B Hollister, Ryan A Lesniewski, et al. 2009.\n“Introducing mothur: open-source,\nplatform-independent, community-supported software for describing and\ncomparing microbial communities.” Applied and\nEnvironmental Microbiology 75 (23): 7537–41. https://doi.org/10.1128/AEM.01541-09.\n\n\nSeguritan, V, and F Rohwer. 2001. “FastGroup:\na program to dereplicate libraries of 16S rDNA sequences.”\nBMC Bioinformatics 2 (October): 9. https://doi.org/10.1186/1471-2105-2-9.\n\n\nShehzad, Wasim, Tiayyba Riaz, Muhammad A Nawaz, Christian Miquel, Carole\nPoillot, Safdar A Shah, Francois Pompanon, Eric Coissac, and Pierre\nTaberlet. 2012. “Carnivore diet analysis\nbased on next-generation sequencing: Application to the leopard cat\n(Prionailurus bengalensis) in Pakistan.” Molecular\nEcology 21 (8): 1951–65. https://onlinelibrary.wiley.com/doi/abs/10.1111/j.1365-294X.2011.05424.x.\n\n\nSogin,