Skip to content

Commit e799e40

Browse files
committed
some unit tests pass in py3 (all still pass in py2)
1 parent 9b21ce1 commit e799e40

23 files changed

Lines changed: 1446 additions & 1416 deletions

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
language: python
22
python:
33
- "2.7"
4+
- "3.5"
45
install: "cd src && python setup.py install && cd .."
56
script: ./runtests.sh

doc/_update_doc/conf.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
master_doc = 'index'
4141

4242
# General information about the project.
43-
project = u'BaseSpacePy'
44-
copyright = u'2014, Illumina'
43+
project = 'BaseSpacePy'
44+
copyright = '2014, Illumina'
4545

4646
# The version info for the project you're documenting, acts as replacement for
4747
# |version| and |release|, also used in various other places throughout the
@@ -183,8 +183,8 @@
183183
# Grouping the document tree into LaTeX files. List of tuples
184184
# (source start file, target name, title, author, documentclass [howto/manual]).
185185
latex_documents = [
186-
('index', 'BaseSpacePy.tex', u'BaseSpacePy Documentation',
187-
u'Illumina', 'manual'),
186+
('index', 'BaseSpacePy.tex', 'BaseSpacePy Documentation',
187+
'Illumina', 'manual'),
188188
]
189189

190190
# The name of an image file (relative to this directory) to place at the top of
@@ -213,8 +213,8 @@
213213
# One entry per manual page. List of tuples
214214
# (source start file, name, description, authors, manual section).
215215
man_pages = [
216-
('index', 'basespacepy', u'BaseSpacePy Documentation',
217-
[u'Illumina'], 1)
216+
('index', 'basespacepy', 'BaseSpacePy Documentation',
217+
['Illumina'], 1)
218218
]
219219

220220
# If true, show URL addresses after external links.
@@ -227,8 +227,8 @@
227227
# (source start file, target name, title, author,
228228
# dir menu entry, description, category)
229229
texinfo_documents = [
230-
('index', 'BaseSpacePy', u'BaseSpacePy Documentation',
231-
u'Illumina', 'BaseSpacePy', 'One line description of project.',
230+
('index', 'BaseSpacePy', 'BaseSpacePy Documentation',
231+
'Illumina', 'BaseSpacePy', 'One line description of project.',
232232
'Miscellaneous'),
233233
]
234234

examples/0_Browsing.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
you may not use this file except in compliance with the License.
66
You may obtain a copy of the License at
77
http://www.apache.org/licenses/LICENSE-2.0
8-
8+
99
Unless required by applicable law or agreed to in writing, software
1010
distributed under the License is distributed on an "AS IS" BASIS,
1111
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -14,11 +14,11 @@
1414
"""
1515

1616
from BaseSpacePy.api.BaseSpaceAPI import BaseSpaceAPI
17-
import os
17+
import os
1818

1919
"""
2020
This script demonstrates basic browsing of BaseSpace objects once an access-token
21-
for global browsing has been obtained.
21+
for global browsing has been obtained.
2222
"""
2323

2424
"""
@@ -30,8 +30,8 @@
3030
[DEFAULT]
3131
name = my new app
3232
clientKey =
33-
clientSecret =
34-
accessToken =
33+
clientSecret =
34+
accessToken =
3535
appSessionId =
3636
apiServer = https://api.cloud-hoth.illumina.com/
3737
apiVersion = v1pre3
@@ -49,35 +49,35 @@
4949
myAPI = BaseSpaceAPI(clientKey, clientSecret, apiServer, apiVersion, appSessionId)
5050
else:
5151
myAPI = BaseSpaceAPI(profile='DEFAULT')
52-
52+
5353
# First, let's grab the genome with id=4
5454
myGenome = myAPI.getGenomeById('4')
55-
print "\nThe Genome is " + str(myGenome)
56-
print "We can get more information from the genome object"
57-
print 'Id: ' + myGenome.Id
58-
print 'Href: ' + myGenome.Href
59-
print 'DisplayName: ' + myGenome.DisplayName
55+
print("\nThe Genome is " + str(myGenome))
56+
print("We can get more information from the genome object")
57+
print('Id: ' + myGenome.Id)
58+
print('Href: ' + myGenome.Href)
59+
print('DisplayName: ' + myGenome.DisplayName)
6060

6161
# Get a list of all genomes
6262
allGenomes = myAPI.getAvailableGenomes()
63-
print "\nGenomes \n" + str(allGenomes)
63+
print("\nGenomes \n" + str(allGenomes))
6464

6565
# Let's have a look at the current user
6666
user = myAPI.getUserById('current')
67-
print "\nThe current user is \n" + str(user)
67+
print("\nThe current user is \n" + str(user))
6868

6969
# Now list the projects for this user
7070
myProjects = myAPI.getProjectByUser()
71-
print "\nThe projects for this user are \n" + str(myProjects)
71+
print("\nThe projects for this user are \n" + str(myProjects))
7272

7373
# We can also achieve this by making a call using the 'user instance'
7474
myProjects2 = user.getProjects(myAPI)
75-
print "\nProjects retrieved from the user instance \n" + str(myProjects2)
75+
print("\nProjects retrieved from the user instance \n" + str(myProjects2))
7676

7777
# List the runs available for the current user
7878
runs = user.getRuns(myAPI)
79-
print "\nThe runs for this user are \n" + str(runs)
79+
print("\nThe runs for this user are \n" + str(runs))
8080

8181
# In the same manner we can get a list of accessible user runs
8282
runs = user.getRuns(myAPI)
83-
print "\nRuns retrieved from user instance \n" + str(runs)
83+
print("\nRuns retrieved from user instance \n" + str(runs))

examples/1_AccessingFiles.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
you may not use this file except in compliance with the License.
66
You may obtain a copy of the License at
77
http://www.apache.org/licenses/LICENSE-2.0
8-
8+
99
Unless required by applicable law or agreed to in writing, software
1010
distributed under the License is distributed on an "AS IS" BASIS,
1111
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,14 +16,14 @@
1616
from BaseSpacePy.api.BaseSpaceAPI import BaseSpaceAPI
1717
import os
1818
"""
19-
This script demonstrates how to access Samples and AppResults from a projects and how to work with the available
20-
file data for such instances.
19+
This script demonstrates how to access Samples and AppResults from a projects and how to work with the available
20+
file data for such instances.
2121
"""
2222

2323
"""
24-
NOTE: The coverage and variants API calls below require access to a public
24+
NOTE: The coverage and variants API calls below require access to a public
2525
dataset. Before running the example, first go to cloud-hoth.illumina.com,
26-
login, click on Public Data, select the dataset named 'MiSeq B. cereus demo
26+
login, click on Public Data, select the dataset named 'MiSeq B. cereus demo
2727
data', and click the Import button for the Project named 'BaseSpaceDemo'.
2828
"""
2929

@@ -51,40 +51,40 @@
5151

5252
# Let's list all the AppResults and samples for these projects
5353
for singleProject in myProjects:
54-
print "# " + str(singleProject)
54+
print("# " + str(singleProject))
5555
appResults = singleProject.getAppResults(myAPI)
56-
print " The App results for project " + str(singleProject) + " are \n\t" + str(appResults)
56+
print(" The App results for project " + str(singleProject) + " are \n\t" + str(appResults))
5757
samples = singleProject.getSamples(myAPI)
58-
print " The samples for project " + str(singleProject) + " are \n\t" + str(samples)
58+
print(" The samples for project " + str(singleProject) + " are \n\t" + str(samples))
5959
#
60-
## we'll take a further look at the files belonging to the sample and
61-
##analyses from the last project in the loop above
60+
## we'll take a further look at the files belonging to the sample and
61+
##analyses from the last project in the loop above
6262
for a in appResults:
63-
print "# " + a.Id
63+
print("# " + a.Id)
6464
ff = a.getFiles(myAPI)
65-
print ff
65+
print(ff)
6666
for s in samples:
67-
print "Sample " + str(s)
67+
print("Sample " + str(s))
6868
ff = s.getFiles(myAPI)
69-
print ff
69+
print(ff)
7070

7171

72-
## Now let's do some work with files
73-
## we'll grab a BAM by id and get the coverage for an interval + accompanying meta-data
72+
## Now let's do some work with files
73+
## we'll grab a BAM by id and get the coverage for an interval + accompanying meta-data
7474
myBam = myAPI.getFileById('9895890')
75-
print myBam
75+
print(myBam)
7676
cov = myBam.getIntervalCoverage(myAPI,'chr','1','100')
77-
print cov
77+
print(cov)
7878
try:
7979
covMeta = myBam.getCoverageMeta(myAPI,'chr')
8080
except Exception as e:
81-
print "Coverage metadata may not be available for this BAM file: %s" % str(e)
81+
print("Coverage metadata may not be available for this BAM file: %s" % str(e))
8282
else:
83-
print covMeta
83+
print(covMeta)
8484
#
8585
## and a vcf file
8686
myVCF = myAPI.getFileById('9895892')
8787
varMeta = myVCF.getVariantMeta(myAPI)
88-
print varMeta
89-
var = myVCF.filterVariant(myAPI,'chr','1', '25000')
90-
print var
88+
print(varMeta)
89+
var = myVCF.filterVariant(myAPI,'chr','1', '25000')
90+
print(var)

examples/2_AppTriggering.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
you may not use this file except in compliance with the License.
66
You may obtain a copy of the License at
77
http://www.apache.org/licenses/LICENSE-2.0
8-
8+
99
Unless required by applicable law or agreed to in writing, software
1010
distributed under the License is distributed on an "AS IS" BASIS,
1111
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
1818
import time
1919

2020
"""
21-
This script demonstrates how to retrieve the AppSession object produced
21+
This script demonstrates how to retrieve the AppSession object produced
2222
when a user initiates an app. Further it's demonstrated how to automatically
2323
generate the scope strings to request access to the data object (a project or a sample)
2424
that the app was triggered to analyze.
@@ -51,52 +51,52 @@
5151

5252
# Using the basespaceApi we can request the appSession object corresponding to the AppSession id supplied
5353
myAppSession = myAPI.getAppSession()
54-
print myAppSession
54+
print(myAppSession)
5555

5656
# An app session contains a referal to one or more appLaunchObjects which reference the data module
57-
# the user launched the app on. This can be a list of projects, samples, or a mixture of objects
58-
print "\nType of data the app was triggered on can be seen in 'references'"
59-
print myAppSession.References
57+
# the user launched the app on. This can be a list of projects, samples, or a mixture of objects
58+
print("\nType of data the app was triggered on can be seen in 'references'")
59+
print(myAppSession.References)
6060

6161
# We can also get a handle to the user who started the AppSession
62-
print "\nWe can get a handle for the user who triggered the app\n" + str(myAppSession.UserCreatedBy)
62+
print("\nWe can get a handle for the user who triggered the app\n" + str(myAppSession.UserCreatedBy))
6363

6464
# Let's have a closer look at the appSessionLaunchObject
6565
myReference = myAppSession.References[0]
66-
print "\nWe can get out information such as the href to the launch object:"
67-
print myReference.HrefContent
68-
print "\nand the specific type of that object:"
69-
print myReference.Type
66+
print("\nWe can get out information such as the href to the launch object:")
67+
print(myReference.HrefContent)
68+
print("\nand the specific type of that object:")
69+
print(myReference.Type)
7070

7171

7272
# Now we will want to ask for more permission for the specific reference object
73-
print "\nWe can get out the specific project objects by using 'content':"
73+
print("\nWe can get out the specific project objects by using 'content':")
7474
myReference = myReference.Content
75-
print myReference
76-
print "\nThe scope string for requesting read access to the reference object is:"
77-
print myReference.getAccessStr(scope='write')
75+
print(myReference)
76+
print("\nThe scope string for requesting read access to the reference object is:")
77+
print(myReference.getAccessStr(scope='write'))
7878

7979
# We can easily request write access to the reference object so our App can start contributing analysis
8080
# by default we ask for write permission and authentication for a device
8181
#accessMap = myAPI.getAccess(myReference,accessType='write')
8282
# We may limit our request to read access only if that's all that is needed
8383
#readAccessMaps = myAPI.getAccess(myReference,accessType='read')
8484

85-
#print "\nWe get the following access map for the write request"
86-
#print accessMap
85+
#print("\nWe get the following access map for the write request")
86+
#print(accessMap)
8787

8888
## PAUSE HERE
8989
# Have the user visit the verification uri to grant us access
90-
#print "\nPlease visit the uri within 15 seconds and grant access"
91-
#print accessMap['verification_with_code_uri']
90+
#print("\nPlease visit the uri within 15 seconds and grant access")
91+
#print(accessMap['verification_with_code_uri'])
9292
#webbrowser.open_new(accessMap['verification_with_code_uri'])
9393
#time.sleep(15)
9494
## PAUSE HERE
9595

9696
# Once the user has granted us the access to the object we requested we can
9797
# get the basespace access token and start browsing simply by calling updatePriviliges
98-
# on the baseSpaceApi instance
98+
# on the baseSpaceApi instance
9999
#code = accessMap['device_code']
100100
#myAPI.updatePrivileges(code)
101-
#print "\nThe BaseSpaceAPI instance was update with write privileges"
102-
#print myAPI
101+
#print("\nThe BaseSpaceAPI instance was update with write privileges")
102+
#print(myAPI)

0 commit comments

Comments
 (0)