Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
6d445fe3ad | |||
824deb7e21 | |||
d579bb2749 | |||
10e5ebdbc0 | |||
8833110490 | |||
bd38449f2d | |||
904823c827 |
@ -322,7 +322,7 @@ cdef tuple annotate(sequences, infos, no_tags, verbose=False):
|
|||||||
sequences[0] = sequences[0][directmatch[1][2]:]
|
sequences[0] = sequences[0][directmatch[1][2]:]
|
||||||
else:
|
else:
|
||||||
sequences[1] = sequences[1][directmatch[1][2]:]
|
sequences[1] = sequences[1][directmatch[1][2]:]
|
||||||
sequences[0][REVERSE_SEQUENCE_COLUMN] = sequences[1].seq # used by alignpairedend tool
|
sequences[0][REVERSE_SEQUENCE_COLUMN] = sequences[1].seq # used by alignpairedend tool
|
||||||
sequences[0][REVERSE_QUALITY_COLUMN] = sequences[1].quality # used by alignpairedend tool
|
sequences[0][REVERSE_QUALITY_COLUMN] = sequences[1].quality # used by alignpairedend tool
|
||||||
|
|
||||||
if directmatch[0].forward:
|
if directmatch[0].forward:
|
||||||
@ -369,7 +369,7 @@ cdef tuple annotate(sequences, infos, no_tags, verbose=False):
|
|||||||
sequences[0] = sequences[0][:r[1]]
|
sequences[0] = sequences[0][:r[1]]
|
||||||
else:
|
else:
|
||||||
sequences[1] = sequences[1][:r[1]]
|
sequences[1] = sequences[1][:r[1]]
|
||||||
sequences[0][REVERSE_SEQUENCE_COLUMN] = sequences[1].seq # used by alignpairedend tool
|
sequences[0][REVERSE_SEQUENCE_COLUMN] = sequences[1].seq # used by alignpairedend tool
|
||||||
sequences[0][REVERSE_QUALITY_COLUMN] = sequences[1].quality # used by alignpairedend tool
|
sequences[0][REVERSE_QUALITY_COLUMN] = sequences[1].quality # used by alignpairedend tool
|
||||||
# do the same on the other seq
|
# do the same on the other seq
|
||||||
if first_match_first_seq:
|
if first_match_first_seq:
|
||||||
@ -394,7 +394,7 @@ cdef tuple annotate(sequences, infos, no_tags, verbose=False):
|
|||||||
seq_to_match = sequences[0]
|
seq_to_match = sequences[0]
|
||||||
reversematch = []
|
reversematch = []
|
||||||
# Compute begin
|
# Compute begin
|
||||||
begin=directmatch[1][2]+1 # end of match + 1 on the same sequence
|
#begin=directmatch[1][2]+1 # end of match + 1 on the same sequence -- No, already cut out forward primer
|
||||||
# Try reverse matching on the other sequence:
|
# Try reverse matching on the other sequence:
|
||||||
new_seq = True
|
new_seq = True
|
||||||
pattern = 0
|
pattern = 0
|
||||||
@ -408,7 +408,7 @@ cdef tuple annotate(sequences, infos, no_tags, verbose=False):
|
|||||||
primer=p
|
primer=p
|
||||||
# Saving original primer as 4th member of the tuple to serve as correct key in infos dict even if it might have been reversed complemented
|
# Saving original primer as 4th member of the tuple to serve as correct key in infos dict even if it might have been reversed complemented
|
||||||
# (3rd member already used by directmatch)
|
# (3rd member already used by directmatch)
|
||||||
reversematch.append((primer, primer(seq_to_match, same_sequence=not new_seq, pattern=pattern, begin=begin), None, p))
|
reversematch.append((primer, primer(seq_to_match, same_sequence=not new_seq, pattern=pattern, begin=0), None, p))
|
||||||
new_seq = False
|
new_seq = False
|
||||||
pattern+=1
|
pattern+=1
|
||||||
# Choose match closer to the end of the sequence
|
# Choose match closer to the end of the sequence
|
||||||
|
44
python/obitools3/commands/rm.pyx
Normal file
44
python/obitools3/commands/rm.pyx
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#cython: language_level=3
|
||||||
|
|
||||||
|
from obitools3.uri.decode import open_uri
|
||||||
|
from obitools3.apps.config import logger
|
||||||
|
from obitools3.dms import DMS
|
||||||
|
from obitools3.apps.optiongroups import addMinimalInputOption
|
||||||
|
from obitools3.dms.view.view cimport View
|
||||||
|
import os
|
||||||
|
|
||||||
|
__title__="Delete a view"
|
||||||
|
|
||||||
|
|
||||||
|
def addOptions(parser):
|
||||||
|
addMinimalInputOption(parser)
|
||||||
|
|
||||||
|
def run(config):
|
||||||
|
|
||||||
|
DMS.obi_atexit()
|
||||||
|
|
||||||
|
logger("info", "obi rm")
|
||||||
|
|
||||||
|
# Open the input
|
||||||
|
input = open_uri(config['obi']['inputURI'])
|
||||||
|
if input is None:
|
||||||
|
raise Exception("Could not read input")
|
||||||
|
|
||||||
|
# Check that it's a view
|
||||||
|
if isinstance(input[1], View) :
|
||||||
|
view = input[1]
|
||||||
|
else:
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
# Get the path to the view file to remove
|
||||||
|
path = input[0].full_path # dms path
|
||||||
|
path+=b"/VIEWS/"
|
||||||
|
path+=view.name
|
||||||
|
path+=b".obiview"
|
||||||
|
|
||||||
|
# Close the view and the DMS
|
||||||
|
view.close()
|
||||||
|
input[0].close(force=True)
|
||||||
|
|
||||||
|
# Rm
|
||||||
|
os.remove(path)
|
@ -354,8 +354,8 @@ cdef uniq_sequences(View_NUC_SEQS view, View_NUC_SEQS o_view, ProgressBar pb, di
|
|||||||
key = mergedKeys[k]
|
key = mergedKeys[k]
|
||||||
merged_col_name = mergedKeys_m[k]
|
merged_col_name = mergedKeys_m[k]
|
||||||
|
|
||||||
if merged_infos[merged_col_name]['nb_elts'] == 1:
|
# if merged_infos[merged_col_name]['nb_elts'] == 1:
|
||||||
raise Exception("Can't merge information from a tag with only one element (e.g. one sample ; don't use -m option)")
|
# raise Exception("Can't merge information from a tag with only one element (e.g. one sample ; don't use -m option)")
|
||||||
|
|
||||||
if merged_col_name in view:
|
if merged_col_name in view:
|
||||||
i_col = view[merged_col_name]
|
i_col = view[merged_col_name]
|
||||||
|
@ -600,7 +600,8 @@ cdef class View(OBIWrapper) :
|
|||||||
if element is not None:
|
if element is not None:
|
||||||
if element.comments[b"input_dms_name"] is not None :
|
if element.comments[b"input_dms_name"] is not None :
|
||||||
for i in range(len(element.comments[b"input_dms_name"])) :
|
for i in range(len(element.comments[b"input_dms_name"])) :
|
||||||
if element.comments[b"input_dms_name"][i] == element.dms.name and b"/" not in element.comments[b"input_view_name"][i]: # Same DMS and not a special element like a taxonomy
|
if b"/" not in element.comments[b"input_view_name"][i] and element.comments[b"input_view_name"][i] in element.dms \
|
||||||
|
and element.comments[b"input_dms_name"][i] == element.dms.name : # Same DMS and not a special element like a taxonomy and view was not deleted
|
||||||
top_level.append(element.dms[element.comments[b"input_view_name"][i]])
|
top_level.append(element.dms[element.comments[b"input_view_name"][i]])
|
||||||
else:
|
else:
|
||||||
top_level.append(None)
|
top_level.append(None)
|
||||||
|
@ -8,7 +8,7 @@ Created on feb 20th 2018
|
|||||||
|
|
||||||
import types
|
import types
|
||||||
from obitools3.utils cimport __etag__
|
from obitools3.utils cimport __etag__
|
||||||
|
from obitools3.utils cimport str2bytes
|
||||||
|
|
||||||
def tabIterator(lineiterator,
|
def tabIterator(lineiterator,
|
||||||
bint header = False,
|
bint header = False,
|
||||||
@ -75,7 +75,7 @@ def tabIterator(lineiterator,
|
|||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
# TODO ??? default column names? like R?
|
# TODO ??? default column names? like R?
|
||||||
keys = [i for i in range(len(line.split(sep)))]
|
keys = [str2bytes(str(i)) for i in range(len(line.split(sep)))]
|
||||||
|
|
||||||
while skipped < skip :
|
while skipped < skip :
|
||||||
line = next(iterator)
|
line = next(iterator)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
major = 3
|
major = 3
|
||||||
minor = 0
|
minor = 0
|
||||||
serial= '1b2'
|
serial= '1b5'
|
||||||
|
|
||||||
version ="%d.%d.%s" % (major,minor,serial)
|
version ="%d.%d.%s" % (major,minor,serial)
|
||||||
|
Reference in New Issue
Block a user