Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aufsetzen der Git Struktur mit Dateien aus dem Google Docs #4

Open
holtgrewe opened this issue Apr 2, 2020 · 0 comments
Open

Aufsetzen der Git Struktur mit Dateien aus dem Google Docs #4

holtgrewe opened this issue Apr 2, 2020 · 0 comments

Comments

@holtgrewe
Copy link
Member

## files
 
beacon/
  __init__.py
  common.py
  #web_ui.py
  flask_app.py
  user_cli.py
  rest_api.py 
  admin_cli.py 
  database.py  
    
 
beacon/templates/
home.html
handle.html
layout.html
 
beacon/static/
main.css
 
## __init__.py
 
## module beacon.common
 
class Variant:
	chr: str
	pos: int
	res: chr
	alt: chr
 
class AnnotatedVariant:
	var: Variant
	occ: bool
	
class VariantStringParser:
	var_str: str
 
def parse_var(var_str): 
   “”” Input: variant string
	 Output: variant object 
		 parses an input string to a variant object “””
	   pass
      
 
## module beacon.flask_app
 
import beacon.common
import beacon.database
from flask import Flask, render_template, url_for, request, (redirect)
 
@app.route(“/”)
def home():
	“”” 
Input: /
	Output: render_template(home.html) 
	home with input field and submit button
“””
 
@app.route(“/results”)
def handle():
	“””
	Input: request.form Object
	Output: render_template(result.html, **locals()), 
	takes string from home.html, uses VariantStringParser to convert the input 
string into Variant object and uses form database imported function 
“handle_variant”
	“””
 
 
## module beacon.user_cli
 
import argparse
import sys
import beacon.common
 
def main(args): parser = argparse.ArgumentParser()
“”” var_str = user input
    Output (print): Annotated Variant
    host$ python beacon.user_cli.py var_str“””
 
 
## module rest_api
curl - localserver
 
from flask import Flask,jsonify
import beacon.database
 
def _check_input(var_str):
“””Input: variant_str
Output: check_bool
function checks if input has correct input format “””
return check_bool
 
class query_variant 
	def dict()
		api = [{“chr”:,
        		 “pos”:,
 “res”:,
 “alt”:,
 “occ”:
}]
	def db_connection.run_query(var)
 
from . import frontend
 
@app.route(“/api/all”,methods =[‘GET’])
def get_api_all()
	return jsonify(api -> beacon.database.handel_variant(Variant))
 
@app.route(“/api/<var_str>”,methods =[‘GET’])
def get_api(var_str)
	return jsonify( occ -> beacon.database.handel_variant(Variant))

def parse_annVar_to_json()
 
## module beacon.database
 
import sqlite3
import beacon.common
 
class Database:
 	Datenbank = path_str
 
class OperateDatabase:
	def handle_variant(common.Variant)
	“””Input: Variant Object
	   Output: AnnotatedVariant (bool)
	   Gets an variant object from flask handle and parses request to   database and gets an Annotated as an output “””
 
class ConnectDatabase
def connect(Database):
“””Input: path_to_db
   Output: con
   function provides connection to given database “””

def parse_statement(sql_str):
“””Input: sql_string
Output: cursor_ouput, AnnotatedVariant
function creates cursor object and requests database, gives “answer” back “””

def disconnect(con)
“””closes connection and commits and connection con.comm and con.close ”

 
## module beacon.admin_cli
 
import sqlite3
import beacon.common
import beacon.database
import pyvcf
import sys ??
import argparse
 
class ImportVcfCommand:
	def parse_vcf_variant(vcf_file):
“””Input: vcf_file
      Output: list of Variant Objects
      function reads vcf_file and converts them to variant objects “””
	 return variants
 
class CreateDbCommand:
	def create_db(path_str):
“””Input: path_str
   Output: bool									
creates new database and initialises db_object and gives bool if succeeded back”
 
def create_tables(common.Variant,database.Database):
“”” Input: Variant
Output: bool
creates variant table in database ”””
return suc_bool
 
def insert_data(common.Variant,database.Database):
“”” Input: Variant
Output: bool
inserts rows into a table in the database”””
return suc_bool
 
class SearchDuplicatesCommand:
def find_dup(database.Database):
“”” Input: database
Output: bool
looks for duplicates
”””
 
class OperateDatabase:
	def print(Database)
	“”” prints whole Database or specific rows“”
 
	def count_variants()
	“”” counts the existing number of (all) Variants ”””
	
def updating_data(variants)
	“””Input:variants
	   Output:bool
	   function access the database using connect() and updates.“””
 
def delete_data(common.Variant, database.Database):
“”” Input: Variant, Database
Output: bool
function deletes given Variant in db and gives bool if succeeded back”””
return suc_bool
 
def _main_(args):
“”” interacts with admin and connects function ”””
 
#nct: def export_db()
 
## module beacon.templates.home
 
{% extends "layout.html" %} 
{% block contennt %}
        <body></bo
{% endblock %}
 
 
## module beacon.templates.output
 
## module beacon.templates.layout
 
 
## module beacon.static.main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant