Skip to content

Commit

Permalink
added options for column id and condition
Browse files Browse the repository at this point in the history
  • Loading branch information
raquellewei committed Oct 2, 2023
1 parent c6a7c19 commit 7ff9394
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fununifrac/reproducibility/plot_mds.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ def parsearg():
parser.add_argument('-m', '--metadata_file', help='Path to the metadata file.')
parser.add_argument('-t', '--title', help='Title of the plot.')
parser.add_argument('-o', '--output', help='Output file name.')
parser.add_argument('-c', '--condition', help='Column key for the condition based on which MDS is performed.',
default='study_full_name')
parser.add_argument('-id', '--sample_id', help='Column name of the sample id.', default='f_uid')
return parser.parse_args()


Expand All @@ -27,7 +30,7 @@ def parsearg():
labels = [l.strip() for l in labels]
labels = [Path(l).stem for l in labels]
labels = [l.replace("sourmash_gather_out_scale1000_k_11_", "") for l in labels]
metadata_dict = {x:y for (x, y) in zip(metadata["f_uid"], metadata["study_full_name"])}
metadata_dict = {x:y for (x, y) in zip(metadata[args.sample_id], metadata[args.condition])}
pw_dist = np.load(args.pairwise_distance)
mds = MDS(dissimilarity='precomputed')
coordinates = mds.fit_transform(pw_dist)
Expand Down

0 comments on commit 7ff9394

Please sign in to comment.