Currently I am analysing several metagenome and transcriptome datasets. For downstream analysis I am clustering these datasets with CD-HIT. Unfortunately CD-HIT produces no default output with an overview of sequence abundance within each cluster (simple tab delimited file). I found an old script which grabs this information but it uses the .bak.clstr output which was only available till version 4.3. Is there a way to produce this output in the newest version or an alternative way to produce a simple sequence abundance to cluster name overview?
In this code, when Cluster 2 is expected to be picked Cluster 20000 will be picked if there are 20000 number of clusters, if there are 27 clusters, Cluster 27 will be picked. In the examples it looks as if it worked fine because there are less than 10 Clusters in the examples.
add \n to Cluster $i and Cluster $j as follows and the script would work fine.
By sequence abundance do you mean how many times the duplicate sequence is found in the cluster?
Check if this useful. (assuming no empty lines between Cluster 0 and Cluster 1)
Is this what you wanted?
Dear Prakki, I wonder if you have a solution if within each Cluster are different individuals like this:
and I would like to find out how many Clusters own only one, two or all three species as it is the case in Cluster 0?
Thanks a lot!
the above script should serve your purpose!
Is this supposed to run in bash?
I get the following output...
Dear Prakki, I find your script super useful. This is something I exactly need. More specifically I need this script to split my cd-hit output for clusters having 1 sequence and more than 1 sequences. What I do is I rename my output.clstr file as cd-hit.test.txt. Then I copy your script and save in the same folder as perl clstr_num.pl. Then I simply run it by
My output.clstr or cd-hit.test.txt file looks like this
but the script outputs
Where I expect the output
Can you please guide me how to get the expected output? Please excuse my childish language, I have 0 coding knowledge. It's actually my 1st comment on biostar. Your help would be a huge favor and highly appreciated. Thanks much, Shan
Hi @syed. I just saw your message. The above script has actually worked for me. Let me show you, how I did.
I just had to change the filenames. I did not change any code. Make sure you input is properly formatted as the example used above. Then, I guess the script should work.
This script does not work very well - wrong count. Particulary for large output..