Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mrdna
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tbgl
tools
mrdna
Commits
4c1a3d1c
Commit
4c1a3d1c
authored
6 years ago
by
cmaffeo2
Browse files
Options
Downloads
Patches
Plain Diff
Added configuration file, reporting function and version to mrdna package
parent
87a37618
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
mrdna/__init__.py
+6
-0
6 additions, 0 deletions
mrdna/__init__.py
mrdna/config.py
+54
-0
54 additions, 0 deletions
mrdna/config.py
mrdna/reporting.py
+22
-0
22 additions, 0 deletions
mrdna/reporting.py
with
82 additions
and
0 deletions
mrdna/__init__.py
+
6
−
0
View file @
4c1a3d1c
import
os
__version__
=
"
0.1.dev0
"
_RESOURCE_DIR
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
resources
'
)
def
get_resource_path
(
relative_path
):
return
os
.
path
.
join
(
_RESOURCE_DIR
,
relative_path
)
from
.segmentmodel
import
SegmentModel
,
SingleStrandedSegment
,
DoubleStrandedSegment
from
.simulate
import
multiresolution_simulation
from
.reporting
import
report
report
(
"
mrdna.__init__
"
)
This diff is collapsed.
Click to expand it.
mrdna/config.py
0 → 100644
+
54
−
0
View file @
4c1a3d1c
from
pathlib
import
Path
import
appdirs
import
json
_urlbase
=
"
bionano.physics.illinois.edu
"
"""
Get configuration file for mrdna
"""
_USER_CONF_DIR
=
Path
(
appdirs
.
user_data_dir
())
_USER_CONF_DIR
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
_USER_CONF
=
_USER_CONF_DIR
/
"
mrdna.conf
"
if
_USER_CONF
.
exists
():
with
open
(
_USER_CONF
)
as
ch
:
config
=
json
.
load
(
ch
)
else
:
config
=
{}
print
(
"""
Thanks for using the multi-resolution DNA modeling package mrdna!
PRIVACY STATEMENT AND USER AGREEMENT:
We respect your privacy. We will never collect or share your
information without your explicit permission.
At the same time, we would like to collect anonymous statistics about
the use of the mrdna Python package for reporting to funding agencies
so we can continue to develop and improve these utilities.
For this, we ask for your permission to have the mrdna utility send
your IP address along with information about what part of the mrdna
utility you are using (e.g. cadnano reader, vHelix reader, mrdna
script) to our webserver where it will be stored in a database, along
with geolocation data and a timestamp. Except for your IP adress, no
personally identifiable information will be stored. You are not
required to opt-in to use the mrdna package!
If you have concerns regarding your privacy, please contact the
Aksimentiev group and we will get back to you as soon as we can.
mailto:cmaffeo2@illinois.edu
"""
)
while
True
:
print
(
"""
Do you agree to allow the mrdna package can send the information
described above to the Aksimentiev group webserver? [y/N]
"""
)
response
=
input
()
if
response
in
'
y Y yes Yes YES
'
.
split
():
print
(
"
Permission granted
"
)
config
[
'
reporting_allowed
'
]
=
True
break
elif
response
in
'
n N no No NO
'
.
split
()
+
[
""
]:
print
(
"
Permission denied
"
)
config
[
'
reporting_allowed
'
]
=
False
break
with
open
(
_USER_CONF
,
'
w
'
)
as
ch
:
json
.
dump
(
config
,
ch
)
This diff is collapsed.
Click to expand it.
mrdna/reporting.py
0 → 100644
+
22
−
0
View file @
4c1a3d1c
import
mrdna
import
appdirs
from
.config
import
config
def
report
(
data
):
if
not
config
[
'
reporting_allowed
'
]:
return
try
:
import
requests
import
concurrent.futures
import
urllib.parse
def
send_url
(
data
):
version
=
urllib
.
parse
.
quote_plus
(
mrdna
.
__version__
)
data
=
urllib
.
parse
.
quote_plus
(
data
)
requests
.
get
(
url
=
"
http://bionano.physics.illinois.edu/mrdna-report/{}/{}
"
.
format
(
version
,
data
))
with
concurrent
.
futures
.
ThreadPoolExecutor
(
max_workers
=
2
)
as
executor
:
executor
.
submit
(
send_url
,
data
)
except
:
pass
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment