473,383 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Count triples

Can someone give some hints???
Id like to know if someone have a code for visual basic/ excel to calculate the ocurrence of triples or triplets.
Because id like to count the ocurrence of triples numbers in a DNA or RNA chromossome , in order to verify certain parameters in sequences like
16 11 88 32 25 0 70 78 73 61 90 89 46 95 6 33 34 21 14 22
76 63 18 44 84 11 55 93 8 29 82 62 17 64 24 14 37 97 49 51
34 8 10 11 99 28 67 20 55 74 45 48 85 91 79 57 47 22 17 54
14 67 12 55 25 60 51 30 41 35 78 83 93 64 98 39 44 49 5 63

the ocurrence of triple (8,11,77) for example.

I'm looking forward to receiving good news.

Thanks in advance
Mar 6 '10 #1

✓ answered by Guido Geurs

dear,

Is this a solution? (see attachment)


br,

10 2379
debasisdas
8,127 Expert 4TB
What is the logic to implement that ?
Mar 6 '10 #2
Guido Geurs
767 Expert 512MB
dear,

I hope this will help You (see attachment)

Select a TXT file and open the file by clicking on "Open".
Click on "Search" to view the numbers in the listbox.

Ps :
- in your example, must it not be the triples 11, 14 and 55 ?
- If you want the Singles, Dubbles, ... it's just a small modification !!


br,
Attached Files
File Type: zip count_Triples.zip (7.5 KB, 170 views)
Mar 8 '10 #3
Guido Geurs
767 Expert 512MB
dear,

Is the result for your example like this: for 8 - 11 - 74

16 11 88 32 25 0 70 78 73 61 90 89 46 95 6 33 34 21 14 22
74 63 18 44 84 11 55 93 8 29 82 62 17 64 24 14 37 97 49 51
34 8 10 11 99 28 67 20 55 74 45 48 85 91 79 57 47 22 17 54
14 67 12 55 25 60 51 30 41 35 78 83 93 64 98 39 44 49 5 63

Result= 2

Is this what you want?

br,
Mar 9 '10 #4
Guido Geurs
767 Expert 512MB
dear,

Is this a solution? (see attachment)


br,
Attached Files
File Type: zip count_Triples_v2.zip (8.6 KB, 82 views)
Mar 9 '10 #5
Guido Geurs
767 Expert 512MB
dear,


I have prepared something in Excel. (see attachment).
Is this what you are looking for?

If you want to test it, just run the macro "Find_Triples" or click in the toolbar on the button "123".

Remark: I have limited the run to the 10 first triples because there are 161.700 combinations of 100 numbers in groups of 3.

You can change this by changing the range in the line =

Expand|Select|Wrap|Line Numbers
  1. '§ VVVVVVVVVVVVVVVVVVVVV can be deleted
  2.    Call Scan_Triples_Column("A1:A10")
  3. '§AAAAAAAAAAAAAAAAAAAAAA !!!!! Next line de-comment if deleted !!!!!
if you want the first 100 triples, change the range to ("A1:A100")

I have done this because on my PC( Pentium 4 : 2.6 GHz ) it takes 7 min. for the first 1.000 triples.
So 161.700 triples = .... HOURS !!!!

Is this the right way am working ?
If so, I will try reduce the duration by searching an other algorithm for the scan.
Maybe with the Excel fomula "Match" ???


br,
Attached Files
File Type: zip count triles_v2.9.zip (1.29 MB, 82 views)
Mar 12 '10 #6
Guido Geurs
767 Expert 512MB
Dear,


I hope this will help. (see attachment).
The results are in an array.
You can dump them in any lay-out in a sheet; (I have just written a code for columns)

br,
Attached Files
File Type: zip COUNTTRIPLES_3.12.zip (31.0 KB, 90 views)
Mar 16 '10 #7
Guido Geurs
767 Expert 512MB
dear,

I have downloaded and opened the attachment without any problems.
Anyway here is it again.
Sorry but attaching the same file again (even with a different name) don't works in Bytes.
I have added a empty TXT file in the ZIP and now it's OK.

Good luck.


br
Attached Files
File Type: zip COUNTTRIPLES_3.12_2th-time.zip (31.2 KB, 69 views)
Mar 17 '10 #8
Guido Geurs
767 Expert 512MB
dear,


Sorry, my mistake: I have split the code for error tracking and did not redirect the macro in the button.

I have attached the updated version.

PS:
- if it don't work, run the macro "Sheet1.Do_All" manually.
- I have also entered lines for fast controle=

Expand|Select|Wrap|Line Numbers
  1. '§ VVVVVVVVVVVVVVVVVVVVVV 120 TRIPLES :just for testing = can be deleted
  2. '   For FIRST_idx = 1 To 8
  3. '      For SECOND_idx = FIRST_idx + 1 To 9
  4. '         For THIRD_idx = SECOND_idx + 1 To 10
  5. '            TOTAL_TRIP = "120"
  6. '§ AAAAAAAAAAAAAAAAAAAAAA if deleted or commented, de-comment FINAL CODE
  7. '§ VVVVVVVVVVVVVVVVVVVVVV 19.600 TRIPLES :just for testing = can be deleted
  8. '   For FIRST_idx = 1 To 48
  9. '      For SECOND_idx = FIRST_idx + 1 To 49
  10. '         For THIRD_idx = SECOND_idx + 1 To 50
  11. '            TOTAL_TRIP = "19.600"
  12. '§ AAAAAAAAAAAAAAAAAAAAAA if deleted or commented, de-comment FINAL CODE
  13. '§ VVVVVVVVVVVVVVVVVVVVVV FINAL CODE
  14.    For FIRST_idx = 1 To 98
  15.       For SECOND_idx = FIRST_idx + 1 To 99
  16.          For THIRD_idx = SECOND_idx + 1 To 100
  17.             TOTAL_TRIP = "161.700"
  18. '§ AAAAAAAAAAAAAAAAAAAAAA
If you want to use the triples from 1 to 10: decomment the first code and comment the last code.

If you want to use the triples from 1 to 50: comment the first code, de-comment the second code and comment the last code.

If you want to use the triples from 1 to 100: comment the first code and the second code and de-comment the last code.



br,
Attached Files
File Type: zip COUNTTRIPLES_3.13.zip (32.2 KB, 88 views)
Mar 19 '10 #9
Guido Geurs
767 Expert 512MB
dear,

You are right, I did the mistake to test it with triples from 1 to 50.
There are 19.600 combinations in groups of 3 and "integer" goes to 32.767.
there are 161.700 combinations for 1 to 100 !
So the vars must be from the type dimension "Long".

This is the right code:

Expand|Select|Wrap|Line Numbers
  1. Function Dump(FROM_idx As Long, TO_idx As Long)
  2. Dim ARR_TRIP_idx As Long
I'm very sorry for this wrong calculation of me.
Attached is the modify-ed sheet with the results for triples from 1 to 100.

br,
Attached Files
File Type: zip COUNTTRIPLES_3.14.zip (995.1 KB, 98 views)
Mar 21 '10 #10
Guido Geurs
767 Expert 512MB
Dear,

Attached is a new Excel sheet which is much faster in dumping the results.

br,
Attached Files
File Type: zip COUNTTRIPLES_3.15.zip (32.9 KB, 92 views)
Mar 24 '10 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

22
by: Ling Lee | last post by:
Hi all. I'm trying to write a program that: 1) Ask me what file I want to count number of lines in, and then counts the lines and writes the answear out. 2) I made the first part like this: ...
37
by: Jason Heyes | last post by:
A pythagorean triple is a triple <a,b,c> whose components are positive integers satisfying a*a + b*b = c*c. An example is <3,4,5> since 3*3 + 4*4 = 9 + 16 = 25 = 5*5. I want to write a function...
1
by: JD | last post by:
Hi guys I'm trying to write a program that counts the occurrences of HTML tags in a text file. This is what I have so far: #include <stdio.h> #include <stdlib.h> #include <string.h> ...
1
by: hasky | last post by:
Where can I find simple code of triples.
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
3
by: Leeh | last post by:
I'm new to the world of RDF and RDF/XML so pardon my naive question: I understand that the "real" RDF model is the conceptual network of nodes (Subjects and Objects) connected by predicate arcs;...
11
by: corwood | last post by:
I am in a VB .NET class, and one of the assignments is to use loops to generate a list of all the pythagorean triples where legA and legB <100 and hypotenuse < 200, and then put this list into a...
5
by: stephanieanne2 | last post by:
The Problem: A right triangle can have sides that are all integers. The set of three integer values for the sides of a right triangle is called a Pythagorean triple. These three sides must satisfy...
3
by: nuzhatjahan | last post by:
Hello, please help me .I want program written in c language or c++ to conver regular expression to quadruples and regular expression to triples. also program related with compiler construction
1
by: jlt206 | last post by:
This code <?php include("counter.php")?> on the webpage produces the count number. (function code below) I want to place the current number into a variable $MemberNo or into a FormField to be sent...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.