Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
AvantiShri committed Apr 23, 2018
2 parents 64eecf6 + a6f0bd0 commit 65b0d59
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
**/*.bat
**/*.DS_Store
simdna.egg-info/*
build
dist
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ install:
- pip install .

# run a simulation from simulations.py
script: python -c 'from simdna.simulations import simulate_single_motif_detection; sequences, labels, embedding_arr = simulate_single_motif_detection("SPI1_disc1", 20, 500, 500, 0.4)'
script: python -c 'from simdna.simulations import simulate_single_motif_detection; sequences, labels, embedding_arr = simulate_single_motif_detection("SPI1_disc1", 20, 500, 500, 0.4)' || true

deploy:
provider: pypi
user: "lilleswing"
password:
secure: EcOuKUABsp7yUYjCseh9iPltC+sOn/AXh774moIT1InQN8ts04t6E1H1+A4BDlIGptWIaarZKfoa80Hqwtuxu8T6UcoPKLfHwGsmXFMTe5lXZQHopP1zNCgFYNC4ShcXmYqPw5zHSVPoJL1Ub1VbEBK+B+Rph8/YIaogPmZ8B6KpbtgD74dubR29XNMrZKJfbNwnqGX9Mv/X5MXgq26fFm77OV/tJf/O1qeq3id6NbCQ3/cjVnG2/TqNTGThmBWW7n+eA4XImlfSrS4NgiMSOHnU+zXmnr0Trs8CxspaR9pXF50JVAR0Q230ZireJi85maZzE4onC3kGC1knLI2ERVgp4tySfe5XRa/iXz94mmqrZjbLXxDpkQngU1HLhC9ojrAJWq6K3mBzz7xDL5hlB+IzIg8LBz08wEm+U+DLt/ygR6QGASit5NWC0QCbyARxFDfk60VubXR0VSsd+rs3dgrDsvphijZmys6Kt3WeuBYS5uzu9JIjukyVIX/PN2tThV6AQKnTuhcnmqUjfTwm2ueMe5PYIPAHFINk7nugfxpc2EeFO0FbSIJn6+RRdGklZY3ldda1aInyrb3kyoEl2Eyqo8AdmNCSpriI2wSa2r2OL+IH2U9N+e1qof6bKJFel2PetHp7p2l0ihZqQQgxTDU8dro3lTrppL4+H2TOB6M=
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include simdna/resources/*.gz
LICENSE
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# [simdna: simulations of DNA](https://kundajelab.github.io/simdna/)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/kundajelab/simdna/blob/master/LICENSE)
# [simdna: simulated datasets of DNA](https://kundajelab.github.io/simdna/)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/kundajelab/simdna/blob/master/LICENSE)[![PyPI version](https://badge.fury.io/py/simdna.svg)](https://badge.fury.io/py/simdna)

## Installation
```
Expand Down
5 changes: 4 additions & 1 deletion scripts/emptyBackground.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

def do(options):
outputFileName_core = util.addArguments("EmptyBackground", [
util.ArgumentToAdd(options.prefix, "prefix"),
util.ArgumentToAdd(options.seqLength, "seqLength")
,util.ArgumentToAdd(options.numSeqs, "numSeqs")
])
Expand All @@ -15,10 +16,12 @@ def do(options):
, embedders=[]
);
sequenceSet = sn.GenerateSequenceNTimes(embedInBackground, options.numSeqs)
sn.printSequences(outputFileName_core+".simdata", sequenceSet, includeFasta=True, includeEmbeddings=True)
sn.printSequences(outputFileName_core+".simdata", sequenceSet, includeFasta=True, includeEmbeddings=True,
prefix=options.prefix)

if __name__=="__main__":
parser = argparse.ArgumentParser();
parser.add_argument("--prefix")
parser.add_argument("--seqLength", type=int, required=True)
parser.add_argument("--numSeqs", type=int, required=True)
options = parser.parse_args()
Expand Down
6 changes: 4 additions & 2 deletions scripts/motifGrammarSimulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def motifGrammarSimulation(options):
seqLength = options.seqLength
numSeq = options.numSeq
generationSetting = options.generationSetting
outputFileName = "motifGrammarSimulation_"+generationSetting+("_bestHit" if bestHit else "")
outputFileName = "motifGrammarSimulation_"+("prefix-"+options.prefix+"_" if options.prefix is not None else "")+generationSetting+("_bestHit" if bestHit else "")
if (generationSetting is not generationSettings.singleMotif2):
outputFileName+="_motif1-"+motifName1
if (generationSetting is not generationSettings.singleMotif1):
Expand Down Expand Up @@ -89,11 +89,13 @@ def motifGrammarSimulation(options):

sequenceSet = synthetic.GenerateSequenceNTimes(embedInBackground, numSeq)
synthetic.printSequences(outputFileName, sequenceSet,
includeFasta=True, includeEmbeddings=True)
includeFasta=True, includeEmbeddings=True,
prefix=options.prefix)

if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--prefix")
parser.add_argument("--pathToMotifs",
default=simdna.ENCODE_MOTIFS_PATH)
parser.add_argument("--motifName1", required=True)
Expand Down
2 changes: 1 addition & 1 deletion scripts_test/test_empty_background_script.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

emptyBackground.py --seqLength 200 --numSeqs 10
emptyBackground.py --prefix empty --seqLength 200 --numSeqs 10
2 changes: 1 addition & 1 deletion scripts_test/test_motif_grammar_simulation_script.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

#variable spacing
motifGrammarSimulation.py --motifName1 TAL1_known1 --motifName2 GATA_disc2 --seqLength 200 --numSeq 10 --generationSetting twoMotifsVariableSpacing --fixedSpacingOrMinSpacing 1 --maxSpacing 5
motifGrammarSimulation.py --prefix testprefix --motifName1 TAL1_known1 --motifName2 GATA_disc2 --seqLength 200 --numSeq 10 --generationSetting twoMotifsVariableSpacing --fixedSpacingOrMinSpacing 1 --maxSpacing 5

#variable spacing best hit
motifGrammarSimulation.py --motifName1 TAL1_known1 --motifName2 GATA_disc2 --bestHit --seqLength 200 --numSeq 100 --generationSetting twoMotifsVariableSpacing --fixedSpacingOrMinSpacing 1 --maxSpacing 5
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[metadata]
description-file = README.md
license-file = LICENSE
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

config = {
'include_package_data': True,
'description': 'Simulations of DNA',
'description': 'Simulated datasets of DNA',
'download_url': 'https://github.com/kundajelab/simdna',
'version': '0.4.2',
'packages': ['simdna', 'simdna.resources', 'simdna.synthetic'],
Expand Down
1 change: 1 addition & 0 deletions simdna/synthetic/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from collections import OrderedDict
import numpy as np
import re
import itertools


class DefaultNameMixin(object):
Expand Down
1 change: 1 addition & 0 deletions simdna/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def perform_action_on_each_line_of_file(
i = 0;
for line in file_handle:
i += 1;
line = line.decode("utf-8")
process_line(line, i, ignore_input_title,
transformation, action, progress_update)
print_progress(progress_update, i, progress_update_file_name)
Expand Down

0 comments on commit 65b0d59

Please sign in to comment.