Created
July 7, 2024 13:34
-
-
Save StephenFordham/eada3cf74d7d2c5200e22a3f4b66c7c1 to your computer and use it in GitHub Desktop.
short_read_depth_calculation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def depth_calc(file, read_depth=0): | |
df = pd.read_csv(file, sep='\t', header=None) | |
df.columns = ['consensus', 'base_position', 'depth'] | |
plasmid_length = df['base_position'].max() | |
base_coverage = df[df['depth'] > read_depth].__len__() | |
cov_perc = (base_coverage/plasmid_length) * 100 | |
return cov_perc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment