51 lines
1.5 KiB
Python
51 lines
1.5 KiB
Python
import sys
|
|
import argparse
|
|
|
|
from obitools3.obidms._obidms import OBIDMS
|
|
|
|
if __name__ == '__main__':
|
|
|
|
parser = argparse.ArgumentParser(description='Pseudo obigrep.')
|
|
|
|
parser.add_argument('-V', '--view', dest='view', type=str,
|
|
help='Name of the view that should be considered')
|
|
|
|
parser.add_argument('-N', '--new_view', dest='new_view', type=str,
|
|
help='Name of the new view that should be created')
|
|
|
|
# parser.add_argument('-k', '--key', dest='key', type=str,
|
|
# help='Name of the key that should be considered')
|
|
#
|
|
# parser.add_argument('-c', '--comp', dest='comparison', type=int,
|
|
# help='Comparison to be made: -1:< ; 0:== ; 1:>')
|
|
#
|
|
# parser.add_argument('-v', '--value', dest='value', type=object,
|
|
# help='Value to be compared')
|
|
|
|
args = parser.parse_args()
|
|
|
|
d = OBIDMS('tdms')
|
|
|
|
#condition = 1
|
|
line_selec = []
|
|
|
|
v = d.open_view(args.view)
|
|
|
|
i = 0
|
|
for l in v :
|
|
if l['score'] > 350 :
|
|
line_selec.append(i)
|
|
i+=1
|
|
|
|
new_v = d.new_view(args.new_view, view_to_clone=v, line_selection=line_selec, view_type="NUC_SEQS_VIEW", comments="obigrep "+args.view+" to "+args.new_view) #args.key+" "+str(args.comparison)+" "+str(args.value)+" "+)
|
|
|
|
print("\n")
|
|
print(new_v.__repr__())
|
|
|
|
v.save_and_close()
|
|
new_v.save_and_close()
|
|
|
|
d.close()
|
|
|
|
print("\nDone.")
|
|
|