iTaxoTools / TaxI2-legacy

Calculates genetic differences between DNA sequences
GNU General Public License v3.0
0 stars 0 forks source link

Integrate graphics output in Taxi2 #16

Closed mvences closed 3 years ago

mvences commented 3 years ago

In the last two days I have worked with Sangeeta to come up with suitable histogram output for Taxi2. I chose this procedure because it was important to review and adjust the graphs many times, and it would have been impractical to instruct you to do this this by email or Github in multiple iterations.

She has now produced a code that uses the last table from the Taxi2 output to generate the histograms needed, plus some additional statistics.

You can find this code in the Github repository: TaxoTools/taxi_plots

Please integrate this code in Taxi2 so that the graphs are outputted in the same folder as the other output file. Probably this also implies that the user specifies an output folder rather than an output file.

The extra statistics analyses for now can just be appended to the main text output file, after the last table.

Of course you can adjust or modify the code as needed, but please keep all of the graphics specifications such as TT2 fonts, colors of the graphs, and so on.

Once this change in Taxi2 has been done, I will thoroughly test the program.

necrosovereign commented 3 years ago

@mvences @sangeeta97 Should I proceed with this by copying plot_taxi.py from iTaxoTools/taxi_plots?

sangeeta97 commented 3 years ago

Yes, Please do that. But it will take output of taxi tool and then will produce the plots and statistics results.

On Wed, Feb 10, 2021 at 5:32 PM Necrosovereign notifications@github.com wrote:

@mvences https://github.com/mvences @sangeeta97 https://github.com/sangeeta97 Should I proceed with this by copying plot_taxi.py from iTaxoTools/taxi_plots https://github.com/iTaxoTools/taxi_plots?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/iTaxoTools/TaxI2/issues/16#issuecomment-776838104, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK3BZBS7QKNP3MJYXIAJZODS6KYI3ANCNFSM4WZRRZKA .

mvences commented 3 years ago

@necrosovereign

Please proceed as follows:

necrosovereign commented 3 years ago

@sangeeta97 When I call Plot with parameters

"/tmp/out_dir/taxi2_tables.txt"
"/tmp/out_dir"
['JC distance', 'p-distance with gaps']

I get an exception

File "./taxi2.py", line 51, in process
    Plot(plot_input, output_dir, distance_name)
  File "/home/necrosovereign/Documents/Taxon-Omics/TaxI2/library/plot_taxi.py", line 67, in __init__
    self.stack_hist()
  File "/home/necrosovereign/Documents/Taxon-Omics/TaxI2/library/plot_taxi.py", line 111, in stack_hist
    g.map(sns.displot, x= col, hue="comparison_type", multiple="stack", data= self.table, palette=["red", "#add8e6", "blue"])
ValueError: The palette list has the wrong number of colors.

The contents of /tmp/out_dir/taxi2_tables.txt: taxi2_tables.txt

How should I fix this?

sangeeta97 commented 3 years ago

Okay, This problem is happening because not all the data has intergenus level and my plot codes has been made thinking that intergenus is always there. The table is sorted thus always you will get intra-species, interspecies, and intergenus. just subset the palette list based on the number of unique values of comparison type column. Just use below, Also you will have to give path to the output file according to the GUI. I have parsed your table to get the data, but you can integrated it with your codes and ignore my pandas codes for reading your output file (I did not read your all the codes...).

def stack_hist(self): df= self.table.set_index("comparison_type") num= int(self.table['comparison_type'].nunique()) palette=["red", "#add8e6", "blue"]

    for i, col in enumerate(df.columns):
        g= sns.FacetGrid(data= self.table, height= 4)
        g.map(sns.displot, x= col, hue="comparison_type",

multiple="stack", data= self.table, palette= palette[0:num])

def dodge_hist(self): num= int(self.table['comparison_type'].nunique()) palette=["red", "#add8e6", "blue"] df= self.table.set_index("comparison_type")

    for i, col in enumerate(df.columns):
        g= sns.FacetGrid(self.table, height= 4)
        g.map(sns.displot, col, hue="comparison_type",

multiple="dodge", data= self.table, palette= palette[0:num])

On Fri, Feb 12, 2021 at 3:38 PM Necrosovereign notifications@github.com wrote:

@sangeeta97 https://github.com/sangeeta97 When I call Plot with parameters

"/tmp/out_dir/taxi2_tables.txt" "/tmp/out_dir" ['JC distance', 'p-distance with gaps']

I get an exception

File "./taxi2.py", line 51, in process Plot(plot_input, output_dir, distance_name) File "/home/necrosovereign/Documents/Taxon-Omics/TaxI2/library/plot_taxi.py", line 67, in init self.stack_hist() File "/home/necrosovereign/Documents/Taxon-Omics/TaxI2/library/plot_taxi.py", line 111, in stack_hist g.map(sns.displot, x= col, hue="comparison_type", multiple="stack", data= self.table, palette=["red", "#add8e6", "blue"]) ValueError: The palette list has the wrong number of colors.

The contents of /tmp/out_dir/taxi2_tables.txt: taxi2_tables.txt https://github.com/iTaxoTools/TaxI2/files/5972438/taxi2_tables.txt

How should I fix this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/iTaxoTools/TaxI2/issues/16#issuecomment-778233495, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK3BZBR2B465BQODOSGCQ4LS6U4PFANCNFSM4WZRRZKA .

necrosovereign commented 3 years ago

@sangeeta97 Okay, thank you