Skip to content

Commit de81c93

Browse files
committed
Formatting changes. Removed comment length check as we're deferring to OSDF for that.
1 parent 5ae85fa commit de81c93

6 files changed

Lines changed: 81 additions & 80 deletions

File tree

cutlass/WgsAssembledSeqSet.py

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ class WgsAssembledSeqSet(Base):
3535

3636
def __init__(self):
3737
"""
38-
Constructor for the WgsAssembledSeqSet class. This initializes the fields specific
39-
to the WgsAssembledSeqSet class, and inherits from the Base class.
38+
Constructor for the WgsAssembledSeqSet class. This initializes the
39+
fields specific to the WgsAssembledSeqSet class, and inherits from the
40+
Base class.
4041
4142
Args:
4243
None
@@ -159,8 +160,8 @@ def comment(self):
159160
@enforce_string
160161
def comment(self, comment):
161162
"""
162-
The setter for the WgsAssembledSeqSet comment. The comment must be a string,
163-
and less than 512 characters.
163+
The setter for the WgsAssembledSeqSet comment. The comment must be a
164+
string.
164165
165166
Args:
166167
comment (str): The new comment to add to the string.
@@ -170,15 +171,14 @@ def comment(self, comment):
170171
"""
171172
self.logger.debug("In 'comment' setter.")
172173

173-
if len(comment) > 512:
174-
raise Exception("Comment is too long. Max length is 512 characters.")
175-
176174
self._comment = comment
177175

178176
@property
179177
def format(self):
180-
""" str: The file format of the sequence file """
181-
self.logger.debug("In format getter.")
178+
"""
179+
str: The file format of the sequence file.
180+
"""
181+
self.logger.debug("In 'format' getter.")
182182

183183
return self._format
184184

@@ -194,10 +194,10 @@ def format(self, format_str):
194194
Returns:
195195
None
196196
"""
197-
self.logger.debug("In format setter.")
197+
self.logger.debug("In 'format' setter.")
198198

199199
if type(format_str) != str:
200-
raise ValueError("format must be a string.")
200+
raise ValueError("Format must be a string.")
201201

202202
formats = ["fasta", "fastq"]
203203
if format_str in formats:
@@ -230,7 +230,9 @@ def format_doc(self, format_doc):
230230

231231
@property
232232
def local_file(self):
233-
""" str: URL to the local file to upload to the server. """
233+
"""
234+
str: URL to the local file to upload to the server.
235+
"""
234236
self.logger.debug("In 'local_file' getter.")
235237

236238
return self._local_file
@@ -671,13 +673,14 @@ def is_valid(self):
671673

672674
def save(self):
673675
"""
674-
Saves the data in the current instance. The JSON form of the current data
675-
for the instance is validated in the save function. If the data is not valid,
676-
then the data will not be saved. If the instance was saved previously, then
677-
the node ID is assigned the alpha numeric found in the OSDF instance. If not
678-
saved previously, then the node ID is 'None', and upon a successful, will be
679-
assigned to the alpha numeric ID found in the OSDF instance. Also, the
680-
version is updated as the data is saved in the OSDF instance.
676+
Saves the data in the current instance. The JSON form of the current
677+
data for the instance is validated in the save function. If the data is
678+
not valid, then the data will not be saved. If the instance was saved
679+
previously, then the node ID is assigned the alpha numeric found in the
680+
OSDF instance. If not saved previously, then the node ID is 'None', and
681+
upon a successful, will be assigned to the alpha numeric ID found in
682+
the OSDF instance. Also, the version is updated as the data is saved in
683+
the OSDF instance.
681684
682685
Args:
683686
None

cutlass/WgsDnaPrep.py

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ def comment(self):
132132
@enforce_string
133133
def comment(self, comment):
134134
"""
135-
The setter for the comment. The comment must be a string,
136-
and less than 512 characters.
135+
The setter for the comment. The comment must be a string.
137136
138137
Args:
139138
comment (str): The new comment to add to the string.
@@ -143,14 +142,13 @@ def comment(self, comment):
143142
"""
144143
self.logger.debug("In comment setter.")
145144

146-
if len(comment) > 512:
147-
raise Exception("Comment is too long, must be less than 512 characters.")
148-
149145
self._comment = comment
150146

151147
@property
152148
def frag_size(self):
153-
""" int: Target library fragment size after shearing. """
149+
"""
150+
int: Target library fragment size after shearing.
151+
"""
154152
self.logger.debug("In frag_size getter.")
155153

156154
return self._frag_size
@@ -177,8 +175,10 @@ def frag_size(self, frag_size):
177175

178176
@property
179177
def lib_layout(self):
180-
""" str: Specification of the layout: fragment/paired, and if paired,
181-
then nominal insert size and standard deviation. """
178+
"""
179+
str: Specification of the layout: fragment/paired, and if paired,
180+
then nominal insert size and standard deviation.
181+
"""
182182
self.logger.debug("In 'lib_layout' getter.")
183183

184184
return self._lib_layout
@@ -201,9 +201,10 @@ def lib_layout(self, lib_layout):
201201

202202
@property
203203
def lib_selection(self):
204-
""" str: A controlled vocabulary of terms describing selection or reduction
205-
method used in library construction. Terms used by TCGA include
206-
(random, hybrid selection)
204+
"""
205+
str: A controlled vocabulary of terms describing selection or reduction
206+
method used in library construction. Terms used by TCGA include
207+
(random, hybrid selection)
207208
"""
208209
self.logger.debug("In 'lib_selection' getter.")
209210

@@ -227,7 +228,9 @@ def lib_selection(self, lib_selection):
227228

228229
@property
229230
def mims(self):
230-
""" mimarks: Genomic Standards Consortium MIMS fields. """
231+
"""
232+
mimarks: Genomic Standards Consortium MIMS fields.
233+
"""
231234
self.logger.debug("In mims getter.")
232235

233236
return self._mims
@@ -331,7 +334,9 @@ def sequencing_center(self, sequencing_center):
331334

332335
@property
333336
def sequencing_contact(self):
334-
""" str: Name and email of the primary contact at the sequencing center. """
337+
"""
338+
str: Name and email of the primary contact at the sequencing center.
339+
"""
335340
self.logger.debug("In 'sequencing_contact' getter.")
336341

337342
return self._sequencing_contact
@@ -354,7 +359,9 @@ def sequencing_contact(self, sequencing_contact):
354359

355360
@property
356361
def storage_duration(self):
357-
""" int: Duration for which sample was stored in days. """
362+
"""
363+
int: Duration for which sample was stored in days.
364+
"""
358365
self.logger.debug("In 'storage_duration' getter.")
359366

360367
return self._storage_duration
@@ -381,7 +388,9 @@ def storage_duration(self, storage_duration):
381388

382389
@property
383390
def srs_id(self):
384-
""" str: NCBI Sequence Read Archive sample ID of the form SRS012345. """
391+
"""
392+
str: NCBI Sequence Read Archive sample ID of the form SRS012345.
393+
"""
385394
self.logger.debug("In 'srs_id' getter.")
386395

387396
return self._srs_id
@@ -481,10 +490,10 @@ def _get_raw_doc(self):
481490
@staticmethod
482491
def search(query = "\"wgs_dna_prep\"[node_type]"):
483492
"""
484-
Searches the OSDF database through all WgsDnaPrep node types. Any criteria
485-
the user wishes to add is provided by the user in the query language
486-
specifications provided in the OSDF documentation. A general format
487-
is (including the quotes and brackets):
493+
Searches the OSDF database through all WgsDnaPrep node types. Any
494+
criteria the user wishes to add is provided by the user in the query
495+
language specifications provided in the OSDF documentation. A general
496+
format is (including the quotes and brackets):
488497
489498
"search criteria"[field to search]
490499
@@ -570,7 +579,6 @@ def load_wgsDnaPrep(prep_data):
570579
@staticmethod
571580
def load(prep_id):
572581
"""
573-
574582
Loads the data for the specified input ID from the OSDF instance to
575583
this object. If the provided ID does not exist, then an error message
576584
is provided stating the project does not exist.

cutlass/WgsRawSeqSet.py

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class WgsRawSeqSet(Base):
3131

3232
def __init__(self):
3333
"""
34-
Constructor for the WgsRawSeqSet class. This initializes the fields specific
35-
to the WgsRawSeqSet class, and inherits from the Base class.
34+
Constructor for the WgsRawSeqSet class. This initializes the fields
35+
specific to the WgsRawSeqSet class, and inherits from the Base class.
3636
3737
Args:
3838
None
@@ -176,8 +176,7 @@ def comment(self):
176176
@enforce_string
177177
def comment(self, comment):
178178
"""
179-
The setter for the comment field. The comment must be a string,
180-
and less than 512 characters.
179+
The setter for the comment field. The comment must be a string.
181180
182181
Args:
183182
comment (str): The new comment to add to the string.
@@ -191,8 +190,10 @@ def comment(self, comment):
191190

192191
@property
193192
def exp_length(self):
194-
""" int: The number of raw bases or color space calls expected for the read,
195-
includes both mate pairs and all technical portions. """
193+
"""
194+
int: The number of raw bases or color space calls expected for the read,
195+
includes both mate pairs and all technical portions.
196+
"""
196197
self.logger.debug("In 'exp_length' getter.")
197198

198199
return self._exp_length
@@ -217,7 +218,9 @@ def exp_length(self, exp_length):
217218

218219
@property
219220
def format(self):
220-
""" str: The file format of the sequence file """
221+
"""
222+
str: The file format of the sequence file.
223+
"""
221224
self.logger.debug("In 'format' getter.")
222225

223226
return self._format
@@ -244,7 +247,9 @@ def format(self, format_str):
244247

245248
@property
246249
def format_doc(self):
247-
""" str: URL for documentation of file format. """
250+
"""
251+
str: URL for documentation of file format.
252+
"""
248253
self.logger.debug("In 'format_doc' getter.")
249254

250255
return self._format_doc
@@ -267,7 +272,9 @@ def format_doc(self, format_doc):
267272

268273
@property
269274
def local_file(self):
270-
""" str: URL to the local file to upload to the server. """
275+
"""
276+
str: URL to the local file to upload to the server.
277+
"""
271278
self.logger.debug("In local_file getter.")
272279

273280
return self._local_file
@@ -423,11 +430,11 @@ def required_fields():
423430

424431
def _get_raw_doc(self):
425432
"""
426-
Generates the raw JSON document for the current object. All required fields are
427-
filled into the JSON document, regardless they are set or not. Any remaining
428-
fields are included only if they are set. This allows the user to visualize
429-
the JSON to ensure fields are set appropriately before saving into the
430-
database.
433+
Generates the raw JSON document for the current object. All required
434+
fields are filled into the JSON document, regardless they are set or
435+
not. Any remaining fields are included only if they are set. This
436+
allows the user to visualize the JSON to ensure fields are set
437+
appropriately before saving into the database.
431438
432439
Args:
433440
None
@@ -478,9 +485,9 @@ def _get_raw_doc(self):
478485
def search(query = "\"wgs_raw_seq_set\"[node_type]"):
479486
"""
480487
Searches the OSDF database through all WgsRawSeqSet node types. Any
481-
criteria the user wishes to add is provided by the user in the query language
482-
specifications provided in the OSDF documentation. A general format
483-
is (including the quotes and brackets):
488+
criteria the user wishes to add is provided by the user in the query
489+
language specifications provided in the OSDF documentation. A general
490+
format is (including the quotes and brackets):
484491
485492
"search criteria"[field to search]
486493
@@ -492,8 +499,8 @@ def search(query = "\"wgs_raw_seq_set\"[node_type]"):
492499
WgsRawSeqSet node type.
493500
494501
Returns:
495-
Returns an array of WgsRawSeqSet objects. It returns an empty list if
496-
there are no results.
502+
Returns an array of WgsRawSeqSet objects. It returns an empty list
503+
if there are no results.
497504
"""
498505
module_logger.debug("In search.")
499506

@@ -563,15 +570,16 @@ def load_wgsRawSeqSet(seq_set_data):
563570
@staticmethod
564571
def load(seq_set_id):
565572
"""
566-
Loads the data for the specified input ID from the OSDF instance to this object.
567-
If the provided ID does not exist, then an error message is provided stating the
568-
project does not exist.
573+
Loads the data for the specified input ID from the OSDF instance to
574+
this object. If the provided ID does not exist, then an error message
575+
is provided stating the project does not exist.
569576
570577
Args:
571578
seq_set_id (str): The OSDF ID for the document to load.
572579
573580
Returns:
574-
A WgsRawSeqSet object with all the available OSDF data loaded into it.
581+
A WgsRawSeqSet object with all the available OSDF data loaded into
582+
it.
575583
"""
576584
module_logger.debug("In load. Specified ID: %s" % seq_set_id)
577585

tests/test_wgs_assembled_seq_set.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,6 @@ def testIllegalComment(self):
160160
with self.assertRaises(Exception):
161161
seq_set.comment = 1
162162

163-
def testCommentTooLong(self):
164-
seq_set = session.create_object("wgs_assembled_seq_set")
165-
166-
with self.assertRaises(Exception):
167-
seq_set.comment = rand_generator(750)
168-
169163
def testLegalComment(self):
170164
seq_set = session.create_object("wgs_assembled_seq_set")
171165
success = False

tests/test_wgs_dna_prep.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,6 @@ def testIllegalComment(self):
9999
with self.assertRaises(Exception):
100100
wgsDnaPrep.comment = 1
101101

102-
def testCommentTooLong(self):
103-
wgsDnaPrep = session.create_object("wgs_dna_prep")
104-
105-
with self.assertRaises(Exception):
106-
wgsDnaPrep.comment = rand_generator(750)
107-
108102
def testLegalComment(self):
109103
wgsDnaPrep = session.create_object("wgs_dna_prep")
110104
success = False

tests/test_wgs_raw_seq_set.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,6 @@ def testCommentIllegal(self):
103103
with self.assertRaises(Exception):
104104
wgsRawSeqSet.comment = 1
105105

106-
def testCommentTooLong(self):
107-
wgsRawSeqSet = session.create_object("wgs_raw_seq_set")
108-
109-
with self.assertRaises(Exception):
110-
wgsRawSeqSet.comment = rand_generator(750)
111-
112106
def testCommentLegal(self):
113107
wgsRawSeqSet = session.create_object("wgs_raw_seq_set")
114108
success = False

0 commit comments

Comments
 (0)