Skip to content

Commit

Permalink
Merge pull request #295 from chuan-wang/master
Browse files Browse the repository at this point in the history
Change the way how samples are sorted
  • Loading branch information
ssjunnebo authored Oct 28, 2020
2 parents 084da7f + cdb0aee commit 07f86e8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions taca/illumina/HiSeqX_Runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,8 @@ def _generate_clean_samplesheet(ssparser, indexfile, fields_to_remove=None, rena
sample['index2'] = index_dict_smartseq[smartseq_index][x][1]

# Sort to get the added indicies from 10x in the right place
# Python 3 doesn't support sorting a list of dicts implicitly. Sort by lane and then index
ssparser.data.sort(key=lambda item: (item.get('Lane'), item.get('index')))
# Python 3 doesn't support sorting a list of dicts implicitly. Sort by lane and then Sample_ID
ssparser.data.sort(key=lambda item: (item.get('Lane'), item.get('Sample_ID')))

if not fields_to_remove:
fields_to_remove = []
Expand Down
2 changes: 1 addition & 1 deletion tests/data/2014/FCIDXX.csv
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Experiment Name,CIDXX
151
151
[Data]
Lane,SampleID,SampleName,SamplePlate,SampleWell,index,index2,Project,Description
Lane,Sample_ID,Sample_Name,Sample_Plate,Sample_Well,index,index2,Project,Description
1,Sample_P10000_1001,P10000_1001,CIDXX,1:1,SI-GA-A1,,A_Test_18_01,
2,Sample_P10000_1005,P10000_1005,CIDXX,2:1,AGGTACC,,A_Test_18_01,
3,Sample_P10000_1006,P10000_1006,CIDXX,3:1,SMARTSEQ-1A,,A_Test_18_01,
Expand Down
10 changes: 5 additions & 5 deletions tests/test_illumina.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,16 +731,16 @@ def test_generate_clean_samplesheet(self):
Experiment Name,CIDXX
Investigator Name,Test
[Data]
Lane,SampleID,SampleName,SamplePlate,SampleWell,index,index2,Project,Description
Lane,Sample_ID,Sample_Name,Sample_Plate,Sample_Well,index,index2,Project,Description
1,Sample_P10000_1001,P10000_1001,CIDXX,1:1,AACCGTAA,,A_Test_18_01,
1,Sample_P10000_1001,P10000_1001,CIDXX,1:1,CTAAACGG,,A_Test_18_01,
1,Sample_P10000_1001,P10000_1001,CIDXX,1:1,GGTTTACT,,A_Test_18_01,
1,Sample_P10000_1001,P10000_1001,CIDXX,1:1,CTAAACGG,,A_Test_18_01,
1,Sample_P10000_1001,P10000_1001,CIDXX,1:1,TCGGCGTC,,A_Test_18_01,
2,Sample_P10000_1005,P10000_1005,CIDXX,2:1,AGGTACC,,A_Test_18_01,
3,Sample_P10000_1006,P10000_1006,CIDXX,3:1,TGTATCCGAA,CACAGGTGAA,A_Test_18_01,
3,Sample_P10000_1006,P10000_1006,CIDXX,3:1,GAGCGCCTAT,TTGGTACGCG,A_Test_18_01,
3,Sample_P10000_1006,P10000_1006,CIDXX,3:1,GCTAGGTCAA,CACAGGTGAA,A_Test_18_01,
3,Sample_P10000_1006,P10000_1006,CIDXX,3:1,TAAGACGGTG,TTGGTACGCG,A_Test_18_01,
3,Sample_P10000_1006,P10000_1006,CIDXX,3:1,TGTATCCGAA,CACAGGTGAA,A_Test_18_01,
3,Sample_P10000_1006,P10000_1006,CIDXX,3:1,GCTAGGTCAA,CACAGGTGAA,A_Test_18_01,
4,Sample_P10000_1007,P10000_1007,CIDXX,4:1,GTAACATGCG,AGTGTTACCT,A_Test_18_01,
'''
got_samplesheet = _generate_clean_samplesheet(ssparser, indexfile, rename_samples=True, rename_qPCR_suffix = True, fields_qPCR=[ssparser.dfield_snm])
Expand Down Expand Up @@ -893,7 +893,7 @@ def test_generate_samplesheet_subset(self):
Experiment Name,CIDXX
Investigator Name,Test
[Data]
Lane,SampleID,SampleName,SamplePlate,SampleWell,index,index2,Project,Description
Lane,Sample_ID,Sample_Name,Sample_Plate,Sample_Well,index,index2,Project,Description
1,Sample_P10000_1001,P10000_1001,CIDXX,1:1,SI-GA-A1,,A_Test_18_01,
'''
self.assertEqual(got_data, expected_data)
Expand Down

0 comments on commit 07f86e8

Please sign in to comment.