7
votes
Accepted
6
votes
Accepted
Possibility to save output blastn table in memory using biopython
You can specify send to stdout using out='-' in the Biopython wrapper.
...
4
votes
How to do `bedtools intersection` using pandas alone?
I don't think Pandas has this implemented functionality out-of-the-box. Even if it did, solutions not designed specifically for bioinformatics probably rarely handle intervals on different chromosomes ...
4
votes
3
votes
Accepted
Tidying MEGAN Taxonomy for Python/R Analysis
Save the following as a python script (e.g., named splitty.py). Make the script executable by doing chmod +x splitty.py. Then, ...
3
votes
Accepted
How to fix the Error in Kruskal Wallis rank sum test for comparing the guides in python? Also to check whether using the right test for my data?
Reformatting the data for the KW and doing the test is easy.
Using "guide_1" alone and pivot() to get A = [1, 0.426115 ...
...

M__♦
- 11.3k
3
votes
To create a new column with Pandas on the basis of two types of column values
To elaborate on this answer, here is a full working example where I assume that "BARCODE", "ANCHOR_NAME" and ...
3
votes
Accepted
To create a new column with Pandas on the basis of two types of column values
You can use groupby() as following :
...
3
votes
Accepted
3
votes
Accepted
Getting rid of duplicates in a dictionary
Not sure how you'd do this in python but you need a group-by operation here. Group by the read name and pick the min length per group.
EDIT: With pandas, you can do:
...
2
votes
How to do `bedtools intersection` using pandas alone?
I implemented pandas "Intervals" and ... it should be a few lines, clearly there are limitations. For non-overlapping data it is very cool however. It will work for overlapping data, BUT if the data ...

M__♦
- 11.3k
2
votes
Accepted
Adding multiple dataframes to compare against genotypes - DATE/LOCATION - geotemporal incidences of SARS2 genotypes
Just to clarify, when I asked you to share some of your files, I meant to share them in a way that I can reproduce your issue from start to finish. You read from at least four different files in a ...
2
votes
Accepted
Converting hmmer --tblout to pandas dataframe
The manual says fields in a tabular output file are space-delimited. It should be fairly straightforward to load a space-delimited file in pandas.
From the manual:
...
2
votes
Accepted
Help to create a dataframe in Python from a FASTA file
Assuming what I said in the comments is true. Here's my attempt, there may be an easier solution but this should do it:
...
2
votes
How to do `bedtools intersection` using pandas alone?
As mentioned by OP, another option is to use pybedtools, which in my opinion is pretty convenient for people already familiar with BedTools.
Let's even say df1's format is slightly different than df2:
...
2
votes
Accepted
How to get separate histograms plots on the basis of the column value?How to detect which plot has most deviation?
You could use the groupby() pandas function to group the dataframe by gene name. And then just loop through each group to plot the histogram of correlation values. I think you can use the mean of the ...
2
votes
Accepted
2
votes
Accepted
calculating mutation frequencies for every gene
The code is fine. The only issue is you'd put \s characters in-between the column header names. I've place an additional "mutation_frequency" column because thats how I'd do it.
...

M__♦
- 11.3k
2
votes
Accepted
expansions and contractions from OrthoFinder
The answer is actually right there in the error message (warning message, actually):
DtypeWarning: Columns (2,... 968) have mixed types. Specify dtype option on import or set low_memory=False.
...
2
votes
How to run python request for list of url's with multiple page numbers?
@Megha
The requestIt(link) function returns a list of dictionary objects.
So your "data" variable is a list of dictionary objects.
Every item on this list (a dict) has a key named "...
2
votes
Accepted
How to calculate frequency of a category with respect to the value in another column?
I am not able to reproduce the issue.
However I think this is a crosstab problem:
...
2
votes
Getting rid of duplicates in a dictionary
You can do this with the sort command-line tool. This command pipe sequence sorts numerically by the second field, then chooses unique elements based on the first ...
1
vote
Accepted
How to get enriched pathways in the data using continous statistic measure?
Just to mention I personally think there is a higher loop above the loop stated above.
I've not looked at each bit of code in detail but
there's a bug is on line 4:
...

M__♦
- 11.3k
1
vote
Accepted
How to run python request for list of url's with multiple page numbers?
Okay, its done. What you are looking for is as follows:
...

M__♦
- 11.3k
1
vote
How to run python request for list of url's with multiple page numbers?
@Megha, I have not looked through the code in too much detail, however.
obo = obj["obo_id"] for obj in data
This isn't formal Python code. The correction ...

M__♦
- 11.3k
1
vote
Accepted
Automate the def function in pandas for correlation
If I have understood the question is to generalise the column names to permit a function to accept dataframes where you don't have the same column name, or it's different from the previous dataframe ...

M__♦
- 11.3k
1
vote
Accepted
Python list comprehension to calculate the set of categories for each row
What I'm not clear about is the definition of y - thats crucial to understanding what the code does. Just to note, although you've called the dataframe ...

M__♦
- 11.3k
1
vote
expansions and contractions from OrthoFinder
The error right at the end is
Specify dtype option on import or set low_memory=False.
Edit Oh wait @terdon has already spotted ...

M__♦
- 11.3k
1
vote
Merge data frame on either of the 2 columns in R or python
I think this question is more about subsetting than merging. You can try this solution in R:
...
1
vote
HTTP status code: 400 "Value must be an integer" error uploading JSON schema results to benchling
There is a major issue about the json format required, however just converting to json is easy because ...

M__♦
- 11.3k
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
pandas × 28python × 25
dataframe × 7
phylogenetics × 3
statistics × 3
merge × 3
r × 2
phylogeny × 2
kegg × 2
interval × 2
proteins × 1
sequence-analysis × 1
blast × 1
differential-expression × 1
file-formats × 1
visualization × 1
covid-19 × 1
sars-cov-2 × 1
bedtools × 1
mutations × 1
pathway × 1
correlation × 1
go-enrichment × 1
api × 1
hmmer × 1