bio
This commit is contained in:
commit
40cc16cb4f
|
@ -0,0 +1,91 @@
|
||||||
|
# Choose a base image. Debian is a good choice due to pyenv
|
||||||
|
FROM debian:latest
|
||||||
|
|
||||||
|
# Update the package list and install necessary dependencies
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
aptitude \
|
||||||
|
tmux vim-nox nano mc git curl termshark procps \
|
||||||
|
sudo iproute2 iputils-ping bridge-utils \
|
||||||
|
ifupdown udev make build-essential libssl-dev zlib1g-dev \
|
||||||
|
libbz2-dev libreadline-dev libsqlite3-dev wget llvm libncurses5-dev \
|
||||||
|
libncursesw5-dev xz-utils libffi-dev liblzma-dev \
|
||||||
|
sqlite3 default-libmysqlclient-dev pkg-config \
|
||||||
|
npm
|
||||||
|
|
||||||
|
# Set password for root user (optional, for configuration)
|
||||||
|
RUN echo 'root:rootpass' | chpasswd
|
||||||
|
|
||||||
|
# Add a new user `user` with password `pass` and prepare the environment
|
||||||
|
RUN useradd -m user && echo 'user:pass' | chpasswd && adduser user sudo
|
||||||
|
|
||||||
|
# Switch to user `user`
|
||||||
|
USER user
|
||||||
|
WORKDIR /home/user
|
||||||
|
|
||||||
|
# Install pyenv
|
||||||
|
RUN git clone https://github.com/pyenv/pyenv .pyenv
|
||||||
|
|
||||||
|
# Install pyenv-virtualenv
|
||||||
|
RUN git clone https://github.com/pyenv/pyenv-virtualenv .pyenv/plugins/pyenv-virtualenv
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV HOME /home/user
|
||||||
|
ENV PYENV_ROOT $HOME/.pyenv
|
||||||
|
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
|
||||||
|
|
||||||
|
# Add pyenv and pyenv-virtualenv configuration to .bashrc
|
||||||
|
RUN echo 'export PYENV_ROOT="$HOME/.pyenv"' >> .bashrc
|
||||||
|
RUN echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> .bashrc
|
||||||
|
RUN echo 'eval "$(pyenv init -)"' >> .bashrc
|
||||||
|
RUN echo 'eval "$(pyenv virtualenv-init -)"' >> .bashrc
|
||||||
|
|
||||||
|
# Install Python 3.11 with --enable-shared
|
||||||
|
RUN bash -i -c "source ~/.bashrc && env PYTHON_CONFIGURE_OPTS='--enable-shared' pyenv install 3.11"
|
||||||
|
|
||||||
|
# Create a virtual environment p3.11
|
||||||
|
RUN bash -i -c "source ~/.bashrc && pyenv virtualenv 3.11 p3.11"
|
||||||
|
|
||||||
|
# Set p3.11 as the default virtual environment
|
||||||
|
RUN bash -i -c "source ~/.bashrc && pyenv local p3.11"
|
||||||
|
|
||||||
|
# Install Poetry
|
||||||
|
RUN curl -sSL https://install.python-poetry.org | python3 -
|
||||||
|
|
||||||
|
# Add Poetry path to PATH directly in the Dockerfile
|
||||||
|
ENV PATH="$HOME/.local/bin:$PATH"
|
||||||
|
|
||||||
|
# Install SQLAlchemy and MySQL adapter in the pyenv environment
|
||||||
|
RUN bash -i -c "source ~/.bashrc && pyenv activate p3.11 && pip install \
|
||||||
|
sqlalchemy mysqlclient mysql-connector-python\
|
||||||
|
ipython numpy scipy matplotlib \
|
||||||
|
biopython"
|
||||||
|
|
||||||
|
# Copy the project into the image
|
||||||
|
COPY --chown=user:user . /home/user/fapi
|
||||||
|
COPY ./_confs/* ./
|
||||||
|
|
||||||
|
# Set the working directory for installing dependencies
|
||||||
|
WORKDIR /home/user/fapi
|
||||||
|
|
||||||
|
# Install project dependencies with Poetry in the p3.11 environment
|
||||||
|
RUN bash -i -c "source ~/.bashrc && pyenv activate p3.11 && poetry install"
|
||||||
|
|
||||||
|
#RUN bash -i -c "source ~/.bashrc && poetry config virtualenvs.create false && poetry install"
|
||||||
|
|
||||||
|
# Copy the .vimrc file
|
||||||
|
#COPY --chown=user:user .vimrc /home/user/.vimrc
|
||||||
|
|
||||||
|
# Install vim-plug using curl
|
||||||
|
RUN curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
|
||||||
|
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
|
|
||||||
|
# Install Vim plugins
|
||||||
|
RUN vim +PlugInstall +qall
|
||||||
|
|
||||||
|
# Run the application
|
||||||
|
#CMD ["/bin/bash", "-c", "python entrypoint.py"]
|
||||||
|
|
||||||
|
# Run Bash
|
||||||
|
CMD ["/bin/bash"]
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
docker volume create portainer_data
|
||||||
|
|
||||||
|
docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
sudo incus config device add tri proxy-9443 proxy listen=tcp:0.0.0.0:9443 connect=tcp:0.0.0.0:9443
|
|
@ -0,0 +1,8 @@
|
||||||
|
docker run --rm \
|
||||||
|
-dit \
|
||||||
|
--privileged \
|
||||||
|
-p 9999:9999 \
|
||||||
|
-p 8888:8888 \
|
||||||
|
-v /home/user/work/py/fapi/fapi:/home/user/fapi \
|
||||||
|
--name f1 \
|
||||||
|
fapi
|
|
@ -0,0 +1,2 @@
|
||||||
|
#. ./__run2 mpabi 1111
|
||||||
|
docker run --rm -dit -p $2:9999 --name $1 fapi bash
|
|
@ -0,0 +1,34 @@
|
||||||
|
./Dockerfile
|
||||||
|
|
||||||
|
./php/Dockerfile
|
||||||
|
./docker-compose.yaml
|
||||||
|
|
||||||
|
./__build
|
||||||
|
./__n1
|
||||||
|
./__run
|
||||||
|
./__run2
|
||||||
|
./__uvicorn
|
||||||
|
|
||||||
|
./__docker-portainer
|
||||||
|
./__incus-proxy
|
||||||
|
|
||||||
|
./_confs/.tmux.conf
|
||||||
|
./_confs/.vimrc
|
||||||
|
|
||||||
|
./app/schemas.py
|
||||||
|
./app/models.py
|
||||||
|
./app/main.py
|
||||||
|
./app/database.py
|
||||||
|
|
||||||
|
./pyproject.toml
|
||||||
|
|
||||||
|
./static/script.js
|
||||||
|
./static/style.css
|
||||||
|
./static/index.html
|
||||||
|
./static/vue.global.js
|
||||||
|
|
||||||
|
./data/pET-28a(+).gb
|
||||||
|
|
||||||
|
./entrypoint.py
|
||||||
|
|
||||||
|
./__tracked_files
|
|
@ -0,0 +1 @@
|
||||||
|
poetry run uvicorn --reload app.main:app --host 0.0.0.0 --port 9999
|
|
@ -0,0 +1,14 @@
|
||||||
|
set-option -g default-command "bash --login"
|
||||||
|
|
||||||
|
# remap prefix to Control + a
|
||||||
|
set -g prefix C-s
|
||||||
|
# bind 'C-a C-a' to type 'C-a'
|
||||||
|
bind C-s send-prefix
|
||||||
|
unbind C-b
|
||||||
|
|
||||||
|
# synchronize all panes in a window
|
||||||
|
# don't use control S, too easily confused
|
||||||
|
# with navigation key sequences in tmux (show sessions)
|
||||||
|
unbind C-S
|
||||||
|
bind C-Y set-window-option synchronize-panes
|
||||||
|
|
|
@ -0,0 +1,163 @@
|
||||||
|
call plug#begin()
|
||||||
|
|
||||||
|
Plug 'tpope/vim-fugitive'
|
||||||
|
Plug 'tpope/vim-commentary'
|
||||||
|
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' }
|
||||||
|
|
||||||
|
Plug 'jupyter-vim/jupyter-vim'
|
||||||
|
Plug 'goerz/jupytext.vim'
|
||||||
|
|
||||||
|
Plug 'ConradIrwin/vim-bracketed-paste'
|
||||||
|
|
||||||
|
Plug 'rafi/awesome-vim-colorschemes'
|
||||||
|
Plug 'flazz/vim-colorschemes'
|
||||||
|
|
||||||
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||||
|
|
||||||
|
Plug 'jpalardy/vim-slime'
|
||||||
|
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
nnoremap <leader>n :NERDTreeFocus<CR>
|
||||||
|
nnoremap <C-n> :NERDTree<CR>
|
||||||
|
nnoremap <C-t> :NERDTreeToggle<CR>
|
||||||
|
nnoremap <C-f> :NERDTreeFind<CR>
|
||||||
|
|
||||||
|
|
||||||
|
" Run current file
|
||||||
|
nnoremap <buffer> <silent> <localleader>R :JupyterRunFile<CR>
|
||||||
|
nnoremap <buffer> <silent> <localleader>I :PythonImportThisFile<CR>
|
||||||
|
|
||||||
|
" Change to directory of current file
|
||||||
|
nnoremap <buffer> <silent> <localleader>d :JupyterCd %:p:h<CR>
|
||||||
|
|
||||||
|
" Send a selection of lines
|
||||||
|
nnoremap <buffer> <silent> <localleader>X :JupyterSendCell<CR>
|
||||||
|
nnoremap <buffer> <silent> <localleader>E :JupyterSendRange<CR>
|
||||||
|
nmap <buffer> <silent> <localleader>e <Plug>JupyterRunTextObj
|
||||||
|
vmap <buffer> <silent> <localleader>e <Plug>JupyterRunVisual
|
||||||
|
|
||||||
|
" Debugging maps
|
||||||
|
nnoremap <buffer> <silent> <localleader>b :PythonSetBreak<CR>
|
||||||
|
|
||||||
|
set backspace=indent,eol,start
|
||||||
|
set mouse=r
|
||||||
|
|
||||||
|
packadd termdebug
|
||||||
|
let g:termdebug_wide=1
|
||||||
|
let g:termdebugger='riscv32-esp-elf-gdb'
|
||||||
|
|
||||||
|
|
||||||
|
" Disable compatibility with vi which can cause unexpected issues.
|
||||||
|
set nocompatible
|
||||||
|
|
||||||
|
" Enable type file detection. Vim will be able to try to detect the type of file in use.
|
||||||
|
filetype on
|
||||||
|
|
||||||
|
" Enable plugins and load plugin for the detected file type.
|
||||||
|
filetype plugin on
|
||||||
|
|
||||||
|
" Load an indent file for the detected file type.
|
||||||
|
filetype indent on
|
||||||
|
|
||||||
|
" Turn syntax highlighting on.
|
||||||
|
syntax on
|
||||||
|
|
||||||
|
" Add numbers to each line on the left-hand side.
|
||||||
|
set number
|
||||||
|
|
||||||
|
" Highlight cursor line underneath the cursor horizontally.
|
||||||
|
set cursorline
|
||||||
|
|
||||||
|
" Highlight cursor line underneath the cursor vertically.
|
||||||
|
" set cursorcolumn
|
||||||
|
|
||||||
|
" Set shift width to 4 spaces.
|
||||||
|
set shiftwidth=4
|
||||||
|
|
||||||
|
" Set tab width to 4 columns.
|
||||||
|
set tabstop=4
|
||||||
|
|
||||||
|
" Use space characters instead of tabs.
|
||||||
|
set expandtab
|
||||||
|
|
||||||
|
" Do not save backup files.
|
||||||
|
set nobackup
|
||||||
|
|
||||||
|
" Do not let cursor scroll below or above N number of lines when scrolling.
|
||||||
|
set scrolloff=10
|
||||||
|
|
||||||
|
" Do not wrap lines. Allow long lines to extend as far as the line goes.
|
||||||
|
set nowrap
|
||||||
|
|
||||||
|
" While searching though a file incrementally highlight matching characters as you type.
|
||||||
|
set incsearch
|
||||||
|
|
||||||
|
" Ignore capital letters during search.
|
||||||
|
set ignorecase
|
||||||
|
|
||||||
|
" Override the ignorecase option if searching for capital letters.
|
||||||
|
" This will allow you to search specifically for capital letters.
|
||||||
|
set smartcase
|
||||||
|
|
||||||
|
" Show partial command you type in the last line of the screen.
|
||||||
|
set showcmd
|
||||||
|
|
||||||
|
" Show the mode you are on the last line.
|
||||||
|
set showmode
|
||||||
|
|
||||||
|
" Show matching words during a search.
|
||||||
|
set showmatch
|
||||||
|
|
||||||
|
" Use highlighting when doing a search.
|
||||||
|
set hlsearch
|
||||||
|
|
||||||
|
" Set the commands to save in history default number is 20.
|
||||||
|
set history=1000
|
||||||
|
|
||||||
|
" Enable auto completion menu after pressing TAB.
|
||||||
|
set wildmenu
|
||||||
|
|
||||||
|
" Make wildmenu behave like similar to Bash completion.
|
||||||
|
set wildmode=list:longest
|
||||||
|
|
||||||
|
" There are certain files that we would never want to edit with Vim.
|
||||||
|
" Wildmenu will ignore files with these extensions.
|
||||||
|
set wildignore=*.docx,*.jpg,*.png,*.gif,*.pdf,*.pyc,*.exe,*.flv,*.img,*.xlsx
|
||||||
|
|
||||||
|
|
||||||
|
" set colorscheme OceanicNext
|
||||||
|
|
||||||
|
|
||||||
|
if !exists("g:slime_python_ipython")
|
||||||
|
let g:slime_python_ipython = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
let g:slime_target = "tmux"
|
||||||
|
|
||||||
|
" Run cell for vim-slime
|
||||||
|
function! SendCell(pattern)
|
||||||
|
let start_line = search(a:pattern, 'bnW')
|
||||||
|
|
||||||
|
if start_line
|
||||||
|
let start_line = start_line + 1
|
||||||
|
else
|
||||||
|
let start_line = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
let stop_line = search(a:pattern, 'nW')
|
||||||
|
if stop_line
|
||||||
|
let stop_line = stop_line - 1
|
||||||
|
else
|
||||||
|
let stop_line = line('$')
|
||||||
|
endif
|
||||||
|
|
||||||
|
call slime#send_range(start_line, stop_line)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Custom vim-slime mappings
|
||||||
|
let g:slime_no_mappings = 1
|
||||||
|
xmap <c-c><c-c> <Plug>SlimeRegionSend
|
||||||
|
nmap <c-c><c-c> :<c-u>call SendCell('^#%%')<cr>
|
||||||
|
nmap <c-c>v <Plug>SlimeConfig
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
#%%
|
||||||
|
from sqlalchemy import create_engine
|
||||||
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
|
from sqlalchemy.orm import sessionmaker
|
||||||
|
|
||||||
|
"""
|
||||||
|
#SQLALCHEMY_DATABASE_URL = "sqlite:///./test.db" # SQLite
|
||||||
|
engine = create_engine(
|
||||||
|
SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False} # Opcja dla SQLite
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
SQLALCHEMY_DATABASE_URL = "mysql+mysqlconnector://root:secret@172.18.0.2:3306/test" # Przykład dla MySQL
|
||||||
|
engine = create_engine(
|
||||||
|
SQLALCHEMY_DATABASE_URL,
|
||||||
|
)
|
||||||
|
|
||||||
|
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||||
|
|
||||||
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
||||||
|
#%%
|
||||||
|
from sqlalchemy import text
|
||||||
|
|
||||||
|
with engine.connect() as conn:
|
||||||
|
result = conn.execute(text("select 'hello world'"))
|
||||||
|
print(result.all())
|
|
@ -0,0 +1,35 @@
|
||||||
|
from fastapi import FastAPI, Depends
|
||||||
|
from fastapi.staticfiles import StaticFiles
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from .database import SessionLocal, engine
|
||||||
|
from .models import Sequence, Feature
|
||||||
|
from .database import Base
|
||||||
|
|
||||||
|
app = FastAPI()
|
||||||
|
|
||||||
|
Base.metadata.create_all(bind=engine)
|
||||||
|
|
||||||
|
def get_db():
|
||||||
|
db = SessionLocal()
|
||||||
|
try:
|
||||||
|
yield db
|
||||||
|
finally:
|
||||||
|
db.close()
|
||||||
|
|
||||||
|
# Serwowanie plików statycznych
|
||||||
|
app.mount("/static", StaticFiles(directory="static"), name="static")
|
||||||
|
|
||||||
|
@app.get("/sequences/")
|
||||||
|
def read_sequences(skip: int = 0, limit: int = 10, db: Session = Depends(get_db)):
|
||||||
|
sequences = db.query(Sequence).offset(skip).limit(limit).all()
|
||||||
|
return sequences
|
||||||
|
|
||||||
|
@app.get("/features/")
|
||||||
|
def read_features(skip: int = 0, limit: int = 10, db: Session = Depends(get_db)):
|
||||||
|
features = db.query(Feature).offset(skip).limit(limit).all()
|
||||||
|
return features
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
import uvicorn
|
||||||
|
uvicorn.run(app, host="0.0.0.0", port=9999)
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
# app/models.py
|
||||||
|
from sqlalchemy import Column, Integer, String, Text, ForeignKey
|
||||||
|
from sqlalchemy.orm import relationship
|
||||||
|
from .database import Base
|
||||||
|
|
||||||
|
class Sequence(Base):
|
||||||
|
__tablename__ = "sequences"
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True, index=True)
|
||||||
|
name = Column(String, index=True)
|
||||||
|
description = Column(String)
|
||||||
|
sequence = Column(Text)
|
||||||
|
|
||||||
|
features = relationship("Feature", back_populates="sequence")
|
||||||
|
|
||||||
|
class Feature(Base):
|
||||||
|
__tablename__ = "features"
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True, index=True)
|
||||||
|
type = Column(String, index=True)
|
||||||
|
location = Column(String)
|
||||||
|
sequence = Column(Text)
|
||||||
|
qualifiers = Column(Text)
|
||||||
|
|
||||||
|
sequence_id = Column(Integer, ForeignKey('sequences.id'))
|
||||||
|
sequence = relationship("Sequence", back_populates="features")
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
from typing import List, Optional
|
||||||
|
from pydantic import BaseModel, constr, conint
|
||||||
|
|
||||||
|
class AuthorCreate(BaseModel):
|
||||||
|
name: constr(min_length=2, max_length=100)
|
||||||
|
|
||||||
|
class AuthorModel(BaseModel):
|
||||||
|
id: int
|
||||||
|
name: str
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
orm_mode = True
|
||||||
|
|
||||||
|
class BookCreate(BaseModel):
|
||||||
|
title: constr(min_length=1, max_length=100)
|
||||||
|
author_id: conint(gt=0)
|
||||||
|
|
||||||
|
class BookModel(BaseModel):
|
||||||
|
id: int
|
||||||
|
title: str
|
||||||
|
author_id: int
|
||||||
|
status: Optional[str] = None
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
orm_mode = True
|
||||||
|
|
||||||
|
class BookWithAuthor(BookModel):
|
||||||
|
author: AuthorModel
|
||||||
|
|
|
@ -0,0 +1,194 @@
|
||||||
|
LOCUS 40924_17796 5369 bp DNA circular SYN 14-OCT-2021
|
||||||
|
DEFINITION synthetic circular DNA.
|
||||||
|
ACCESSION .
|
||||||
|
VERSION .
|
||||||
|
KEYWORDS .
|
||||||
|
SOURCE synthetic DNA construct
|
||||||
|
ORGANISM synthetic DNA construct
|
||||||
|
REFERENCE 1 (bases 1 to 5369)
|
||||||
|
AUTHORS caoheibi
|
||||||
|
TITLE Direct Submission
|
||||||
|
REFERENCE 2 (bases 1 to 5369)
|
||||||
|
AUTHORS .
|
||||||
|
TITLE Direct Submission
|
||||||
|
COMMENT SGRef: number: 1; type: "Journal Article"
|
||||||
|
FEATURES Location/Qualifiers
|
||||||
|
source 1..5369
|
||||||
|
/mol_type="other DNA"
|
||||||
|
/organism="synthetic DNA construct"
|
||||||
|
terminator complement(26..73)
|
||||||
|
/label=T7 terminator
|
||||||
|
/note="transcription terminator for bacteriophage T7 RNA
|
||||||
|
polymerase"
|
||||||
|
CDS complement(140..157)
|
||||||
|
/codon_start=1
|
||||||
|
/label=6xHis
|
||||||
|
/note="6xHis affinity tag"
|
||||||
|
/translation="HHHHHH"
|
||||||
|
CDS complement(207..239)
|
||||||
|
/codon_start=1
|
||||||
|
/label=T7 tag (gene 10 leader)
|
||||||
|
/note="leader peptide from bacteriophage T7 gene 10"
|
||||||
|
/translation="MASMTGGQQMG"
|
||||||
|
CDS complement(243..260)
|
||||||
|
/codon_start=1
|
||||||
|
/label=thrombin site
|
||||||
|
/note="thrombin recognition and cleavage site"
|
||||||
|
/translation="LVPRGS"
|
||||||
|
CDS complement(270..287)
|
||||||
|
/codon_start=1
|
||||||
|
/label=6xHis
|
||||||
|
/note="6xHis affinity tag"
|
||||||
|
/translation="HHHHHH"
|
||||||
|
RBS complement(306..328)
|
||||||
|
/label=RBS
|
||||||
|
/note="efficient ribosome binding site from bacteriophage
|
||||||
|
T7 gene 10 (Olins and Rangwala, 1989)"
|
||||||
|
protein_bind complement(343..367)
|
||||||
|
/label=lac operator
|
||||||
|
/note="The lac repressor binds to the lac operator to
|
||||||
|
inhibit transcription in E. coli. This inhibition can be
|
||||||
|
relieved by adding lactose or
|
||||||
|
isopropyl-beta-D-thiogalactopyranoside (IPTG)."
|
||||||
|
promoter complement(368..386)
|
||||||
|
/label=T7 promoter
|
||||||
|
/note="promoter for bacteriophage T7 RNA polymerase"
|
||||||
|
promoter 695..772
|
||||||
|
/label=lacI promoter
|
||||||
|
CDS 773..1852
|
||||||
|
/codon_start=1
|
||||||
|
/label=lacI
|
||||||
|
/note="lac repressor"
|
||||||
|
/translation="VKPVTLYDVAEYAGVSYQTVSRVVNQASHVSAKTREKVEAAMAEL
|
||||||
|
NYIPNRVAQQLAGKQSLLIGVATSSLALHAPSQIVAAIKSRADQLGASVVVSMVERSGV
|
||||||
|
EACKAAVHNLLAQRVSGLIINYPLDDQDAIAVEAACTNVPALFLDVSDQTPINSIIFSH
|
||||||
|
EDGTRLGVEHLVALGHQQIALLAGPLSSVSARLRLAGWHKYLTRNQIQPIAEREGDWSA
|
||||||
|
MSGFQQTMQMLNEGIVPTAMLVANDQMALGAMRAITESGLRVGADISVVGYDDTEDSSC
|
||||||
|
YIPPLTTIKQDFRLLGQTSVDRLLQLSQGQAVKGNQLLPVSLVKRKTTLAPNTQTASPR
|
||||||
|
ALADSLMQLARQVSRLESGQ"
|
||||||
|
protein_bind 1868..1889
|
||||||
|
/label=CAP binding site
|
||||||
|
/note="CAP binding activates transcription in the presence
|
||||||
|
of cAMP."
|
||||||
|
CDS 2664..2852
|
||||||
|
/codon_start=1
|
||||||
|
/label=rop
|
||||||
|
/note="Rop protein, which maintains plasmids at low copy
|
||||||
|
number"
|
||||||
|
/translation="VTKQEKTALNMARFIRSQTLTLLEKLNELDADEQADICESLHDHA
|
||||||
|
DELYRSCLARFGDDGENL"
|
||||||
|
misc_feature 2957..3099
|
||||||
|
/label=bom
|
||||||
|
/note="basis of mobility region from pBR322"
|
||||||
|
rep_origin complement(3285..3873)
|
||||||
|
/direction=LEFT
|
||||||
|
/label=ori
|
||||||
|
/note="high-copy-number ColE1/pMB1/pBR322/pUC origin of
|
||||||
|
replication"
|
||||||
|
CDS 3995..4807
|
||||||
|
/codon_start=1
|
||||||
|
/label=KanR
|
||||||
|
/note="aminoglycoside phosphotransferase"
|
||||||
|
/translation="MSHIQRETSCSRPRLNSNMDADLYGYKWARDNVGQSGATIYRLYG
|
||||||
|
KPDAPELFLKHGKGSVANDVTDEMVRLNWLTEFMPLPTIKHFIRTPDDAWLLTTAIPGK
|
||||||
|
TAFQVLEEYPDSGENIVDALAVFLRRLHSIPVCNCPFNSDRVFRLAQAQSRMNNGLVDA
|
||||||
|
SDFDDERNGWPVEQVWKEMHKLLPFSPDSVVTHGDFSLDNLIFDEGKLIGCIDVGRVGI
|
||||||
|
ADRYQDLAILWNCLGEFSPSLQKRLFQKYGIDNPDMNKLQFHLMLDEFF"
|
||||||
|
rep_origin complement(4903..5358)
|
||||||
|
/direction=LEFT
|
||||||
|
/label=f1 ori
|
||||||
|
/note="f1 bacteriophage origin of replication; arrow
|
||||||
|
indicates direction of (+) strand synthesis"
|
||||||
|
ORIGIN
|
||||||
|
1 atccggatat agttcctcct ttcagcaaaa aacccctcaa gacccgttta gaggccccaa
|
||||||
|
61 ggggttatgc tagttattgc tcagcggtgg cagcagccaa ctcagcttcc tttcgggctt
|
||||||
|
121 tgttagcagc cggatctcag tggtggtggt ggtggtgctc gagtgcggcc gcaagcttgt
|
||||||
|
181 cgacggagct cgaattcgga tccgcgaccc atttgctgtc caccagtcat gctagccata
|
||||||
|
241 tggctgccgc gcggcaccag gccgctgctg tgatgatgat gatgatggct gctgcccatg
|
||||||
|
301 gtatatctcc ttcttaaagt taaacaaaat tatttctaga ggggaattgt tatccgctca
|
||||||
|
361 caattcccct atagtgagtc gtattaattt cgcgggatcg agatctcgat cctctacgcc
|
||||||
|
421 ggacgcatcg tggccggcat caccggcgcc acaggtgcgg ttgctggcgc ctatatcgcc
|
||||||
|
481 gacatcaccg atggggaaga tcgggctcgc cacttcgggc tcatgagcgc ttgtttcggc
|
||||||
|
541 gtgggtatgg tggcaggccc cgtggccggg ggactgttgg gcgccatctc cttgcatgca
|
||||||
|
601 ccattccttg cggcggcggt gctcaacggc ctcaacctac tactgggctg cttcctaatg
|
||||||
|
661 caggagtcgc ataagggaga gcgtcgagat cccggacacc atcgaatggc gcaaaacctt
|
||||||
|
721 tcgcggtatg gcatgatagc gcccggaaga gagtcaattc agggtggtga atgtgaaacc
|
||||||
|
781 agtaacgtta tacgatgtcg cagagtatgc cggtgtctct tatcagaccg tttcccgcgt
|
||||||
|
841 ggtgaaccag gccagccacg tttctgcgaa aacgcgggaa aaagtggaag cggcgatggc
|
||||||
|
901 ggagctgaat tacattccca accgcgtggc acaacaactg gcgggcaaac agtcgttgct
|
||||||
|
961 gattggcgtt gccacctcca gtctggccct gcacgcgccg tcgcaaattg tcgcggcgat
|
||||||
|
1021 taaatctcgc gccgatcaac tgggtgccag cgtggtggtg tcgatggtag aacgaagcgg
|
||||||
|
1081 cgtcgaagcc tgtaaagcgg cggtgcacaa tcttctcgcg caacgcgtca gtgggctgat
|
||||||
|
1141 cattaactat ccgctggatg accaggatgc cattgctgtg gaagctgcct gcactaatgt
|
||||||
|
1201 tccggcgtta tttcttgatg tctctgacca gacacccatc aacagtatta ttttctccca
|
||||||
|
1261 tgaagacggt acgcgactgg gcgtggagca tctggtcgca ttgggtcacc agcaaatcgc
|
||||||
|
1321 gctgttagcg ggcccattaa gttctgtctc ggcgcgtctg cgtctggctg gctggcataa
|
||||||
|
1381 atatctcact cgcaatcaaa ttcagccgat agcggaacgg gaaggcgact ggagtgccat
|
||||||
|
1441 gtccggtttt caacaaacca tgcaaatgct gaatgagggc atcgttccca ctgcgatgct
|
||||||
|
1501 ggttgccaac gatcagatgg cgctgggcgc aatgcgcgcc attaccgagt ccgggctgcg
|
||||||
|
1561 cgttggtgcg gatatctcgg tagtgggata cgacgatacc gaagacagct catgttatat
|
||||||
|
1621 cccgccgtta accaccatca aacaggattt tcgcctgctg gggcaaacca gcgtggaccg
|
||||||
|
1681 cttgctgcaa ctctctcagg gccaggcggt gaagggcaat cagctgttgc ccgtctcact
|
||||||
|
1741 ggtgaaaaga aaaaccaccc tggcgcccaa tacgcaaacc gcctctcccc gcgcgttggc
|
||||||
|
1801 cgattcatta atgcagctgg cacgacaggt ttcccgactg gaaagcgggc agtgagcgca
|
||||||
|
1861 acgcaattaa tgtaagttag ctcactcatt aggcaccggg atctcgaccg atgcccttga
|
||||||
|
1921 gagccttcaa cccagtcagc tccttccggt gggcgcgggg catgactatc gtcgccgcac
|
||||||
|
1981 ttatgactgt cttctttatc atgcaactcg taggacaggt gccggcagcg ctctgggtca
|
||||||
|
2041 ttttcggcga ggaccgcttt cgctggagcg cgacgatgat cggcctgtcg cttgcggtat
|
||||||
|
2101 tcggaatctt gcacgccctc gctcaagcct tcgtcactgg tcccgccacc aaacgtttcg
|
||||||
|
2161 gcgagaagca ggccattatc gccggcatgg cggccccacg ggtgcgcatg atcgtgctcc
|
||||||
|
2221 tgtcgttgag gacccggcta ggctggcggg gttgccttac tggttagcag aatgaatcac
|
||||||
|
2281 cgatacgcga gcgaacgtga agcgactgct gctgcaaaac gtctgcgacc tgagcaacaa
|
||||||
|
2341 catgaatggt cttcggtttc cgtgtttcgt aaagtctgga aacgcggaag tcagcgccct
|
||||||
|
2401 gcaccattat gttccggatc tgcatcgcag gatgctgctg gctaccctgt ggaacaccta
|
||||||
|
2461 catctgtatt aacgaagcgc tggcattgac cctgagtgat ttttctctgg tcccgccgca
|
||||||
|
2521 tccataccgc cagttgttta ccctcacaac gttccagtaa ccgggcatgt tcatcatcag
|
||||||
|
2581 taacccgtat cgtgagcatc ctctctcgtt tcatcggtat cattaccccc atgaacagaa
|
||||||
|
2641 atccccctta cacggaggca tcagtgacca aacaggaaaa aaccgccctt aacatggccc
|
||||||
|
2701 gctttatcag aagccagaca ttaacgcttc tggagaaact caacgagctg gacgcggatg
|
||||||
|
2761 aacaggcaga catctgtgaa tcgcttcacg accacgctga tgagctttac cgcagctgcc
|
||||||
|
2821 tcgcgcgttt cggtgatgac ggtgaaaacc tctgacacat gcagctcccg gagacggtca
|
||||||
|
2881 cagcttgtct gtaagcggat gccgggagca gacaagcccg tcagggcgcg tcagcgggtg
|
||||||
|
2941 ttggcgggtg tcggggcgca gccatgaccc agtcacgtag cgatagcgga gtgtatactg
|
||||||
|
3001 gcttaactat gcggcatcag agcagattgt actgagagtg caccatatat gcggtgtgaa
|
||||||
|
3061 ataccgcaca gatgcgtaag gagaaaatac cgcatcaggc gctcttccgc ttcctcgctc
|
||||||
|
3121 actgactcgc tgcgctcggt cgttcggctg cggcgagcgg tatcagctca ctcaaaggcg
|
||||||
|
3181 gtaatacggt tatccacaga atcaggggat aacgcaggaa agaacatgtg agcaaaaggc
|
||||||
|
3241 cagcaaaagg ccaggaaccg taaaaaggcc gcgttgctgg cgtttttcca taggctccgc
|
||||||
|
3301 ccccctgacg agcatcacaa aaatcgacgc tcaagtcaga ggtggcgaaa cccgacagga
|
||||||
|
3361 ctataaagat accaggcgtt tccccctgga agctccctcg tgcgctctcc tgttccgacc
|
||||||
|
3421 ctgccgctta ccggatacct gtccgccttt ctcccttcgg gaagcgtggc gctttctcat
|
||||||
|
3481 agctcacgct gtaggtatct cagttcggtg taggtcgttc gctccaagct gggctgtgtg
|
||||||
|
3541 cacgaacccc ccgttcagcc cgaccgctgc gccttatccg gtaactatcg tcttgagtcc
|
||||||
|
3601 aacccggtaa gacacgactt atcgccactg gcagcagcca ctggtaacag gattagcaga
|
||||||
|
3661 gcgaggtatg taggcggtgc tacagagttc ttgaagtggt ggcctaacta cggctacact
|
||||||
|
3721 agaaggacag tatttggtat ctgcgctctg ctgaagccag ttaccttcgg aaaaagagtt
|
||||||
|
3781 ggtagctctt gatccggcaa acaaaccacc gctggtagcg gtggtttttt tgtttgcaag
|
||||||
|
3841 cagcagatta cgcgcagaaa aaaaggatct caagaagatc ctttgatctt ttctacgggg
|
||||||
|
3901 tctgacgctc agtggaacga aaactcacgt taagggattt tggtcatgaa caataaaact
|
||||||
|
3961 gtctgcttac ataaacagta atacaagggg tgttatgagc catattcaac gggaaacgtc
|
||||||
|
4021 ttgctctagg ccgcgattaa attccaacat ggatgctgat ttatatgggt ataaatgggc
|
||||||
|
4081 tcgcgataat gtcgggcaat caggtgcgac aatctatcga ttgtatggga agcccgatgc
|
||||||
|
4141 gccagagttg tttctgaaac atggcaaagg tagcgttgcc aatgatgtta cagatgagat
|
||||||
|
4201 ggtcagacta aactggctga cggaatttat gcctcttccg accatcaagc attttatccg
|
||||||
|
4261 tactcctgat gatgcatggt tactcaccac tgcgatcccc gggaaaacag cattccaggt
|
||||||
|
4321 attagaagaa tatcctgatt caggtgaaaa tattgttgat gcgctggcag tgttcctgcg
|
||||||
|
4381 ccggttgcat tcgattcctg tttgtaattg tccttttaac agcgatcgcg tatttcgtct
|
||||||
|
4441 cgctcaggcg caatcacgaa tgaataacgg tttggttgat gcgagtgatt ttgatgacga
|
||||||
|
4501 gcgtaatggc tggcctgttg aacaagtctg gaaagaaatg cataaacttt tgccattctc
|
||||||
|
4561 accggattca gtcgtcactc atggtgattt ctcacttgat aaccttattt ttgacgaggg
|
||||||
|
4621 gaaattaata ggttgtattg atgttggacg agtcggaatc gcagaccgat accaggatct
|
||||||
|
4681 tgccatccta tggaactgcc tcggtgagtt ttctccttca ttacagaaac ggctttttca
|
||||||
|
4741 aaaatatggt attgataatc ctgatatgaa taaattgcag tttcatttga tgctcgatga
|
||||||
|
4801 gtttttctaa gaattaattc atgagcggat acatatttga atgtatttag aaaaataaac
|
||||||
|
4861 aaataggggt tccgcgcaca tttccccgaa aagtgccacc tgaaattgta aacgttaata
|
||||||
|
4921 ttttgttaaa attcgcgtta aatttttgtt aaatcagctc attttttaac caataggccg
|
||||||
|
4981 aaatcggcaa aatcccttat aaatcaaaag aatagaccga gatagggttg agtgttgttc
|
||||||
|
5041 cagtttggaa caagagtcca ctattaaaga acgtggactc caacgtcaaa gggcgaaaaa
|
||||||
|
5101 ccgtctatca gggcgatggc ccactacgtg aaccatcacc ctaatcaagt tttttggggt
|
||||||
|
5161 cgaggtgccg taaagcacta aatcggaacc ctaaagggag cccccgattt agagcttgac
|
||||||
|
5221 ggggaaagcc ggcgaacgtg gcgagaaagg aagggaagaa agcgaaagga gcgggcgcta
|
||||||
|
5281 gggcgctggc aagtgtagcg gtcacgctgc gcgtaaccac cacacccgcc gcgcttaatg
|
||||||
|
5341 cgccgctaca gggcgcgtcc cattcgcca
|
||||||
|
//
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
version: "3.7"
|
||||||
|
services:
|
||||||
|
|
||||||
|
web-server:
|
||||||
|
build:
|
||||||
|
dockerfile: php/Dockerfile
|
||||||
|
context: .
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- "./html/:/var/www/html/"
|
||||||
|
ports:
|
||||||
|
- "8080:80"
|
||||||
|
|
||||||
|
mysql-server:
|
||||||
|
image: mysql:8.0.19
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: secret
|
||||||
|
volumes:
|
||||||
|
- mysql-data:/var/lib/mysql
|
||||||
|
ports:
|
||||||
|
- "3306:3306"
|
||||||
|
|
||||||
|
phpmyadmin:
|
||||||
|
image: phpmyadmin/phpmyadmin:5.0.1
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
PMA_HOST: mysql-server
|
||||||
|
PMA_USER: root
|
||||||
|
PMA_PASSWORD: secret
|
||||||
|
ports:
|
||||||
|
- "5000:80"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mysql-data:
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
# entrypoint.py
|
||||||
|
from Bio import SeqIO
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from app.database import engine, SessionLocal, Base
|
||||||
|
from app.models import Sequence, Feature
|
||||||
|
import json
|
||||||
|
|
||||||
|
# Tworzenie tabeli w bazie danych
|
||||||
|
Base.metadata.create_all(bind=engine)
|
||||||
|
|
||||||
|
def get_db():
|
||||||
|
db = SessionLocal()
|
||||||
|
try:
|
||||||
|
yield db
|
||||||
|
finally:
|
||||||
|
db.close()
|
||||||
|
|
||||||
|
def load_genbank_to_db(file_path: str):
|
||||||
|
db = next(get_db())
|
||||||
|
with open(file_path, 'r') as file:
|
||||||
|
record = SeqIO.read(file, "genbank")
|
||||||
|
|
||||||
|
# Zapisz sekwencję do bazy danych
|
||||||
|
sequence_data = Sequence(
|
||||||
|
name=record.name,
|
||||||
|
description=record.description,
|
||||||
|
sequence=str(record.seq)
|
||||||
|
)
|
||||||
|
db.add(sequence_data)
|
||||||
|
db.commit()
|
||||||
|
|
||||||
|
# Zapisz cechy (features) do bazy danych
|
||||||
|
for feature in record.features:
|
||||||
|
feature_data = Feature(
|
||||||
|
type=feature.type,
|
||||||
|
location=str(feature.location),
|
||||||
|
sequence=str(record.seq[feature.location.start:feature.location.end]),
|
||||||
|
qualifiers=json.dumps(feature.qualifiers),
|
||||||
|
sequence_id=sequence_data.id
|
||||||
|
)
|
||||||
|
db.add(feature_data)
|
||||||
|
db.commit()
|
||||||
|
print(f"Loaded {file_path} to database.")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
load_genbank_to_db("data/pET-28+(a).gb")
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
FROM php:7.4.3-apache
|
||||||
|
RUN docker-php-ext-install mysqli pdo pdo_mysql
|
|
@ -0,0 +1,22 @@
|
||||||
|
[tool.poetry]
|
||||||
|
name = "app"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Przykład aplikacji FastAPI z WebSockets i Flutter"
|
||||||
|
authors = ["mpabi"]
|
||||||
|
|
||||||
|
[tool.poetry.dependencies]
|
||||||
|
python = "^3.8"
|
||||||
|
fastapi = "^0.85"
|
||||||
|
websockets = "^12.0"
|
||||||
|
sqlalchemy = "^2.0.26"
|
||||||
|
strawberry-graphql = {extras = ["fastapi"], version = "^0.219.2"}
|
||||||
|
mysqlclient = "^2.2.4"
|
||||||
|
mysql-connector-python = "^8.3.0"
|
||||||
|
|
||||||
|
[tool.poetry.dev-dependencies]
|
||||||
|
uvicorn = "^0.17.6"
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["poetry-core>=1.0.0"]
|
||||||
|
build-backend = "poetry run pip install --no-deps ."
|
||||||
|
build-frontend = "poetry run flutter build web"
|
|
@ -0,0 +1,69 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Feature Viewer</title>
|
||||||
|
<script src="/static/vue.global.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app">
|
||||||
|
<h1>Feature Viewer</h1>
|
||||||
|
<button @click="fetchSequences">Fetch Sequences</button>
|
||||||
|
<button @click="fetchFeatures">Fetch Features</button>
|
||||||
|
<div v-if="sequences.length">
|
||||||
|
<h2>Sequences:</h2>
|
||||||
|
<ul>
|
||||||
|
<li v-for="sequence in sequences" :key="sequence.id">
|
||||||
|
<p><strong>Name:</strong> {{ sequence.name }}</p>
|
||||||
|
<p><strong>Description:</strong> {{ sequence.description }}</p>
|
||||||
|
<p><strong>Sequence:</strong> {{ sequence.sequence }}</p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div v-if="features.length">
|
||||||
|
<h2>Features:</h2>
|
||||||
|
<ul>
|
||||||
|
<li v-for="feature in features" :key="feature.id">
|
||||||
|
<p><strong>Type:</strong> {{ feature.type }}</p>
|
||||||
|
<p><strong>Location:</strong> {{ feature.location }}</p>
|
||||||
|
<p><strong>Sequence:</strong> {{ feature.sequence }}</p>
|
||||||
|
<p><strong>Qualifiers:</strong> {{ feature.qualifiers }}</p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const { createApp } = Vue;
|
||||||
|
|
||||||
|
createApp({
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
sequences: [],
|
||||||
|
features: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async fetchSequences() {
|
||||||
|
try {
|
||||||
|
const response = await fetch('/sequences/');
|
||||||
|
this.sequences = await response.json();
|
||||||
|
} catch (error) {
|
||||||
|
console.error("There was an error fetching the sequences:", error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async fetchFeatures() {
|
||||||
|
try {
|
||||||
|
const response = await fetch('/features/');
|
||||||
|
this.features = await response.json();
|
||||||
|
} catch (error) {
|
||||||
|
console.error("There was an error fetching the features:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).mount('#app');
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
const BASE_URL = 'http://qstack.pl:1111'; // Zaktualizuj zgodnie z konfiguracją Twojego serwera
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
loadAuthors();
|
||||||
|
loadBooks();
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById('addAuthorForm').addEventListener('submit', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const authorName = document.getElementById('authorName').value;
|
||||||
|
fetch(`${BASE_URL}/authors/`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ name: authorName }),
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(() => {
|
||||||
|
loadAuthors(); // Ponowne ładowanie listy autorów po dodaniu nowego autora
|
||||||
|
})
|
||||||
|
.catch(error => console.error('Error:', error));
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById('addBookForm').addEventListener('submit', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const bookTitle = document.getElementById('bookTitle').value;
|
||||||
|
const bookAuthorId = document.getElementById('bookAuthorId').value;
|
||||||
|
fetch(`${BASE_URL}/books/`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ title: bookTitle, author_id: parseInt(bookAuthorId, 10) }),
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(() => {
|
||||||
|
loadBooks(); // Ponowne ładowanie listy książek po dodaniu nowej książki
|
||||||
|
})
|
||||||
|
.catch(error => console.error('Error:', error));
|
||||||
|
});
|
||||||
|
|
||||||
|
function loadAuthors() {
|
||||||
|
fetch(`${BASE_URL}/authors/`)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
const authorsSelect = document.getElementById('bookAuthorId');
|
||||||
|
authorsSelect.innerHTML = '<option value="">Select an Author</option>'; // Dodaj domyślną opcję
|
||||||
|
data.forEach(author => {
|
||||||
|
const option = document.createElement('option');
|
||||||
|
option.value = author.id;
|
||||||
|
option.textContent = author.name;
|
||||||
|
authorsSelect.appendChild(option);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(error => console.error('Error:', error));
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadBooks() {
|
||||||
|
fetch(`${BASE_URL}/books/`)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
const booksList = document.getElementById('booksList');
|
||||||
|
booksList.innerHTML = '';
|
||||||
|
data.forEach(book => {
|
||||||
|
const listItem = document.createElement('li');
|
||||||
|
listItem.textContent = `${book.title} - Author ID: ${book.author_id}`;
|
||||||
|
booksList.appendChild(listItem);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(error => console.error('Error:', error));
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
body, html {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
header, footer {
|
||||||
|
background-color: #333;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
padding: 1rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
min-height: calc(100vh - 100px); /* Adjust based on header/footer height */
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
width: 30%;
|
||||||
|
padding: 20px;
|
||||||
|
background-color: #f4f4f4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
flex-grow: 1;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
form > * {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
list-style-type: none;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue