Biopython Tutorial und Kochbuch Japanische Übersetzung (4.3)

4.3 Feature, location and position objects Zu 4.2

4.3.1 SeqFeature objects

Sequence features are an essential part of describing a sequence. ** Die Funktion ist ein wesentlicher Bestandteil der Beschreibung eines Arrays. ** ** **

Once you get beyond the sequence itself, you need some way to organize and easily get at the more “abstract” information that is known about the sequence. ** Wenn Sie über ein Array hinausgehen, sollten Sie eine Möglichkeit haben, es zu organisieren und einfach auf komplexe Informationen zuzugreifen. ** ** **

The design is heavily based on the GenBank/EMBL feature tables, so if you understand how they look, you’ll probably have an easier time grasping the structure of the Biopython classes. ** Das Design basiert auch auf der GenBank / EMBL-Funktionstabelle. Wenn Sie damit vertraut sind, sind die Biopython-Klassen leichter zu verstehen. ** ** **

The key idea about each SeqFeature object is to describe a region on a parent sequence, typically a SeqRecord object. That region is described with a location object, typically a range between two positions (see Section 4.3.2 below). ** Die Hauptidee eines SeqFeature-Objekts besteht darin, einen Bereich des übergeordneten Arrays zu beschreiben. Das übergeordnete Element ist normalerweise ein SeqRecord-Objekt. Eine Region wird durch ein Standortobjekt definiert und ist normalerweise der Bereich zwischen zwei Positionen (siehe Sitzung 4.3.2). ** ** **

position – This refers to a single position on a sequence, which may be fuzzy or not. For instance, 5, 20, <100 and >200 are all positions. location – A location is region of sequence bounded by some positions. For instance 5..20 (i. e. 5 to 20) is a location.

**position

I just mention this because sometimes I get confused between the two. ** Der Grund, warum ich dies erwähne, ist, dass ich oft einen Fehler mache. ** ** **

4.3.2.1 FeatureLocation object

Unless you work with eukaryotic genes, most SeqFeature locations are extremely simple - you just need start and end coordinates and a strand. That’s essentially all the basic FeatureLocation object does. ** Sofern es sich nicht um ein eukaryotisches Gen handelt, ist die Lokalisierung von SeqFeature sehr einfach. Nur Start-, Endkoordinaten und Stranginformationen. Der grundlegendste Feature-Speicherort enthält die oben genannten drei Informationen. ** ** **

In practise of course, things can be more complicated. First of all we have to handle compound locations made up of several regions. Secondly, the positions themselves may be fuzzy (inexact). ** Aber der tatsächliche Fall wird nicht so einfach sein. Sie müssen einen komplexen Standort behandeln, der aus mehreren Regionen besteht, und die Position ist möglicherweise unklar. ** ** **

4.3.2.2 CompoundLocation object Biopython 1.62 introduced the CompoundLocation as part of a restructuring of how complex locations made up of multiple regions are represented. The main usage is for handling ‘join’ locations in EMBL/GenBank files. ** Compound Location aus Biopython 1.62 eingeführt, um die Verknüpfung von Positionen in EMBL / GenBank-Dateien besser zu handhaben. ** ** **

4.3.2.3 Fuzzy Positions So far we’ve only used simple positions. One complication in dealing with feature locations comes in the positions themselves. In biology many times things aren’t entirely certain (as much as us wet lab biologists try to make them certain!). For instance, you might do a dinucleotide priming experiment and discover that the start of mRNA transcript starts at one of two sites. This is very useful information, but the complication comes in how to represent this as a position. To help us deal with this, we have the concept of fuzzy positions. Basically there are several types of fuzzy positions, so we have five classes do deal with them: ** Bisher haben wir uns nur mit einfachen Positionen befasst. Die Komplexität der Merkmalspositionen ist auf ihre Unsicherheit zurückzuführen. Zum Beispiel ist im zweikernigen Säure-Priming-Experiment der Transkriptionsstartpunkt von mRNA eine von zwei Stellen, was eine sehr nützliche Information ist, aber das Schwierige ist, wie man die Information dieser Position für Position ausdrückt. Die Lösung besteht darin, die Anzeige mit einer unscharfen Position anzuzeigen. Es gibt fünf Haupttypen von Fuzzy-Positionen: **

ExactPosition – As its name suggests, this class represents a position which is specified as exact along the sequence. This is represented as just a number, and you can get the position by looking at the position attribute of the object. BeforePosition – This class represents a fuzzy position that occurs prior to some specified site. In GenBank/EMBL notation, this is represented as something like '<13', signifying that the real position is located somewhere less than 13. To get the specified upper boundary, look at the position attribute of the object. AfterPosition – Contrary to BeforePosition, this class represents a position that occurs after some specified site. This is represented in GenBank as '>13', and like BeforePosition, you get the boundary number by looking at the position attribute of the object. WithinPosition – Occasionally used for GenBank/EMBL locations, this class models a position which occurs somewhere between two specified nucleotides. In GenBank/EMBL notation, this would be represented as ‘(1.5)’, to represent that the position is somewhere within the range 1 to 5. To get the information in this class you have to look at two attributes. The position attribute specifies the lower boundary of the range we are looking at, so in our example case this would be one. The extension attribute specifies the range to the higher boundary, so in this case it would be 4. So object.position is the lower boundary and object.position + object.extension is the upper boundary. OneOfPosition – Occasionally used for GenBank/EMBL locations, this class deals with a position where several possible values exist, for instance you could use this if the start codon was unclear and there where two candidates for the start of the gene. Alternatively, that might be handled explicitly as two related gene features.

UnknownPosition – This class deals with a position of unknown location. This is not used in GenBank/EMBL, but corresponds to the ‘?’ feature coordinate used in UniProt.

**ExactPosition

Here’s an example where we create a location with fuzzy end points: ** Hier ist ein Beispiel für das Erstellen von Fuzzy-Endpunkten: **

>>> from Bio import SeqFeature
>>> start_pos = SeqFeature.AfterPosition(5)
>>> end_pos = SeqFeature.BetweenPosition(9, left=8, right=9)
>>> my_location = SeqFeature.FeatureLocation(start_pos, end_pos)

Note that the details of some of the fuzzy-locations changed in Biopython 1.59, in particular for BetweenPosition and WithinPosition you must now make it explicit which integer position should be used for slicing etc. For a start position this is generally the lower (left) value, while for an end position this would generally be the higher (right) value. ** Hinweis: Seit Biopython 1.59 gibt es einige Korrekturen für Fuzzy-Positionen, insbesondere für das Schneiden, bei denen Sie Ganzzahlen für BetweenPosition und WithinPosition verwenden müssen. Anfang ist im Allgemeinen ein kleinerer Wert und Ende ist ein größerer Wert. ** ** **

If you print out a FeatureLocation object, you can get a nice representation of the information: ** Nach dem Drucken des FeatureLocation-Objekts können Sie die folgenden Informationen sauber abrufen: **

>>> print(my_location)
[>5:(8^9)]

We can access the fuzzy start and end positions using the start and end attributes of the location: ** Sie können die Start- und Endpunkte der Fuzzy-Position über die Start- und Endattribute ermitteln. ** ** **

>>> my_location.start
AfterPosition(5)
>>> print(my_location.start)
>5
>>> my_location.end
BetweenPosition(9, left=8, right=9)
>>> print(my_location.end)
(8^9)

If you don’t want to deal with fuzzy positions and just want numbers, they are actually subclasses of integers so should work like integers: ** Wenn Sie nur die Zahlen anstelle von Fuzzy-Positionen erhalten möchten, können Sie sie mit der Unterklasse int in einen Integer-Typ konvertieren. ** ** **

>>> int(my_location.start)
5
>>> int(my_location.end)
9

For compatibility with older versions of Biopython you can ask for the nofuzzy_start and nofuzzy_end attributes of the location which are plain integers: ** Nofuzzy_start und nofuzzy_end stehen aus Gründen der Kompatibilität mit älteren Versionen von Biopython noch aus. ** ** **

>>> my_location.nofuzzy_start
5
>>> my_location.nofuzzy_end
9

Notice that this just gives you back the position attributes of the fuzzy locations. ** Hinweis: Rufen Sie einfach das Positionsattribut von Fuzzy-Positionen auf. ** ** **

Similarly, to make it easy to create a position without worrying about fuzzy positions, you can just pass in numbers to the FeaturePosition constructors, and you’ll get back out ExactPosition objects: ** Wenn Sie einen genauen Speicherort generieren möchten, müssen Sie lediglich eine Ganzzahl an die FeaturePosition-Funktion übergeben, und Sie können die ExactPosition abrufen. ** ** **

>>> exact_location = SeqFeature.FeatureLocation(5, 9)
>>> print(exact_location)
[5:9]
>>> exact_location.start
ExactPosition(5)
>>> int(exact_location.start)
5
>>> exact_location.nofuzzy_start
5

That is most of the nitty gritty about dealing with fuzzy positions in Biopython. It has been designed so that dealing with fuzziness is not that much more complicated than dealing with exact positions, and hopefully you find that true! ** Das Obige ist der Kern von Fuzzy-Positionen. Der Zweck, es auf diese Weise zu machen, ist es, es weniger kompliziert als genaue Positionen zu machen. ** ** **

4.3.2.4 Location testing

You can use the Python keyword in with a SeqFeature or location object to see if the base/residue for a parent coordinate is within the feature/location or not. ** Mit dem Schlüsselwort in von Python können Sie überprüfen, ob sich die übergeordneten Koordinaten der Basis / des Rests in Merkmal / Position befinden. ** ** **

For example, suppose you have a SNP of interest and you want to know which features this SNP is within, and lets suppose this SNP is at index 4350 (Python counting!). Here is a simple brute force solution where we just check all the features one by one in a loop: ** Wenn Sie beispielsweise die Funktionen von SNP überprüfen möchten, gibt es eine leistungsstarke, aber einfache Möglichkeit, alle Funktionen in einer Schleife zu überprüfen. ** ** **

>>> from Bio import SeqIO
>>> my_snp = 4350
>>> record = SeqIO.read("NC_005816.gb", "genbank")
>>> for feature in record.features:
...     if my_snp in feature:
...         print("%s %s" % (feature.type, feature.qualifiers.get("db_xref")))
...
source ['taxon:229193']
gene ['GeneID:2767712']
CDS ['GI:45478716', 'GeneID:2767712']

Note that gene and CDS features from GenBank or EMBL files defined with joins are the union of the exons – they do not cover any introns. ** Hinweis: Gene und CDS-Funktionen in GenBank- oder EMBL-Dateien enthalten nur Exxon. --Intron existiert nicht **

4.3.3 Sequence described by a feature or location

A SeqFeature or location object doesn’t directly contain a sequence, instead the location (see Section 4.3.2) describes how to get this from the parent sequence. For example consider a (short) gene sequence with location 5:18 on the reverse strand, which in GenBank/EMBL notation using 1-based counting would be complement(6..18), like this: ** SeqFeature und location haben keine direkte Sequenz, sondern halten einen Ort, um von der übergeordneten Sequenz zu erhalten. Beispiel: Bei einer kurzen DNA-Sequenz an Position 5:18 auf dem umgekehrten Strang zählt die GenBank / EMBL-Notation von 1 (6 ... 18). ** ** **

>>> from Bio.Seq import Seq
>>> from Bio.SeqFeature import SeqFeature, FeatureLocation
>>> example_parent = Seq("ACCGAGACGGCAAAGGCTAGCATAGGTATGAGACTTCCTTCCTGCCAGTGCTGAGGAACTGGGAGCCTAC")
>>> example_feature = SeqFeature(FeatureLocation(5, 18), type="gene", strand=-1)

You could take the parent sequence, slice it to extract 5:18, and then take the reverse complement. If you are using Biopython 1.59 or later, the feature location’s start and end are integer like so this works: ** Scheiben können 5:18 aus der Elternsequenz extrahieren, um komplementäres DAN (cDNA) zu erhalten. Wenn Sie Biopython 1.59 oder höher verwenden, können Sie den Start und das Ende der Funktion als ganzzahlige Argumente übergeben, wie unten gezeigt. ** ** **

>>> feature_seq = example_parent[example_feature.location.start:example_feature.location.end].reverse_complement()
>>> print(feature_seq)
AGCCTTTGCCGTC

This is a simple example so this isn’t too bad – however once you have to deal with compound features (joins) this is rather messy. Instead, the SeqFeature object has an extract method to take care of all this: ** Das ist nicht schlecht, aber beim Umgang mit komplexen Funktionen (Joins) sehr umständlich. Sie können dieses Problem mit der SeqFeature-Extraktionsmethode behandeln. ** ** **

>>> feature_seq = example_feature.extract(example_parent)
>>> print(feature_seq)
AGCCTTTGCCGTC

The length of a SeqFeature or location matches that of the region of sequence it describes. ** Die Länge von SeqFeature oder Position entspricht der Länge des Arrays. ** ** **

>>> print(example_feature.extract(example_parent))
AGCCTTTGCCGTC
>>> print(len(example_feature.extract(example_parent)))
13
>>> print(len(example_feature))
13
>>> print(len(example_feature.location))
13

For simple FeatureLocation objects the length is just the difference between the start and end positions. However, for a CompoundLocation the length is the sum of the constituent regions. ** Die Länge in FeatureLocation ist die Differenz zwischen Start und Ende und in CompoundLocation die Summe jeder Komponente. ** ** **

Recommended Posts

Biopython Tutorial und Kochbuch Japanische Übersetzung (4.3)
Biopython Tutorial und Kochbuch Japanische Übersetzung (4.1)
Biopython Tutorial und Kochbuch Japanische Übersetzung (4.5)
Biopython Tutorial und Kochbuch Japanische Übersetzung (4.8)
Biopython Tutorial und Kochbuch Japanische Übersetzung (4.7)
Biopython Tutorial und Kochbuch Japanische Übersetzung (4.9)
Biopython Tutorial und Kochbuch Japanische Übersetzung (4.6)
Biopython Tutorial und Kochbuch Japanische Übersetzung (4.2)
Biopython Tutorial und Kochbuch Japanische Übersetzung (4.4)
Biopython Tutorial und Kochbuch Japanische Übersetzung (Kapitel 1, 2)
Streamlit Tutorial Japanische Übersetzung
sosreport Japanische Übersetzung
[Übersetzung] Hyperopt-Tutorial
Mann systemd japanische Übersetzung
stromlinienförmige Erklärung japanische Übersetzung
man systemd.service Japanische Übersetzung
man nftables Japanische Übersetzung
Dockerfile Reference Japanische Übersetzung
docker-compose --help japanische Übersetzung
Docker helfen japanische Übersetzung
SymPy Tutorial Japanische Notizen
[PyTorch] Tutorial (japanische Version) ② ~ AUTOGRAD ~
Docker Build - Hilfe japanische Übersetzung
Chainer, RNN und maschinelle Übersetzung
Japanische Übersetzung des sysstat-Handbuchs
[PyTorch] Tutorial (japanische Version) ① ~ Tensol ~
Japanische Übersetzung des Linux-Handbuchs
Docker run --help japanische Übersetzung
Pandas Benutzerhandbuch "Tabellenformatierung und Pivot-Tabelle" (offizielles Dokument Japanische Übersetzung)