Closed qiyunzhu closed 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 .
@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:]
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.