-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathisoparent.py
More file actions
55 lines (45 loc) · 1.79 KB
/
isoparent.py
File metadata and controls
55 lines (45 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#import sys
import os.path
#from os.path import basename
#import re
import pandas as pd #para imprimir en forma de tabla
#from matplotlib import pyplot as plt
#import numpy as np
#from scipy.optimize import curve_fit
#from scipy import asarray as ar,exp
#from math import sqrt, pi
#import time
#import signal
#import keyboard
# mainPath=sys.path[0] # sources dir
#from myLibs.parsers import getDictFromInfoFile
#from myLibs.miscellaneus import getIdxRangeVals, WriteOutputFileRR
#from myLibs.gilmoreStats import *
#from myLibs.fitting import *
#from myLibs.autoPeakFunk import *
from myLibs.QueryDB import OpenDatabase, CloseDatabase, GetChainAndChild, GetMainChain
#from myLibs.plotting import *
def Parent(ListOpt):
List = ListOpt.copy()
List.pop(0)
if len(List) == 0:
print("error: --parent option needs an argument")
return 400
pathfile = os.path.realpath(__file__)
pathfile = pathfile.strip('isoparent.py')
conexion = OpenDatabase(pathfile)
for Isotope in List:
MainChainIso,Child = GetChainAndChild(conexion,Isotope)
if MainChainIso == None or Child == None:
print('Isotope: ' + Isotope + ' -- Parent: ' + 'None' + ' --Child: ' + 'None' + '\n')
print('There is not enough information in the database or the isotope ' + Isotope + ' do not have Child or parents isotopes. \n')
else:
MainChain = GetMainChain(conexion,MainChainIso)
if '+' in MainChain:
AuxStr = MainChain.split('+')[1]
Parentiso = AuxStr.split('#')[0]
else:
Parentiso = MainChain[0].split('#')[0]
print('Isotope: ' + Isotope + ' -- Parent: ' + Parentiso + ' --Child: ' + Child + '\n')
CloseDatabase(conexion)
return 0