In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will introduce in detail for you "how to view repeated DNA sequences in java", the content steps are clear and detailed, and the details are handled properly, and the editor updates different knowledge points every day, I hope this article "how to view repeated DNA sequences in java" can give you unexpected gains, please follow the editor's ideas slowly in depth, the specific contents are as follows, to harvest new knowledge.
All DNA are made up of a series of nucleotides abbreviated as Ameme Cpene G and T, such as "ACGAATTCCG". In the study of DNA, it is sometimes very helpful to identify repetitive sequences in DNA.
Write a function to find all 10-letter sequences (substrings) in the DNA molecule that appear more than once.
Example:
Enter: s = "AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT"
Output: ["AAAAACCCCC", "CCCCCAAAAA"]
Answer:
1public List findRepeatedDnaSequences (String s) {
2 Set seen = new HashSet ()
3 Set repeated = new HashSet ()
4 for (int I = 0; I + 9 < s.length (); iTunes +) {
5 String ten = s.substring (I, I + 10)
6 if (! seen.add (ten))
7 repeated.add (ten)
8}
9 return new ArrayList (repeated)
10}
Parsing:
It means to intercept a substring of 10 characters at a time, and this kind of string appears more than once. The code is very simple. Each time it is intercepted, it will be stored in the seen collection. If the storage fails, it indicates that there is a repetition. Let's take a look at another way to write it.
1public List findRepeatedDnaSequences (String s) {
2 Set words = new HashSet ()
3 Set repeated = new HashSet ()
4 char [] map = new char [26]
5 / / map ['A' -'A'] = 0
6 map ['C' -'A'] = 1
7 map ['G' -'A'] = 2
8 map ['T' -'A'] = 3
9 for (int I = 0; I < s.length ()-9; iTunes +) {
10 int v = 0
11 for (int j = I; j < I + 10; jacks +) {
12 v
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.