minor comments and changes
This commit is contained in:
@ -30,16 +30,6 @@ def addOptions(parser):
|
|||||||
default=None,
|
default=None,
|
||||||
type=str,
|
type=str,
|
||||||
help="Name of the view.")
|
help="Name of the view.")
|
||||||
|
|
||||||
|
|
||||||
# group=parser.add_argument_group('obi check specific options')
|
|
||||||
|
|
||||||
# group.add_argument('--print',
|
|
||||||
# action="store", dest="less:print",
|
|
||||||
# metavar='<N>',
|
|
||||||
# default=None,
|
|
||||||
# type=int,
|
|
||||||
# help="Print N sequences (default: 10)")
|
|
||||||
|
|
||||||
|
|
||||||
def run(config):
|
def run(config):
|
||||||
@ -48,9 +38,9 @@ def run(config):
|
|||||||
d = DMS.open(config['obi']['defaultdms'])
|
d = DMS.open(config['obi']['defaultdms'])
|
||||||
|
|
||||||
# Open input view uif there is one
|
# Open input view uif there is one
|
||||||
if config['obi']['inputview'] is not None :
|
if 'view' in config['obi'] :
|
||||||
iview = View.open(d, config['obi']['view'])
|
view = View.open(d, config['obi']['view'])
|
||||||
print(repr(iview))
|
print(repr(view))
|
||||||
|
|
||||||
else :
|
else :
|
||||||
for v in d :
|
for v in d :
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#cython: language_level=3
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Created on 8 mars 2016
|
Created on 8 mars 2016
|
||||||
|
|
||||||
|
@ -1,32 +1,29 @@
|
|||||||
# from obitools3.apps.progress cimport ProgressBar # @UnresolvedImport
|
# from obitools3.apps.progress cimport ProgressBar # @UnresolvedImport
|
||||||
# from obitools3.dms.dms import OBIDMS # TODO cimport doesn't work
|
# from obitools3.dms.dms import OBIDMS # TODO cimport doesn't work
|
||||||
# from obitools3.utils cimport bytes2str
|
# from obitools3.utils cimport bytes2str
|
||||||
#
|
#
|
||||||
# import time
|
# import time
|
||||||
# import re
|
# import re
|
||||||
|
#
|
||||||
|
#
|
||||||
def run(config):
|
|
||||||
pass
|
|
||||||
|
|
||||||
# __title__="Export a NUC_SEQS view to a fasta or fastq file"
|
# __title__="Export a NUC_SEQS view to a fasta or fastq file"
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# default_config = { 'inputview' : None,
|
# default_config = { 'inputview' : None,
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
# def addOptions(parser):
|
# def addOptions(parser):
|
||||||
#
|
#
|
||||||
# # TODO put this common group somewhere else but I don't know where
|
# # TODO put this common group somewhere else but I don't know where
|
||||||
# group=parser.add_argument_group('DMS and view options')
|
# group=parser.add_argument_group('DMS and view options')
|
||||||
#
|
#
|
||||||
# group.add_argument('--default-dms','-d',
|
# group.add_argument('--default-dms','-d',
|
||||||
# action="store", dest="obi:defaultdms",
|
# action="store", dest="obi:defaultdms",
|
||||||
# metavar='<DMS NAME>',
|
# metavar='<DMS NAME>',
|
||||||
# default=None,
|
# default=None,
|
||||||
# type=str,
|
# type=str,
|
||||||
# help="Name of the default DMS for reading and writing data.")
|
# help="Name of the default DMS for reading and writing data.")
|
||||||
#
|
#
|
||||||
# group.add_argument('--input-view','-i',
|
# group.add_argument('--input-view','-i',
|
||||||
# action="store", dest="obi:inputview",
|
# action="store", dest="obi:inputview",
|
||||||
# metavar='<INPUT VIEW NAME>',
|
# metavar='<INPUT VIEW NAME>',
|
||||||
@ -34,76 +31,77 @@ def run(config):
|
|||||||
# type=str,
|
# type=str,
|
||||||
# help="Name of the input view, either raw if the view is in the default DMS,"
|
# help="Name of the input view, either raw if the view is in the default DMS,"
|
||||||
# " or in the form 'dms:view' if it is in another DMS.")
|
# " or in the form 'dms:view' if it is in another DMS.")
|
||||||
#
|
#
|
||||||
# group=parser.add_argument_group('obi export specific options')
|
# group=parser.add_argument_group('obi export specific options')
|
||||||
#
|
#
|
||||||
# group.add_argument('--format','-f',
|
# group.add_argument('--format','-f',
|
||||||
# action="store", dest="export:format",
|
# action="store", dest="export:format",
|
||||||
# metavar='<FORMAT>',
|
# metavar='<FORMAT>',
|
||||||
# default="fasta",
|
# default="fasta",
|
||||||
# type=str,
|
# type=str,
|
||||||
# help="Export in the format <FORMAT>, 'fasta' or 'fastq'. Default: 'fasta'.") # TODO export in csv
|
# help="Export in the format <FORMAT>, 'fasta' or 'fastq'. Default: 'fasta'.") # TODO export in csv
|
||||||
#
|
#
|
||||||
# def run(config):
|
def run(config):
|
||||||
#
|
pass
|
||||||
|
#
|
||||||
# # TODO import doesn't work
|
# # TODO import doesn't work
|
||||||
# NUC_SEQUENCE_COLUMN = "NUC_SEQ"
|
# NUC_SEQUENCE_COLUMN = "NUC_SEQ"
|
||||||
# ID_COLUMN = "ID"
|
# ID_COLUMN = "ID"
|
||||||
# DEFINITION_COLUMN = "DEFINITION"
|
# DEFINITION_COLUMN = "DEFINITION"
|
||||||
# QUALITY_COLUMN = "QUALITY"
|
# QUALITY_COLUMN = "QUALITY"
|
||||||
#
|
#
|
||||||
# special_columns = [NUC_SEQUENCE_COLUMN, ID_COLUMN, DEFINITION_COLUMN, QUALITY_COLUMN]
|
# special_columns = [NUC_SEQUENCE_COLUMN, ID_COLUMN, DEFINITION_COLUMN, QUALITY_COLUMN]
|
||||||
#
|
#
|
||||||
# # Open DMS
|
# # Open DMS
|
||||||
# d = OBIDMS(config['obi']['defaultdms'])
|
# d = OBIDMS(config['obi']['defaultdms'])
|
||||||
#
|
#
|
||||||
# # Open input view
|
# # Open input view
|
||||||
# iview = d.open_view(config['obi']['inputview'])
|
# iview = d.open_view(config['obi']['inputview'])
|
||||||
#
|
#
|
||||||
# print(iview.type)
|
# print(iview.type)
|
||||||
#
|
#
|
||||||
# # TODO check that the view has the type NUC_SEQS
|
# # TODO check that the view has the type NUC_SEQS
|
||||||
# if ((config['export']['format'] == "fasta") or (config['export']['format'] == "fastq")) and (iview.type != "NUC_SEQS_VIEW") : # TODO find a way to import those macros
|
# if ((config['export']['format'] == "fasta") or (config['export']['format'] == "fastq")) and (iview.type != "NUC_SEQS_VIEW") : # TODO find a way to import those macros
|
||||||
# raise Exception("Error: the view to export in fasta or fastq format is not a NUC_SEQS view")
|
# raise Exception("Error: the view to export in fasta or fastq format is not a NUC_SEQS view")
|
||||||
#
|
#
|
||||||
# # Initialize the progress bar
|
# # Initialize the progress bar
|
||||||
# pb = ProgressBar(len(iview), config, seconde=5)
|
# pb = ProgressBar(len(iview), config, seconde=5)
|
||||||
#
|
#
|
||||||
# i=0
|
# i=0
|
||||||
# for seq in iview :
|
# for seq in iview :
|
||||||
# pb(i)
|
# pb(i)
|
||||||
#
|
#
|
||||||
# toprint = ">"+seq.id+" "
|
# toprint = ">"+seq.id+" "
|
||||||
#
|
#
|
||||||
# for col_name in seq :
|
# for col_name in seq :
|
||||||
# if col_name not in special_columns :
|
# if col_name not in special_columns :
|
||||||
# toprint = toprint + col_name + "=" + str(seq[col_name]) + "; "
|
# toprint = toprint + col_name + "=" + str(seq[col_name]) + "; "
|
||||||
#
|
#
|
||||||
# if DEFINITION_COLUMN in seq :
|
# if DEFINITION_COLUMN in seq :
|
||||||
# toprint = toprint + seq.definition
|
# toprint = toprint + seq.definition
|
||||||
#
|
#
|
||||||
# nucseq = bytes2str(seq.nuc_seq)
|
# nucseq = bytes2str(seq.nuc_seq)
|
||||||
#
|
#
|
||||||
# if config['export']['format'] == "fasta" :
|
# if config['export']['format'] == "fasta" :
|
||||||
# nucseq = re.sub("(.{60})", "\\1\n", nucseq, 0, re.DOTALL)
|
# nucseq = re.sub("(.{60})", "\\1\n", nucseq, 0, re.DOTALL)
|
||||||
#
|
#
|
||||||
# toprint = toprint + "\n" + nucseq
|
# toprint = toprint + "\n" + nucseq
|
||||||
#
|
#
|
||||||
# if config['export']['format'] == "fastq" :
|
# if config['export']['format'] == "fastq" :
|
||||||
# toprint = toprint + "\n" + "+" + "\n" + seq.get_str_quality()
|
# toprint = toprint + "\n" + "+" + "\n" + seq.get_str_quality()
|
||||||
#
|
#
|
||||||
# print(toprint)
|
# print(toprint)
|
||||||
# i+=1
|
# i+=1
|
||||||
#
|
#
|
||||||
# iview.close()
|
# iview.close()
|
||||||
# d.close()
|
# d.close()
|
||||||
#
|
#
|
||||||
# print("Done.")
|
# print("Done.")
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
@ -20,10 +20,6 @@ from obitools3.dms.capi.obitypes cimport obitype_t, \
|
|||||||
|
|
||||||
from obitools3.dms.capi.obierrno cimport obi_errno
|
from obitools3.dms.capi.obierrno cimport obi_errno
|
||||||
|
|
||||||
import time
|
|
||||||
|
|
||||||
import pickle
|
|
||||||
|
|
||||||
|
|
||||||
__title__="Imports sequences from different formats into a DMS"
|
__title__="Imports sequences from different formats into a DMS"
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ Linked_list_node_p ll_get(Linked_list_node_p head, int idx)
|
|||||||
|
|
||||||
|
|
||||||
// Delete a node
|
// Delete a node
|
||||||
Linked_list_node_p ll_delete(Linked_list_node_p head, int idx) // TODO or with value?
|
Linked_list_node_p ll_delete(Linked_list_node_p head, int idx)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
Linked_list_node_p node = head;
|
Linked_list_node_p node = head;
|
||||||
|
@ -90,7 +90,7 @@ Linked_list_node_p ll_get(Linked_list_node_p head, int idx);
|
|||||||
* @param idx The index of the node to delete.
|
* @param idx The index of the node to delete.
|
||||||
*
|
*
|
||||||
* @returns A pointer on the new head node of the linked list.
|
* @returns A pointer on the new head node of the linked list.
|
||||||
* @retval NULL if an error occurred. // TODO or if list is now empty...
|
* @retval NULL if the list is now empty, or if the node did not exist. // TODO discuss
|
||||||
*
|
*
|
||||||
* @since February 2017
|
* @since February 2017
|
||||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||||
|
@ -154,35 +154,35 @@ static int create_alignment_output_columns(Obiview_p output_view,
|
|||||||
bool normalize, int reference, bool similarity_mode)
|
bool normalize, int reference, bool similarity_mode)
|
||||||
{
|
{
|
||||||
// Create the column for the ids of the 1st sequence aligned
|
// Create the column for the ids of the 1st sequence aligned
|
||||||
if (obi_view_add_column(output_view, ID1_COLUMN_NAME, -1, ID1_COLUMN_NAME, OBI_STR, 0, 1, NULL, id1_indexer_name, NULL, -1, ID1_COLUMN_COMMENTS, true) < 0)
|
if (obi_view_add_column(output_view, ID1_COLUMN_NAME, -1, NULL, OBI_STR, 0, 1, NULL, id1_indexer_name, NULL, -1, ID1_COLUMN_COMMENTS, true) < 0)
|
||||||
{
|
{
|
||||||
obidebug(1, "\nError creating the first column for the sequence ids when aligning");
|
obidebug(1, "\nError creating the first column for the sequence ids when aligning");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the column for the ids of the 2nd sequence aligned
|
// Create the column for the ids of the 2nd sequence aligned
|
||||||
if (obi_view_add_column(output_view, ID2_COLUMN_NAME, -1, ID2_COLUMN_NAME, OBI_STR, 0, 1, NULL, id2_indexer_name, NULL, -1, ID2_COLUMN_COMMENTS, true) < 0)
|
if (obi_view_add_column(output_view, ID2_COLUMN_NAME, -1, NULL, OBI_STR, 0, 1, NULL, id2_indexer_name, NULL, -1, ID2_COLUMN_COMMENTS, true) < 0)
|
||||||
{
|
{
|
||||||
obidebug(1, "\nError creating the second column for the sequence ids when aligning");
|
obidebug(1, "\nError creating the second column for the sequence ids when aligning");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the column for the index (in the input view) of the first sequences aligned
|
// Create the column for the index (in the input view) of the first sequences aligned
|
||||||
if (obi_view_add_column(output_view, IDX1_COLUMN_NAME, -1, IDX1_COLUMN_NAME, OBI_INT, 0, 1, NULL, NULL, NULL, -1, IDX1_COLUMN_COMMENTS, true) < 0)
|
if (obi_view_add_column(output_view, IDX1_COLUMN_NAME, -1, NULL, OBI_INT, 0, 1, NULL, NULL, NULL, -1, IDX1_COLUMN_COMMENTS, true) < 0)
|
||||||
{
|
{
|
||||||
obidebug(1, "\nError creating the first column for the sequence indices when aligning");
|
obidebug(1, "\nError creating the first column for the sequence indices when aligning");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the column for the index (in the input view) of the second sequences aligned
|
// Create the column for the index (in the input view) of the second sequences aligned
|
||||||
if (obi_view_add_column(output_view, IDX2_COLUMN_NAME, -1, IDX2_COLUMN_NAME, OBI_INT, 0, 1, NULL, NULL, NULL, -1, IDX2_COLUMN_COMMENTS, true) < 0)
|
if (obi_view_add_column(output_view, IDX2_COLUMN_NAME, -1, NULL, OBI_INT, 0, 1, NULL, NULL, NULL, -1, IDX2_COLUMN_COMMENTS, true) < 0)
|
||||||
{
|
{
|
||||||
obidebug(1, "\nError creating the second column for the sequence indices when aligning");
|
obidebug(1, "\nError creating the second column for the sequence indices when aligning");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the column for the LCS length
|
// Create the column for the LCS length
|
||||||
if (obi_view_add_column(output_view, LCS_LENGTH_COLUMN_NAME, -1, LCS_LENGTH_COLUMN_NAME, OBI_INT, 0, 1, NULL, NULL, NULL, -1, LCS_LENGTH_COLUMN_COMMENTS, true) < 0)
|
if (obi_view_add_column(output_view, LCS_LENGTH_COLUMN_NAME, -1, NULL, OBI_INT, 0, 1, NULL, NULL, NULL, -1, LCS_LENGTH_COLUMN_COMMENTS, true) < 0)
|
||||||
{
|
{
|
||||||
obidebug(1, "\nError creating the column for the LCS length when aligning");
|
obidebug(1, "\nError creating the column for the LCS length when aligning");
|
||||||
return -1;
|
return -1;
|
||||||
@ -191,7 +191,7 @@ static int create_alignment_output_columns(Obiview_p output_view,
|
|||||||
// Create the column for the alignment length if it is computed
|
// Create the column for the alignment length if it is computed
|
||||||
if ((reference == ALILEN) && (normalize || !similarity_mode))
|
if ((reference == ALILEN) && (normalize || !similarity_mode))
|
||||||
{
|
{
|
||||||
if (obi_view_add_column(output_view, ALI_LENGTH_COLUMN_NAME, -1, ALI_LENGTH_COLUMN_NAME, OBI_INT, 0, 1, NULL, NULL, NULL, -1, ALI_LENGTH_COLUMN_COMMENTS, true) < 0)
|
if (obi_view_add_column(output_view, ALI_LENGTH_COLUMN_NAME, -1, NULL, OBI_INT, 0, 1, NULL, NULL, NULL, -1, ALI_LENGTH_COLUMN_COMMENTS, true) < 0)
|
||||||
{
|
{
|
||||||
obidebug(1, "\nError creating the column for the alignment length when aligning");
|
obidebug(1, "\nError creating the column for the alignment length when aligning");
|
||||||
return -1;
|
return -1;
|
||||||
@ -200,7 +200,7 @@ static int create_alignment_output_columns(Obiview_p output_view,
|
|||||||
// Create the column for the alignment score
|
// Create the column for the alignment score
|
||||||
if (normalize)
|
if (normalize)
|
||||||
{
|
{
|
||||||
if (obi_view_add_column(output_view, SCORE_COLUMN_NAME, -1, SCORE_COLUMN_NAME, OBI_FLOAT, 0, 1, NULL, NULL, NULL, -1, SCORE_COLUMN_NAME, true) < 0)
|
if (obi_view_add_column(output_view, SCORE_COLUMN_NAME, -1, NULL, OBI_FLOAT, 0, 1, NULL, NULL, NULL, -1, SCORE_COLUMN_NAME, true) < 0)
|
||||||
{
|
{
|
||||||
obidebug(1, "\nError creating the column for the score when aligning");
|
obidebug(1, "\nError creating the column for the score when aligning");
|
||||||
return -1;
|
return -1;
|
||||||
@ -208,7 +208,7 @@ static int create_alignment_output_columns(Obiview_p output_view,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (obi_view_add_column(output_view, SCORE_COLUMN_NAME, -1, SCORE_COLUMN_NAME, OBI_INT, 0, 1, NULL, NULL, NULL, -1, SCORE_COLUMN_NAME, true) < 0)
|
if (obi_view_add_column(output_view, SCORE_COLUMN_NAME, -1, NULL, OBI_INT, 0, 1, NULL, NULL, NULL, -1, SCORE_COLUMN_NAME, true) < 0)
|
||||||
{
|
{
|
||||||
obidebug(1, "\nError creating the column for the score when aligning");
|
obidebug(1, "\nError creating the column for the score when aligning");
|
||||||
return -1;
|
return -1;
|
||||||
@ -218,14 +218,14 @@ static int create_alignment_output_columns(Obiview_p output_view,
|
|||||||
if (print_seq)
|
if (print_seq)
|
||||||
{
|
{
|
||||||
// Create the column for the first sequences aligned
|
// Create the column for the first sequences aligned
|
||||||
if (obi_view_add_column(output_view, SEQ1_COLUMN_NAME, -1, SEQ1_COLUMN_NAME, OBI_SEQ, 0, 1, NULL, seq1_indexer_name, NULL, -1, SEQ1_COLUMN_COMMENTS, true) < 0)
|
if (obi_view_add_column(output_view, SEQ1_COLUMN_NAME, -1, NULL, OBI_SEQ, 0, 1, NULL, seq1_indexer_name, NULL, -1, SEQ1_COLUMN_COMMENTS, true) < 0)
|
||||||
{
|
{
|
||||||
obidebug(1, "\nError creating the first column for the sequences when aligning");
|
obidebug(1, "\nError creating the first column for the sequences when aligning");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the column for the second sequences aligned
|
// Create the column for the second sequences aligned
|
||||||
if (obi_view_add_column(output_view, SEQ2_COLUMN_NAME, -1, SEQ2_COLUMN_NAME, OBI_SEQ, 0, 1, NULL, seq2_indexer_name, NULL, -1, SEQ2_COLUMN_COMMENTS, true) < 0)
|
if (obi_view_add_column(output_view, SEQ2_COLUMN_NAME, -1, NULL, OBI_SEQ, 0, 1, NULL, seq2_indexer_name, NULL, -1, SEQ2_COLUMN_COMMENTS, true) < 0)
|
||||||
{
|
{
|
||||||
obidebug(1, "\nError creating the second column for the sequences when aligning");
|
obidebug(1, "\nError creating the second column for the sequences when aligning");
|
||||||
return -1;
|
return -1;
|
||||||
@ -234,14 +234,14 @@ static int create_alignment_output_columns(Obiview_p output_view,
|
|||||||
// if (print_count) // TODO count columns not implemented yet
|
// if (print_count) // TODO count columns not implemented yet
|
||||||
// {
|
// {
|
||||||
// // Create the column for the count of the first sequences aligned
|
// // Create the column for the count of the first sequences aligned
|
||||||
// if (obi_view_add_column(output_view, COUNT1_COLUMN_NAME, -1, COUNT1_COLUMN_NAME, OBI_INT, 0, 1, NULL, NULL, NULL, -1, COUNT1_COLUMN_COMMENTS, true) < 0)
|
// if (obi_view_add_column(output_view, COUNT1_COLUMN_NAME, -1, NULL, OBI_INT, 0, 1, NULL, NULL, NULL, -1, COUNT1_COLUMN_COMMENTS, true) < 0)
|
||||||
// {
|
// {
|
||||||
// obidebug(1, "\nError creating the first column for the sequence counts when aligning");
|
// obidebug(1, "\nError creating the first column for the sequence counts when aligning");
|
||||||
// return -1;
|
// return -1;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// // Create the column for the count of the second sequences aligned
|
// // Create the column for the count of the second sequences aligned
|
||||||
// if (obi_view_add_column(output_view, COUNT2_COLUMN_NAME, -1, COUNT2_COLUMN_NAME, OBI_INT, 0, 1, NULL, NULL, NULL, -1, COUNT2_COLUMN_COMMENTS, true) < 0)
|
// if (obi_view_add_column(output_view, COUNT2_COLUMN_NAME, -1, NULL, OBI_INT, 0, 1, NULL, NULL, NULL, -1, COUNT2_COLUMN_COMMENTS, true) < 0)
|
||||||
// {
|
// {
|
||||||
// obidebug(1, "\nError creating the second column for the sequence counts when aligning");
|
// obidebug(1, "\nError creating the second column for the sequence counts when aligning");
|
||||||
// return -1;
|
// return -1;
|
||||||
|
Reference in New Issue
Block a user