Skip to content

Commit

Permalink
add index intersection
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonHafner committed Jan 4, 2025
1 parent cb8e10a commit 13313a7
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ def format_yaml_like(data: dict, indent: int = 0) -> str:
df_lengths = df_lengths / 1e3
df_lengths = df_lengths.groupby(df_lengths.index).mean()

df_lengths = df_lengths.loc[df_lengths.index.isin(df_counts.index)]
# Subset gene lengths and counts to common index
shared_index = df_lengths.index.intersection(df_counts.index)
df_lengths = df_lengths.loc[shared_index]
df_counts = df_counts.loc[shared_index]

# Calculate TPM
df_rpk = df_counts.div(df_lengths["length"], axis=0)
Expand Down

0 comments on commit 13313a7

Please sign in to comment.