Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #3

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
=========
CHANGELOG
=========

Version 0.1.0
-------------
* Created module to sync samples from a MiSeq SampleSheet
* Created module (autosync.py) to poll and detect finished runs
Empty file added miseqpipeline/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions miseqpipeline/miseq_sync.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@


def sync(src, ngsdata):
pass
85 changes: 85 additions & 0 deletions redmine.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Redmine runs tests on own continuous integration server.
# http://www.redmine.org/projects/redmine/wiki/Continuous_integration
# You can also run tests on your environment.
language: ruby
rvm:
- 1.9.3
- 2.0
- 2.1
- 2.2
- jruby
env:
- "SUITE=units DB=postgresql"
- "SUITE=functionals DB=postgresql"
- "SUITE=integration DB=postgresql"
- "SUITE=ui DB=postgresql"
- "SUITE=units DB=mysql-5.5"
- "SUITE=functionals DB=mysql-5.5"
- "SUITE=integration DB=mysql-5.5"
- "SUITE=ui DB=mysql-5.5"
- "SUITE=units DB=mysql-5.6"
- "SUITE=functionals DB=mysql-5.6"
- "SUITE=integration DB=mysql-5.6"
- "SUITE=ui DB=mysql-5.6"
- "SUITE=units DB=mysql-5.7-dmr"
- "SUITE=functionals DB=mysql-5.7-dmr"
- "SUITE=integration DB=mysql-5.7-dmr"
- "SUITE=ui DB=mysql-5.7-dmr"
- "SUITE=units DB=mariadb-5.5"
- "SUITE=functionals DB=mariadb-5.5"
- "SUITE=integration DB=mariadb-5.5"
- "SUITE=ui DB=mariadb-5.5"
- "SUITE=units DB=mariadb-10.0"
- "SUITE=functionals DB=mariadb-10.0"
- "SUITE=integration DB=mariadb-10.0"
- "SUITE=ui DB=mariadb-10.0"
- "SUITE=units DB=sqlite3"
- "SUITE=functionals DB=sqlite3"
- "SUITE=integration DB=sqlite3"
- "SUITE=ui DB=sqlite3"
matrix:
allow_failures:
# SCM tests fail randomly due to IO.popen().
# http://www.redmine.org/issues/19091
# https://github.com/jruby/jruby/issues/779
- rvm: jruby
# http://www.redmine.org/issues/17460
# http://www.redmine.org/issues/19344
- env: "SUITE=units DB=mysql-5.6"
- env: "SUITE=units DB=mysql-5.7-dmr"
- env: "SUITE=units DB=mariadb-5.5"
- env: "SUITE=units DB=mariadb-10.0"
before_install:
- "sudo apt-get update -qq"
- "sudo apt-get --no-install-recommends install bzr cvs git mercurial subversion"
- if [[ $DB =~ (mariadb|mysql-5\.[67]) ]] ;
then
sudo service mysql stop ;
sudo apt-get install python-software-properties ;
if [[ $DB =~ mariadb ]] ;
then
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db ;
MARIADB_VER=`echo $DB | sed -e 's/mariadb-//'` ;
sudo add-apt-repository ''"deb http://ftp.osuosl.org/pub/mariadb/repo/${MARIADB_VER}/ubuntu precise main"'' ;
sudo apt-get update ;
sudo DEBIAN_FRONTEND=noninteractive apt-get -q --yes --force-yes -f --option DPkg::Options::=--force-confnew install mariadb-server ;
sudo apt-get install libmariadbd-dev ;
else
echo mysql-apt-config mysql-apt-config/enable-repo select $DB | sudo debconf-set-selections ;
wget http://dev.mysql.com/get/mysql-apt-config_0.2.1-1ubuntu12.04_all.deb ;
sudo dpkg --install mysql-apt-config_0.2.1-1ubuntu12.04_all.deb ;
sudo apt-get update -q ;
sudo apt-get install -q -y -o Dpkg::Options::=--force-confnew mysql-server ;
fi
fi
script:
- export DATABASE_ADAPTER=${DB}
- "SCMS=bazaar,cvs,subversion,git,mercurial,filesystem"
- "export SCMS"
- "git --version"
- "bundle install"
- "RUN_ON_NOT_OFFICIAL='' RUBY_VER=1.9 BRANCH=trunk bundle exec rake config/database.yml"
- "bundle install"
- "bundle exec rake ci:setup"
- phantomjs --webdriver 4444 &
- JRUBY_OPTS=-J-Xmx1024m bundle exec rake test:${SUITE}
48 changes: 48 additions & 0 deletions redsample.config.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# web url to your redmine instance
siteurl: http://demo.redmine.org
# Your api key located under My Account
apikey: fromyouraccount
# The id of the project that will contain your samples
sampleprojectid: RedsampleTest
# The id of the tracker that will be assigned to your samples
# has to be the id not the name
sampletrackerid: 1

#If there isn't an API Key use these instead
username: averagehat
password: vdbwrair

runtrackerid: 3
runprojectid: RedSampleRun
runnameid: 4

destinationpath: /home/EIDRUdata/NGSData
runbasepath: /Instruments/MiSeq

samplefields:
- Needs Review
- Pathogen
- SRNum
- CollectionLocation
- Collaborator
- Collection Date
- Sample Type
- Accession
- Genbank Ready
- PR Name
- Synced Date
- Media
- Received
- Study
- InfA Ct
- InfB Ct
- RNaseP Ct
- swInfA Ct
- swH1 Ct
- AH3 Ct
# Currently ignored
runfields:
- Platform
- Run Name
- SampleList
- SamplesSynced
33 changes: 32 additions & 1 deletion redsample.config.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,35 @@ apikey: fromyouraccount
sampleprojectid: samples
# The id of the tracker that will be assigned to your samples
# has to be the id not the name
sampletrackerid: 1
sampletrackerid: 1
# for automatically creating the runs:
runtrackerid: 3
runprojectid: 4

samplefields:
- Needs Review
- Pathogen
- SRNum
- CollectionLocation
- Collaborator
- Collection Date
- Sample Type
- Accession
- Genbank Ready
- PR Name
- Synced Date
- Media
- Received
- Study
- InfA Ct
- InfB Ct
- RNaseP Ct
- swInfA Ct
- swH1 Ct
- AH3 Ct
# Currently ignored
runfields:
- Platform
- Run Name
- SampleList
- SamplesSynced
9 changes: 9 additions & 0 deletions redsample.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# web url to your redmine instance
siteurl: https://www.example.com
# Your api key located under My Account
apikey: fromyouraccount
# The id of the project that will contain your samples
sampleprojectid: samples
# The id of the tracker that will be assigned to your samples
# has to be the id not the name
sampletrackerid: 1
45 changes: 45 additions & 0 deletions redsample/autosync.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from __future__ import print_function
import time
from miseqpipeline import miseq_sync
from functools import partial
import os
import sys
from outline import get_run_name, get_my_new_runs, update_percent_done, config, compose
'''
Get run name from issue
import and run miseq_sync
skip resample step
skip rename step
update run issue
'''

MAKE_RUN_PATH = partial(os.path.join, config['runbasepath'])
_sync = partial(miseq_sync.sync, ngsdata=config['destinationpath'])
copy_samples = compose(_sync, MAKE_RUN_PATH)
copy_runs_samples = compose(copy_samples, get_run_name)

def poll():
''' Look for new run_issues assigned to "me" as defined in config file.'''
#TODO: use a custom field techs won't use instead of progress bar.
new_runs = get_my_new_runs()
if not new_runs:
print("run issues not found at time: {0}".format(time.ctime()))
sys.exit(0)
else:
print("New run issues found at time: {0}, {1}".format(time.ctime(), new_runs))
return new_runs

def start():
''' Poll for assigned issues, and miseq_sync them if found.'''
run_issues = poll()
assert len(run_issues) == 1, "More than one new run found, something went wrong."
mark_as_started = partial(update_percent_done, value=50)
map(mark_as_started, run_issues)
#pool.map
map(copy_runs_samples, run_issues)
mark_as_finished = partial(update_percent_done, value=100)
map(mark_as_finished, run_issues)
return run_issues

def main():
start()
7 changes: 6 additions & 1 deletion redsample/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os.path
import yaml

DEFAULT_PATH = './redsample.config.default'
def load_config(configpath):
'''
Load yaml config from a path
Expand All @@ -13,8 +14,12 @@ def load_config(configpath):
def load_user_config():
'''
Loads config from user home directory

:return: yaml dict
'''
p = os.path.join(os.path.expanduser('~/'), '.redsample.config')
return load_config(p)

def load_default():
return load_user_config() or load_config(DEFAULT_PATH)

Loading