<commit_before># Schema definitions for RNA browser database.
# @author <NAME> <<EMAIL>

from sqlalchemy import Column, Integer, String, Text, Enum, Float, ForeignKey, ForeignKeyConstraint
from database import Base
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord

import database
import settings

# Add a single position to the structure. The value points to another place that this 
# particular position pairs with.
def values_str_add(str_in, value):
    value = str(value)
    if str_in == "":
        str_in = value
    else:
        str_in += "\t"+value
    return str_in

# Get positions array by extracting the values_str string
def values_str_unpack_int(str_in):
    positions = list(map(int, str_in.split("\t")))
    return positions

def values_str_unpack_float(str_in):
    out = []
    bits = str_in.split("\t")
    for bit in bits:
        out.append(None if bit == "None" else float(bit))
    return out

# A Gene describes a locus identifier for a gene, plus any metadata associated with the locus.
# Genes are generic - they can be associated with multiple strains.
class Gene(Base):
    __tablename__ = "gene"

    id = Column(String(256), primary_key=True) # TAIR locus ID (e.g. AT1G01225)

    def __init__(self, id=None):
        self.id = id

    def __repr__(self):
        return "<Gene %r>" % (self.id)

# A Transcript is effectively an RNA sequence identifier, which can be shared amongst multiple strains.
# Sequences are mapped to Transcripts via the Feature entity.
class Transcript(Base):
    __tablename__ = "transcript"

    id = Column(String(256), primary_key=True) # TAIR transcript ID (e.g. AT1G01225.1)
    gene_id = Column(String(256), ForeignKey("gene.id"), nullable=False)

    def __init__(self, id=None, gene_id=None):<commit_msg>Fixed raw download data not working<commit_after># Schema definitions for RNA browser database.
# @author <NAME> <<EMAIL>

from sqlalchemy import Column, Integer, String, Text, Enum, Float, ForeignKey, ForeignKeyConstraint
from database import Base
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord

import database
import settings

# Add a single position to the structure. The value points to another place that this 
# particular position pairs with.
def values_str_add(str_in, value):
    value = str(value)
    if str_in == "":
        str_in = value
    else:
        str_in += "\t"+value
    return str_in

# Get positions array by extracting the values_str string
def values_str_unpack_int(str_in):
    positions = list(map(float, str_in.split("\t")))
    return positions

def values_str_unpack_float(str_in):
    out = []
    bits = str_in.split("\t")
    for bit in bits:
        out.append(None if bit == "None" else float(bit))
    return out

# A Gene describes a locus identifier for a gene, plus any metadata associated with the locus.
# Genes are generic - they can be associated with multiple strains.
class Gene(Base):
    __tablename__ = "gene"

    id = Column(String(256), primary_key=True) # TAIR locus ID (e.g. AT1G01225)

    def __init__(self, id=None):
        self.id = id

    def __repr__(self):
        return "<Gene %r>" % (self.id)

# A Transcript is effectively an RNA sequence identifier, which can be shared amongst multiple strains.
# Sequences are mapped to Transcripts via the Feature entity.
class Transcript(Base):
    __tablename__ = "transcript"

    id = Column(String(256), primary_key=True) # TAIR transcript ID (e.g. AT1G01225.1)
    gene_id = Column(String(256), ForeignKey("gene.id"), nullable=False)

    def __init__(self, id=None, gene_id=None):
{'fraction_non_alphanumeric': 0.09526462395543175, 'fraction_numerical': 0.012256267409470752, 'mean_word_length': 3.800802139037433, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '308580', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1071, 'n_words': 394}