Skip to content

Commit

Permalink
fix simulate_samples
Browse files Browse the repository at this point in the history
  • Loading branch information
raquellewei committed Oct 18, 2023
1 parent ef5e68e commit 2ea8a02
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions fununifrac/reproducibility/simulate_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
def parsearg():
parser = argparse.ArgumentParser(description="This script generates simulated data")
parser.add_argument("-f", "--template_file", type=str, help="Template file")
parser.add_argument("-o", "--out_dir", type=str, help="Output direcctory")
parser.add_argument("-o", "--out_dir", type=str, help="Output directory")
return parser.parse_args()


Expand All @@ -29,10 +29,15 @@ def main():
meta_df.to_csv(f"{args.out_dir}/simulated_metadata.csv")
print(meta_df)

sim_dict = {
0.5: 'low',
0.75: 'medium',
0.9: 'high',
}
for i in range(100):
for percentage in [0.5, 0.75, 0.9]:
partition = int(len(df.columns) * percentage)
file_name = f"{args.out_dir}/sim_sample_{percentage}_{i}.csv"
for proportion in sim_dict:
partition = int(len(df.columns) * sim_dict[proportion])
file_name = f"{args.out_dir}/sim_sample_{sim_dict[proportion]}_{i}.csv"
for col in df.columns[:50]:
vector = np.zeros(len(df.columns))
vector[:partition] =[random.random() for _ in range(partition)]
Expand All @@ -45,7 +50,5 @@ def main():





if __name__ == '__main__':
main()

0 comments on commit 2ea8a02

Please sign in to comment.