Commit 9f55ce5b authored by Jerome Mariette's avatar Jerome Mariette

add run from cmd line

parent 76264a83
......@@ -17,6 +17,7 @@
import sys
import argparse
import datetime
try:
import _preamble
......@@ -26,6 +27,7 @@ except ImportError:
from jflow.workflows_manager import WorkflowsManager
from jflow.workflow import Workflow
from ng6.project import Project
from ng6.run import Run
if __name__ == '__main__':
......@@ -39,10 +41,30 @@ if __name__ == '__main__':
sub_parser.add_argument("--name", type=str, help="Give a name to your project (has to be unique)",
required=True, dest="project_name", metavar="STR")
sub_parser.add_argument("--description", type=str, help="Give a description to your project",
required=True, dest="description", metavar="STR")
required=True, dest="project_description", metavar="STR")
sub_parser.add_argument("--admin-login", type=str, help="Who is the project administrator",
required=True, dest="admin_login", metavar="STR")
sub_parser.set_defaults(cmd_object="addproject")
# Add run menu
sub_parser = subparsers.add_parser("addrun", help="Add a brand new run to a project")
sub_parser.add_argument("--project-id", type=str, help="The project id the run belongs to",
required=True, dest="project_id", metavar="STR")
sub_parser.add_argument("--name", type=str, help="Give a name to your run",
required=True, dest="run_name", metavar="STR")
sub_parser.add_argument("--description", type=str, help="Give a description to your run",
required=True, dest="run_description", metavar="STR")
sub_parser.add_argument("--date", type=str, help="When were the data produced",
required=True, dest="run_date", metavar="STR")
sub_parser.add_argument("--data-nature", type=str, help="Sequences are cDNA, genomique, RNA, ...",
required=True, dest="data_nature", metavar="STR")
sub_parser.add_argument("--sequencer", type=str, help="Which sequencer produced the data",
required=True, choices=Run.SEQUENCERS, dest="sequencer", metavar="STR")
sub_parser.add_argument("--species", type=str, help="Which species was sequenced",
required=True, dest="species", metavar="STR")
sub_parser.add_argument("--type", type=str, help="What type of data is it (1 lane, 1 region)",
required=True, dest="type", metavar="STR")
sub_parser.set_defaults(cmd_object="addrun")
# Add available pipelines
wf_instances = WorkflowsManager.get_workflows()
......@@ -62,7 +84,19 @@ if __name__ == '__main__':
#except (IOError, NameError), e:
# sys.exit("Error: " + str(e))
elif args["cmd_object"] == "addproject":
#try:
my_project = Project(args["project_name"], args["description"], args["admin_login"])
#except NameError, e:
# sys.exit("Error: " + str(e))
try:
my_project = Project(args["project_name"], args["project_description"], args["admin_login"])
except NameError, e:
sys.exit("Error: " + str(e))
elif args["cmd_object"] == "addrun":
try:
# Build the project and the run
my_project = Project.get_from_id(args["project_id"])
run_date = args["run_date"].split("/")
my_run = Run(args["run_name"], datetime.date(int(run_date[2]), int(run_date[1]), int(run_date[0])),
args["species"], args["data_nature"], args["type"], args["run_description"], args["sequencer"])
# Then add the run to the project
my_project.add_run(my_run)
except NameError, e:
sys.exit("Error: " + str(e))
\ No newline at end of file
......@@ -28,10 +28,10 @@ from subprocess import call
from shutil import copyfile, rmtree
from ConfigParser import ConfigParser, RawConfigParser
from ng6.Run import Run
from ng6.run import Run
from ng6.config_reader import NG6ConfigReader
from ng6.t3MySQLdb import t3MySQLdb
from ng6.Utils import Utils
from ng6.utils import Utils
class Analyse (object):
......
#
# Copyright (C) 2009 INRA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__author__ = 'Plateforme bioinformatique Midi Pyrenees'
__copyright__ = 'Copyright (C) 2009 INRA'
__license__ = 'GNU General Public License'
__version__ = '1.0'
__email__ = 'support.genopole@toulouse.inra.fr'
__status__ = 'beta'
import os
from ConfigParser import ConfigParser
from Utils import *
from utils import *
class NG6ConfigReader(object):
"""
......
......@@ -26,8 +26,8 @@ import logging, tempfile
from ConfigParser import ConfigParser, RawConfigParser
from ng6.t3MySQLdb import t3MySQLdb
from ng6.Run import Run
from ng6.Analyse import Analyse
from ng6.run import Run
from ng6.analyse import Analyse
class Project(object):
......
......@@ -30,8 +30,8 @@ from ConfigParser import ConfigParser, RawConfigParser
from ng6.t3MySQLdb import t3MySQLdb
from ng6.config_reader import NG6ConfigReader
from ng6.Utils import Utils
from ng6.Exceptions import UnsavedRunError
from ng6.utils import Utils
from ng6.exceptions import UnsavedRunError
class Run(object):
......@@ -41,7 +41,8 @@ class Run(object):
# The directories structure into ng6
DIRECTORIES_STRUCTURE = "/data/run/"
SEQUENCERS = ["454", "454 GS FLX Titanium", "454 GS FLX+", "454 GS FLX XL+", "HiSeq 2000", "MiSeq"]
def __init__(self, name, date, species, data_nature, type, description, sequencer, id = None):
"""
Build a Run object
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment