Skip to content

Instantly share code, notes, and snippets.

@ionox0
Last active November 3, 2017 16:30
Show Gist options
  • Save ionox0/c1c9624ab873b92c28464cff8d537070 to your computer and use it in GitHub Desktop.
Save ionox0/c1c9624ab873b92c28464cff8d537070 to your computer and use it in GitHub Desktop.
import itertools
import pandas as pd
barcode_labels = pd.read_excel('IDT_DM-96 barcode-for hiseq.xlsx')
sample_1_list = barcode_labels['Index_Name'].str.slice(0, 6)
sample_2_list = barcode_labels['Index_Name'].str.slice(6, 11)
sample_name_combs = itertools.product(sample_1_list, sample_2_list)
sample_name_combs_list = list(sample_name_combs)
sample_name_combs_df = pd.DataFrame(sample_name_combs_list)
sample_name_combs_df['merged'] = sample_name_combs_df.iloc[:,0] + sample_name_combs_df.iloc[:,1]
barcode_sequence_combs = itertools.product(barcode_labels['P5'], umi_labels['P7'])
barcode_sequence_combs = pd.DataFrame(list(barcode_sequence_combs))
result = pd.concat([sample_name_combs_df['merged'], barcode_sequence_combs], axis=1)
result.columns = ['merged', 'P5', 'P7']
result['sequence_merged'] = result['P5'] + '-' + result['P7']
result.to_csv('all_combinations_merged.csv', index=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment