コード例 #1
0
ファイル: driver.py プロジェクト: D-Bhatta/Edu-Test
def qgs_instance(cursor,db):
    (tmarks,table,refno,new) = attribute_gen(cursor)
    print ('tmarks in driver.py:',tmarks)
    print ('table in driver.py:',table)
    print ('refno in driver.py:',refno)
    print ('new in driver.py:',new)

    #pass list of tables and marks list to qgs

    if ((qgs.qgs(tmarks,table,cursor))==1):
        print ('Done generating file')
        project.pro_ncupdate(cursor,refno,db)
コード例 #2
0
ファイル: test.py プロジェクト: machine2learn/QGS
import numpy as np
import os
import sys
sys.path.append("..") # Find packages in parent dir

from qgs import qgs, write_vcf, fltcmp


# Sample matrices
S1 = np.array([[0.2, 0.8],[0.1, 1.8]]);

# Reference matrices
R1 = np.array([[0],[2]]);

# Calculate expected QGS
qgs_exp = qgs(S1, R1)

# Write vcf files
write_vcf("sample.vcf", S1)
write_vcf("reference.vcf", R1)

# Run external QGS
os.system("../../qgs --sample sample.vcf --reference reference.vcf --genes ../testgenes.gtf --out test.csv --maf 0")

# Read QGS output file
qgs_values = pd.read_csv("test.csv", header=0)
qgs_gene1 = qgs_values.loc[0][9:].to_numpy().astype(float)

# Test
if np.sum(np.abs(np.subtract(qgs_exp, qgs_gene1))) < 0.000001:
  print("Test passed.")
コード例 #3
0
import pandas as pd
import numpy as np
import os
import sys
sys.path.append("..")  # Find packages in parent dir

from qgs import qgs, write_vcf, fltcmp

# Sample matrix
S = np.array([[0.2], [1.2]])

# Reference matrix
R = np.array([[0.5, 1.1, 1.4], [0.8, 0.1, 0.3]])

# Calculate expected QGS
qgs_exp = qgs(S, R)

# Write vcf files
write_vcf("sample.vcf", S)
write_vcf("reference.vcf", R)

# Run external QGS
os.system(
    "../../qgs --sample sample.vcf --reference reference.vcf --genes ../testgenes.gtf --out test.csv --maf 0"
)

# Read QGS output file
qgs_values = pd.read_csv("test.csv", header=0)
qgs_value = qgs_values.SubID0

# Test