Adjust the cluster order of sc.pl.heatmap in scanpy - heatmap

I am a beginner who is studying bioinformatics with scanpy these days.
In the 'sc.pl.heatmap', I want to show ‘leiden’ in a specific order in heatmap, but I don’t know what to do.
I want to show ‘leiden’ in ascending order.
Is there any related function?

Related

Openstreetmap: Bring ways of motorway in the correct order

I want to analyze the duration of speed limits on german motorways.
Therefore I chose the relation 20904, which is a german motorway. https://www.openstreetmap.org/relation/20904.
I expected that the members (way pieces) are in the correct order. That means to me, that each following way is in the next line. But there are ways which are not sorted at all. For example the last member of that relation is anywhere in the middle of the motorway.
How can I sort the members of the relation in a chronological order? I couldn't find anything about it so I think I got something really wrong in working with OSM
I tried to sort the ways in a json by identifying the last and the first node of the ways, but here again I'm not sure if the nodes are in the correct order.

Very basic question about dividing two MySQL table columns

So, I'm just beginning learning SQL today. I have a table in MySQL and need to find the gdp per capita and make a new column out of it (or potentially just assign it to a column I have already made if making a new one isn't possible), I have a column with the countries' gdp and the countries' population, both of which have been given the type BIGINT. But how might I divide those two numbers together and have them in descending order and I want to print them out?
The code I have so far is:
SELECT countries_name, countries_population, countries_gdp
FROM countries.countries
WHERE (countries_population / countries_gdp) countries_per_capita_gdp
ORDER BY DESC
Would anyone be able to give me a hint as to what I might be doing wrong please? Our lecturer is giving us very little guidance on this so I think most of us are confused, unfortunately.
I think what you're looking for is this:
SELECT countries_name, countries_population, countries_gdp, (countries_population / countries_gdp) AS countries_per_capita_gdp
FROM countries
ORDER BY countries_per_capita_gdp DESC
I noticed your FROM had countries.countries, not sure if that was intentional, might just have to be countries.

I need to use the WHERE clause with a value of an element

I'm developing a database to be used in a school here to store data on payments and students. Everything is going smoothly and I'm almost done but recently I have the need to filter some elements in one of my forms, I understand I have to use the clause WHERE in sql, but I don't really know much about it.
I have an element that's basically a search bar, you have to put the ID of a student there and it should display the payments that student made over one specific year. I have trouble filtering that ID and I have found very little documentation of this WHERE clause, I just want something like WHERE student.id = getElementbyId(id.searchbar'').value; ,look for an specific value that is written in an element but not necessarily stored in a database.
I would really appreciate your help, I'm sure this is a really dumb question.

Insert new row into table and make sure it becomes the last row

Is there any way to make sure this happens? Because the table i'm working with is randomly ordering the rows as i insert new rows and i don't want that to happen. Also, i want to avoid adding a timestamp column. I've tried to search the web for answers but found nothing so far. I can only hope someone here can help me out.
The only way to guarantee order from a database is to use an ORDER BY clause in your SQL when you pull it. Anything else would be a bad practice (relying on functionality that may or may not be the same from version to version or moving to another database).
Just like records are not arrays, tables are not lists. The relational model defines a table as an unordered set of records.
If you want there to be an order, you need to define what that order is and save data that determines that order accordingly. Then, when you want your result set ordered, you need to specify the relevant ORDER BY. That is the only way to guarantee the order of query results by design.
The key concept is that order is something that the data determine, not the database. Order is an application rule or business rule. If your application or business needs that rule, you need to store the data in the database to do that. You don't want the database magically managing order in the background. You don't want to be tied to an implementation detail like that. You should be able to extract your data from your database into a text file or spreadsheet and be able to reconstruct the order. You should be able to redetermine the order your application or business requires even if the database changes completely.

Strategy to display very wide table [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I have a table that has 23 columns of data in it that I need to display. It's obviously unreasonably wide, and I am looking for a strategy to make it a little bit more manageable for my users.
That sounds like it would be better off just making the data available as CSV so that users can download it and read it in their favorite spreadsheet program. I know from experience that nothing made our users(1) happier (with one notable exception) than when we added this option in, and it's really quite easy to do. (Yeah, putting everything in a slick web interface is a nice goal, but sometimes you get better results by not working nearly so hard.)
(1) Our users are scientists. Physicists, in particular, but I'm told that biologists are the same. Your users might be different; check!
I think that 99% of times user is not interested in that many data at the same time, so try to split it somehow:
Try to show couple of main columns, and use jQuery and popups to show details for every row including other data from other columns.
Possibly not all users are interested in all columns. Show columns that are common to all users, and put an option above to show / hide additional columns
If none applies, then just show all 23 columns with horizontal splitter, no other option. If you really do this for some complex reporting purposes, perhaps provide ability to reorder columns so that users can put columns that they are interested in side to side or something.
However, I'm certain that your report can be splitted, either in many more specific reports targeting only parts of that data, or some other way...
What normally is done in databases (as you could see your table like one), is to split it up.
Especially if you have a lot of copied rows, like e.g. 10 columns are equal for all rows.
Example:
Table with customers having bought something.
The first 10 columns are for the customer's name, address, telephone etc.
If these 10 columns are equal for every customer then you can move it to a customer table and use an ID (or other unique column) to split it.
However, if all 23 columns do not have such repeating values than maybe the best thing you can do is create some kind of column selection or multiple tables with only certain columns shown.
E.g. Suppose you have a customer table with 23 information column about that customer, you can have one table with address information, one with company information etc.