biocore / wetlab-assistant

BSD 3-Clause "New" or "Revised" License
0 stars 2 forks source link

plate linker module #16

Closed qiyunzhu closed 7 years ago

qiyunzhu commented 7 years ago

This is to fulfill a request from the wet lab crew - to automate the conversion of a pre-existent metadata table into a final mapping file, by adding the columns of barcode and primer sequences. For examples of input and output files, please refer to plate_linker/tests/data.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling b151329a863d926cab9957db92fce6652b09585a on qiyunzhu:linker into ae176b18f6996e6b4692412fde251563f0c25575 on biocore:master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 7d5d0e2d36e09550f2460d89c763faa414154098 on qiyunzhu:linker into ae176b18f6996e6b4692412fde251563f0c25575 on biocore:master.

mortonjt commented 7 years ago

That works too!

On Tue, Jul 25, 2017 at 4:59 PM, Qiyun Zhu notifications@github.com wrote:

@qiyunzhu commented on this pull request.

In plate_linker/plate_linker.py https://github.com/biocore/wetlab-assistant/pull/16#discussion_r129455314 :

+

  • In the primer file, the 2nd and 3rd columns are barcode and primer, while
  • the 4th and 5th columns are primer plate ID and well ID.
  • In the output file, columns are: sample ID, barcode, primer, primer plate
  • ID, well ID, plus variable number of metadata columns.
  • """
  • merge column headers of primer and metadata files

  • primcols = primer_f.readline().strip('\r\n').split('\t')
  • metacols = metadata_f.readline().strip('\r\n').split('\t')[3:]
  • output_f.write('%s\n' % '\t'.join(primcols + metacols))
  • read sample ID and metadata associated with well

  • well2sample, well2meta = {}, {}
  • for line in metadata_f:
  • l = line.rstrip('\r\n').split('\t')
  • sample = l[0].replace('_', '.').replace('-', '.')

Makes sense! How about:

sample, plate, well = line.split('\t')

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/biocore/wetlab-assistant/pull/16#discussion_r129455314, or mute the thread https://github.com/notifications/unsubscribe-auth/AD_a3UXbLPC0jSLpLlu--qs733h2q4iRks5sRoF6gaJpZM4OjJNY .

qiyunzhu commented 7 years ago

@mortonjt I looked again and found it not easy. In this block of code,

sample = l[0].replace('_', '.').replace('-', '.')
well = '%s.%s' % (l[1], l[2])
metadata = l[3:]

The last element (metadata) prevents me from doing:

sample_id, plate_id, well_id, metadata = line.split('\t')

Or doing:

sample_id, plate_id, well_id, metadata = 0, 1, 2, 3
sample = l[sample_id].replace('_', '.').replace('-', '.')
well = '%s.%s' % (l[plate_id], l[well_id])
metadata = l[metadata:]