Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adapted code for pandas2.0 #127

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion methylprep/files/sample_sheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ def build_meta_data(self, samples = None):
cols = list(self.fields.values()) + ['Sample_ID']
meta_frame = pd.DataFrame(columns=cols)
# row contains the renamed fields, and pulls in the original data from sample_sheet
rows = []
for sample in samples:
row = {}
for field in self.fields.keys():
Expand All @@ -511,5 +512,8 @@ def build_meta_data(self, samples = None):
# add the UID that matches m_value/beta value pickles
#... unless there's a GSM_ID too
row['Sample_ID'] = f"{row['Sentrix_ID']}_{row['Sentrix_Position']}"
meta_frame = meta_frame.append(row, ignore_index=True)
rows.append(row)

meta_frame = pd.DataFrame(columns=cols, data=rows)

return meta_frame
7 changes: 4 additions & 3 deletions methylprep/processing/infer_channel_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ def get_infer_channel_probes(manifest, green_idat, red_idat, debug=False):
green_in_band['unmeth'] = oobR_meth

# next, add the green-in-band to oobG and red-in-band to oobR
oobG_IG = oobG.append(green_in_band).sort_index()
oobR_IR = oobR.append(red_in_band).sort_index()
oobG_IG = pd.concat([oobG, green_in_band]).sort_index()
oobR_IR = pd.concat([oobR, red_in_band]).sort_index()

# channel swap requires a way to update idats with illumina_ids
lookupIR = probe_details_IR.merge(
Expand All @@ -186,7 +186,8 @@ def get_infer_channel_probes(manifest, green_idat, red_idat, debug=False):
right_index=True,
suffixes=(False, False),
)[['AddressA_ID','AddressB_ID']]
lookup = lookupIG.append(lookupIR).sort_index()
#lookup = lookupIG.append(lookupIR).sort_index()
lookup = pd.concat([lookupIG, lookupIR]).sort_index()

if debug:
return {'green': oobG_IG, 'red': oobR_IR, 'oobG': oobG, 'oobR':oobR, 'IG': green_in_band, 'IR': red_in_band, 'lookup': lookup}
Expand Down