"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.2 The taxonomy files\nMany OBITools are able to take into account taxonomic data. This is done by specifying a directory containing all :doc:NCBI taxonomy dump files <./taxdump>."
"text":"2.3 The sample description file\nA key file for OBITools4 is the file describing all samples (PCR) analyzed in the processed sequencing library file. This file, often called the ngsfilter file, is a tab separated values (TSV) file. The format of this file is exactly identical to that used in OBITools2 and OBITools4.\n{tsv, .smaller} wolf_diet 13a_F730603 aattaac TTAGATACCCCACTATGC TAGAACAGGCTCCTCTAG F wolf_diet 15a_F730814 gaagtag TTAGATACCCCACTATGC TAGAACAGGCTCCTCTAG F wolf_diet 26a_F040644 gaatatc TTAGATACCCCACTATGC TAGAACAGGCTCCTCTAG F wolf_diet 29a_F260619 gcctcct TTAGATACCCCACTATGC TAGAACAGGCTCCTCTAG F\nAt least six columns must be present in every line of the file.\n\nThe first column contains the name of the experience:\nAn experiment name groups a set of sample together. Sequences belonging to the experiment are tagged with an attribute experiment containing the name of the experiment in their annotation.\nThe second column contains the sample identifier in the experiment\nThe sample identifier must be unique in the experiment. The obimultiplex and obitagpcr commands add to all the sequences bellonging to the same sample an attribute sample containing the sample identifier\nThe third column contains description of the tag used to identify sequences corresponding to this sample\nThe fourth column contains the forward primer sequence\nThe fifth column contains the reverse primer sequence\nThe sixth column must always contain the character F (full length)\n\n\n\n\n\nCock, Peter JA, Christopher J Fields, Naohisa Goto, Michael L Heuer, and Peter M Rice. 2010. “The Sanger FASTQ File Format for Sequences with Quality Scores, and the Solexa/Illumina FASTQ Variants.” Nucleic Acids Research 38 (6): 1767–71."
"section":"3.1 Wolves’ diet based on DNA metabarcoding",
"text":"3.1 Wolves’ diet based on DNA metabarcoding\nThe data used in this tutorial correspond to the analysis of four wolf scats, using the protocol published in Shehzad et al. (2012) for assessing carnivore diet. After extracting DNA from the faeces, the DNA amplifications were carried out using the primers TTAGATACCCCACTATGC and TAGAACAGGCTCCTCTAG amplifiying the 12S-V5 region (Riaz et al. 2011), together with a wolf blocking oligonucleotide.\nThe complete data set can be downloaded here: the tutorial dataset\nOnce the data file is downloaded, using a UNIX terminal unarchive the data from the tgz file.\n\ntar zxvf wolf_diet.tgz\n\nThat command create a new directory named wolf_data containing every required data files:\n\nfastq <fastq> files resulting of aGA IIx (Illumina) paired-end (2 x 108 bp) sequencing assay of DNA extracted and amplified from four wolf faeces:\n\nwolf_F.fastq\nwolf_R.fastq\n\nthe file describing the primers and tags used for all samples sequenced:\n\nwolf_diet_ngsfilter.txt The tags correspond to short and specific sequences added on the 5' end of each primer to distinguish the different samples\n\nthe file containing the reference database in a fasta format:\n\ndb_v05_r117.fasta This reference database has been extracted from the release 117 of EMBL using obipcr\n\n\n\n\n\nTo not mix raw data and processed data a new directory called results is created.\n\nmkdir results"
"text":"3.2 Step by step analysis\n\n3.2.1 Recover full sequence reads from forward and reverse partial reads\nWhen using the result of a paired-end sequencing assay with supposedly overlapping forward and reverse reads, the first step is to recover the assembled sequence.\nThe forward and reverse reads of the same fragment are at the same line position in the two fastq files obtained after sequencing. Based on these two files, the assembly of the forward and reverse reads is done with the obipairing utility that aligns the two reads and returns the reconstructed sequence.\nIn our case, the command is:\n\nobipairing --min-identity=0.8 \\\n --min-overlap=10 \\\n -F wolf_data/wolf_F.fastq \\\n -R wolf_data/wolf_R.fastq \\\n > results/wolf.fastq \n\nThe --min-identity and --min-overlap options allow discarding sequences with low alignment quality. If after the aligment, the overlaping parts of the reads is shorter than 10 base pairs or the similarity over this aligned region is below 80% of identity, in the output file, the forward and reverse reads are not aligned but concatenated, and the value of the mode attribute in the sequence header is set to joined instead of alignment.\n\n\n3.2.2 Remove unaligned sequence records\nUnaligned sequences (:pymode=joined) cannot be used. The following command allows removing them from the dataset:\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.3Assigneachsequencerecordtothecorrespondingsample/markercombination\nEachsequencerecordisassignedtoitscorrespondingsampleandmarkerusingthedataprovidedinatextfile(herewolf_diet_ngsfilter.txt).Thistextfilecontainsonelinepersample,withthenameoftheexperiment(severalexperimentscanbeincludedinthesamefile),thenameofthetags(forexample:aattaacifthesametaghasbeenusedoneachextremityofthePCRproducts,oraattaac:gaagtagifthetagsweredifferent),thesequenceoftheforwardprimer,thesequenceofthereverseprimer,theletterTorFforsampleidentificationusingtheforwardprimerandtagonlyorusingbothprimersandbothtags,respectively(seeobimultiplexfordetails).\n\nobimultiplex-twolf_data/wolf_diet_ngsfilter.txt\\\n-uresults/unidentified.fastq\\\nresults/wolf.ali.fastq\\\n>results/wolf.ali.assigned.fastq\n\nThiscommandcreatestwofiles:\n\nunidentified.fastqcontainingallthesequencerecordsthatwerenotassignedtoasample/markercombination\nwolf.ali.assigned.fastqcontainingallthesequencerecordsthatwereproperlyassignedtoasample/markercombination\n\nNotethateachsequencerecordofthewolf.ali.assigned.fastqfilecontainsonlythebarcodesequenceasthesequencesofprimersandtagsareremovedbytheobimultiplexprogram.Informationconcerningtheexperiment,sample,primersandtagsisaddedasattributesinthesequenceheader.\nForinstance,thefirstsequencerecordofwolf.ali.assigned.fastqis:\n@HELIUM_000
"text":"4.1 Specifying input format\nFive sequence formats are accepted for input files. Fasta (Section2.1.2) and Fastq (Section2.1.3) are the main ones, EMBL and Genbank allow the use of flat files produced by these two international databases. The last one, ecoPCR, is maintained for compatibility with previous OBITools and allows to read ecoPCR outputs as sequence files.\n\n--ecopcr : Read data following the ecoPCR output format.\n--embl Read data following the EMBL flatfile format.\n--genbank Read data following the Genbank flatfile format.\n\nSeveral encoding schemes have been proposed for quality scores in Fastq format. Currently, OBITools considers Sanger encoding as the standard. For reasons of compatibility with older datasets produced with Solexa sequencers, it is possible, by using the following option, to force the use of the corresponding quality encoding scheme when reading these older files.\n\n--solexa Decodes quality string according to the Solexa specification. (default: false)"
"text":"5.1 Specifying output format\nOnly two output sequence formats are supported by OBITools, Fasta and Fastq. Fastq is used when output sequences are associated with quality information. Otherwise, Fasta is the default format. However, it is possible to force the output format by using one of the following two options. Forcing the use of Fasta results in the loss of quality information. Conversely, when the Fastq format is forced with sequences that have no quality data, dummy qualities set to 40 for each nucleotide are added.\n\n--fasta-output Read data following the ecoPCR output format.\n--fastq-output Read data following the EMBL flatfile format.\n\nOBITools allows multiple input files to be specified for a single command.\n\n--no-order When several input files are provided, indicates that there is no order among them. (default: false). Using such option can increase a lot the processing of the data."
"section":"5.2 The Fasta and Fastq annotations format",
"text":"5.2 The Fasta and Fastq annotations format\nOBITools extend the Fasta and Fastq formats by introducing a format for the title lines of these formats allowing to annotate every sequence. While the previous version of OBITools used an ad-hoc format for these annotation, this new version introduce the usage of the standard JSON format to store them.\nOn input, OBITools automatically recognize the format of the annotations, but two options allows to force the parsing following one of them. You should normally not need to use these options.\n\n--input-OBI-header FASTA/FASTQ title line annotations follow OBI format. (default: false)\n--input-json-header FASTA/FASTQ title line annotations follow json format. (default: false)\n\nOn output, by default annotation are formatted using the new JSON format. For compatibility with previous version of OBITools and with external scripts and software, it is possible to force the usage of the previous OBITools format.\n\n--output-OBI-header|-O output FASTA/FASTQ title line annotations follow OBI format. (default: false)\n--output-json-header output FASTA/FASTQ title line annotations follow json format. (default: false)"
},
{
"objectID":"common_options.html#helpful-options",
"href":"common_options.html#helpful-options",
"title":"6 Options common to most of the OBITools commands",
"section":"6.1 Helpful options",
"text":"6.1 Helpful options\n\n--help, -h\n\nDisplay a friendly help message.\n\n\n--no-progressbar"
"title":"6 Options common to most of the OBITools commands",
"section":"6.2 System related options",
"text":"6.2 System related options\nManaging parallel execution of tasks\nA new feature of OBITools V4 is the ability to run multiple tasks in parallel, reading files, calculating on the data, formatting and writing the results. Each of these tasks can itself be parallelized by dividing the data into batches and running the calculation on several batches in parallel. This allows the overall calculation time of an OBITools command to be reduced considerably. The parameters organizing the parallel calculation are determined automatically to use the maximum capacity of your computer. But in some circumstances, it is necessary to override these default settings either to try to optimize the computation on a given machine, or to limit the OBITools to using only a part of the computational capacity. There are two options for doing this.\n\n--max-cpu\n\nOBITools V4 are able to run in parallel on all the CPU cores available on the computer. It is sometime required to limit the computation to a smaller number of cores. That option specify the maximum number of cores that the OBITools command can use. This behaviour can also be set up using the OBIMAXCPU environment variable.\n\n\n--workers, -w\nIf your computer has 8 cores, but you want to limit OBITools to use only two of them you have several solution:\n\nIf you want to set the limit for a single execution you can use the –max-cpu option\nobiconvert --max-cpu 2 --fasta-output data.fastq > data.fasta\nor you can precede the command by setting the environment variable OBIMAXCPU\nOBIMAXCPU=2 obiconvert --fasta-output data.fastq > data.fasta\nIf you want to set the limit to your complete session, you have to export OBIMAXCPU\nexport OBIMAXCPU=2 \nall the following OBITools commands will be limited to use at max 2 CPU cores.\nIf all the time you want to impose this limit, you must include the above export command in your .bashrc file.\n\nOBITools debuging related options\n--debug"
"section":"7.1 Variables usable in the expression",
"text":"7.1 Variables usable in the expression\n\nsequence is the sequence object on which the expression is evaluated.\nannotationsis a map object containing every annotations associated to the currently processed sequence."
"text":"7.2 Function defined in the language\n\nInstrospection functions\n\nlen(x)\n\nIt is a generic function allowing to retreive the size of a object. It returns the length of a sequences, the number of element in a map like annotations, the number of elements in an array. The reurned value is an int.\n\ncontains(map,key)\n\nTests if the map contains a value assciated to key\n\n\n\n\nCast functions\n\nint(x)\n\nConverts if possible the x value to an integer value. The function returns an int.\n\nnumeric(x)\n\nConverts if possible the x value to a float value. The function returns a float.\n\nbool(x)\n\nConverts if possible the x value to a boolean value. The function returns a bool.\n\n\n\n\nString related functions\n\nprintf(format,...)\n\nAllows to combine several values to build a string. format follows the classical C printf syntax. The function returns a string.\n\nsubspc(x)\n\nsubstitutes every space in the x string by the underscore (_) character. The function returns a string.\n\n\n\n\nCondition function\n\nifelse(condition,val1,val2)\n\nThe condition value has to be a bool value. If it is true the function returns val1, otherwise, it is returning val2.\n\n\n\n\n7.2.1 Sequence analysis related function\n\ncomposition(sequence)\n\nThe nucleotide composition of the sequence is returned as as map indexed by a, c, g, or t and each value is the number of occurrences of that nucleotide. A fifth key others accounts for all others symboles.\n\ngcskew(sequence)\n\nComputes the excess of g compare to c of the sequence, known as the GC skew.\nSkewGC=G−CG+C\nSkew_{GC}=\\frac{G-C}{G+C}"
"text":"7.3 Accessing to the sequence annotations\nThe annotations variable is a map object containing all the annotations associated to the currently processed sequence. Index of the map are the attribute names. It exists to possibillities to retreive an annotation. It is possible to use the classical [] indexing operator, putting the attribute name quoted by double quotes between them.\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.2 obimultiplex\n\nReplace the ngsfilter original OBITools"
},
{
"objectID":"comm_computation.html#obicomplement",
"href":"comm_computation.html#obicomplement",
"title":"11 Computations on sequences",
"section":"11.3 obicomplement",
"text":"11.3 obicomplement"
},
{
"objectID":"comm_computation.html#obiclean",
"href":"comm_computation.html#obiclean",
"title":"11 Computations on sequences",
"section":"11.4 obiclean",
"text":"11.4 obiclean"
},
{
"objectID":"comm_computation.html#obiuniq",
"href":"comm_computation.html#obiuniq",
"title":"11 Computations on sequences",
"section":"11.5 obiuniq",
"text":"11.5 obiuniq\n\n\n\n\nLipman, D J, and W R Pearson. 1985. “Rapid and sensitive protein similarity searches.” Science 227 (4693): 1435–41. http://www.ncbi.nlm.nih.gov/pubmed/2983426."
"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\")\nmyseq.WriteByte(byte('c'))\nfmt.Println(myseq.String())\n}\n\n\nSequencequalityscores\nSequencequalityscorescannotbeinitializedatthetimeofinstancecreation.Youmustusededicatedmethodstoaddqualityscorestoasequence.\nTobecoherentthelengthofboththeDNAsequenceandquequalityscoresequencemustbeequal.Bu
},
{
"objectID":"library.html#the-sequence-iterator",
"href":"library.html#the-sequence-iterator",
"title":"The GO OBITools library",
"section":"The sequence iterator",
"text":"The sequence iterator\nThe pakage obiter provides an iterator mecanism for manipulating sequences. The main class provided by this package is obiiter.IBioSequence. An IBioSequence iterator provides batch of sequences.\n\nBasic usage of a sequence iterator\nMany functions, among them functions reading sequences from a text file, return a IBioSequence iterator. The iterator class provides two main methods:\n\nNext() bool\nGet() obiiter.BioSequenceBatch\n\nThe Next method moves the iterator to the next value, while the Get method returns the currently pointed value. Using them, it is possible to loop over the data as in the following code chunk.\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,