Update multi-model-plant-genome-corpus.py
Browse files
multi-model-plant-genome-corpus.py
CHANGED
@@ -4,15 +4,9 @@ from Bio import SeqIO
|
|
4 |
import os
|
5 |
|
6 |
_CITATION = ""
|
7 |
-
_DESCRIPTION = """
|
8 |
-
|
9 |
-
Dataset made of model plants genomes available on NCBI.
|
10 |
-
Default configuration "6kbp" yields chunks of 6.2kbp (100bp overlap on each side). The chunks of DNA are cleaned and processed so that
|
11 |
-
they can only contain the letters A, T, C, G and N.
|
12 |
-
"""
|
13 |
_HOMEPAGE = "https://www.ncbi.nlm.nih.gov/"
|
14 |
_LICENSE = "https://www.ncbi.nlm.nih.gov/home/about/policies/"
|
15 |
-
_CHUNK_LENGTHS = [
|
16 |
|
17 |
def filter_fn(char: str) -> str:
|
18 |
"""
|
@@ -35,17 +29,16 @@ def clean_sequence(seq: str) -> str:
|
|
35 |
|
36 |
class PlantMultiSpeciesGenomesConfig(datasets.BuilderConfig):
|
37 |
"""BuilderConfig for the Plant Multi Species Pre-training Dataset."""
|
38 |
-
def __init__(self, *args, chunk_length: int, overlap: int =
|
39 |
"""BuilderConfig for the multi species genomes.
|
40 |
Args:
|
41 |
chunk_length (:obj:`int`): Chunk length.
|
42 |
overlap: (:obj:`int`): Overlap in base pairs for two consecutive chunks (defaults to 100).
|
43 |
**kwargs: keyword arguments forwarded to super.
|
44 |
"""
|
45 |
-
num_kbp = int(chunk_length/1000)
|
46 |
super().__init__(
|
47 |
*args,
|
48 |
-
name=f'{
|
49 |
**kwargs,
|
50 |
)
|
51 |
self.chunk_length = chunk_length
|
@@ -56,7 +49,7 @@ class PlantMultiSpeciesGenomes(datasets.GeneratorBasedBuilder):
|
|
56 |
VERSION = datasets.Version("1.1.0")
|
57 |
BUILDER_CONFIG_CLASS = PlantMultiSpeciesGenomesConfig
|
58 |
BUILDER_CONFIGS = [PlantMultiSpeciesGenomesConfig(chunk_length=chunk_length) for chunk_length in _CHUNK_LENGTHS]
|
59 |
-
DEFAULT_CONFIG_NAME = "
|
60 |
|
61 |
def _info(self):
|
62 |
|
|
|
4 |
import os
|
5 |
|
6 |
_CITATION = ""
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
_HOMEPAGE = "https://www.ncbi.nlm.nih.gov/"
|
8 |
_LICENSE = "https://www.ncbi.nlm.nih.gov/home/about/policies/"
|
9 |
+
_CHUNK_LENGTHS = [510,]
|
10 |
|
11 |
def filter_fn(char: str) -> str:
|
12 |
"""
|
|
|
29 |
|
30 |
class PlantMultiSpeciesGenomesConfig(datasets.BuilderConfig):
|
31 |
"""BuilderConfig for the Plant Multi Species Pre-training Dataset."""
|
32 |
+
def __init__(self, *args, chunk_length: int, overlap: int = 255, **kwargs):
|
33 |
"""BuilderConfig for the multi species genomes.
|
34 |
Args:
|
35 |
chunk_length (:obj:`int`): Chunk length.
|
36 |
overlap: (:obj:`int`): Overlap in base pairs for two consecutive chunks (defaults to 100).
|
37 |
**kwargs: keyword arguments forwarded to super.
|
38 |
"""
|
|
|
39 |
super().__init__(
|
40 |
*args,
|
41 |
+
name=f'{chunk_length}bp',
|
42 |
**kwargs,
|
43 |
)
|
44 |
self.chunk_length = chunk_length
|
|
|
49 |
VERSION = datasets.Version("1.1.0")
|
50 |
BUILDER_CONFIG_CLASS = PlantMultiSpeciesGenomesConfig
|
51 |
BUILDER_CONFIGS = [PlantMultiSpeciesGenomesConfig(chunk_length=chunk_length) for chunk_length in _CHUNK_LENGTHS]
|
52 |
+
DEFAULT_CONFIG_NAME = "510bp"
|
53 |
|
54 |
def _info(self):
|
55 |
|