Java help
able to create a method that return. it checks for malformed genome
and sequence
The user inputs a genome that is represented as a string composed of letters A,C,G and T of any length. Also user enter a sequence that is also represented as a string composed of letters A,C,G and T of any length.
Example
Not a malformed genome
CATGCAATGCATA
ATACGTAACGTAC
not a malformed sequence
GCATA
ATACG
Example
malformed genome
CATGCICATA ----> because of the I the genome is malformed and
the genome contains characters other than A,C,G and T.
malformed sequence
CIIA ----> because of the I the sequence is malformed and the
sequence contains characters other than A,C,G and T.
any advice
thanks in advance
CODE:
import java.util.Scanner;
public class MalformedGenome {
//method to determine a genome sequence is bad or
not
public static boolean determineMalformedGenome(String
sequence) {
//converting the string sequrnce to
character array
char[] seqArray =
sequence.toCharArray();
//boolean variable badGenome
boolean badGenome = false;
//checking the genome
sequence
//character-wise to determine
//it is bad or not
for (int i = 0; i <
seqArray.length; i++) {
//if the genome
contains any of the
//characters
other than ACGT
// it is a bad
genome, else not
if(seqArray[i]
== 'A' || seqArray[i] == 'C' || seqArray[i] == 'G' || seqArray[i]
== 'T') {
badGenome = false;
}
else {
badGenome = true;
break;
}
}
//returning the badGenome
return badGenome;
}
//driver code
public static void main(String[] args) {
//instantiating the Scanner
class
Scanner input = new
Scanner(System.in);
//prompt to enter the genome
sequence
System.out.print("Enter a sequence
of genome: ");
//getting the input sequence
String sequence =
input.nextLine();
//calling the method to determine
the malformed genome
if(determineMalformedGenome(sequence)){
System.out.println("This is a malformed genome");
}else{
System.out.println("This is not a malformed genome");
}
}
}
OUTPUT:


Java help able to create a method that return. it checks for malformed genome and sequence...
In python! Objective: students will be able to 1.access string elements by index operator 2.search for simple pattern in strings Specification: Biologists use a sequence of letters A, C, T, and G to model a genome. A gene is a substring of a genome that starts after a triplet ATG and ends before a trilet TAG, TAA, or TGA. The length of a gene string is a multiple of 3 and the gene does not contain any of the triplets...
LANGUAGE: JAVA
An online coin dealer offers bags of coins that are guaranteed to contain at least one full set. Given a string comprised of lowercase letters in the range ascii[a-z), where each letter represents a coin type, determine the length of the shortest substring that contains at least one of each type of coin. Example: coins = dabbcabcd The list of all characters in the string is (a, b, c, d]. Two of the substrings that contain all letters...
In java, write a program with a recursive method which asks the user for a text file (verifying that the text file exists and is readable) and opens the file and for each word in the file determines if the word only contains characters and determines if the word is alpha opposite. Now what I mean by alpha opposite is that each letter is the word is opposite from the other letter in the alphabet. For example take the word...
Write a program that inputs a string from the user representing a password, and checks its validity. A valid password must contain: -At least 1 lowercase letter (between 'a' and 'z') and 1 uppercase letter (between 'A' and 'Z'). -At least 1 digit (between '0' and '9' and not between 0 and 9). At least 1 special character (hint: use an else to count all the characters that are not letters or digits). -A minimum length 6 characters. -No spaces...
You went for a walk on a strange street and now you’re lost. There are N stores in a row on the street (1≤N≤100). Each store has a sign with a single letter in the range of A…Z (not required to be a unique letter per sign). You want to use the letters of the signs closest to you to help you figure out your location. The sequence of N signs along the street can be represented as a string...
java
/* Q2 (10 pts): Write a method called method that accepts an integer parameter * * * * and returns a sum of the first n terms of the sequence. * In other words, the method should generate the following sequence: 1 + 1/2 + 1/3 + 1/4 + ... 1/n * For example, method2(2) will return 1.5 since 1+1/2 = 1.5 * method2 (15) will return 3.3182289932289937 * You may assume that the parameter n is nonnegative. */...
Please I need help. Java language Method name: getScores Return value is a String of numbers scaled so that the highest number in the parameter String becomes 100 and all the other numbers are moved up by the same amount. This String should also be numbers separated by spaces with no additional characters. The order of the numbers should stay the same, so that a number in the original string has the equivalent scaled number in the returned string in...
Java programming: I need to create a method that is given a 2D char array and a String that returns a part of the original 2D array. The input string will tell the method which rows from the input array need to be returned. For example, a 5x5 char array input along with a string "0 4" would return rows 1 and 5 of the input array. The String input will always be numbers divided by spaces and will not...
Please I need help. Java language Method name: getScores Return value is a String of numbers scaled so that the highest number in the parameter String becomes 100 and all the other numbers are moved up by the same amount. This String should also be numbers separated by spaces with no additional characters. The order of the numbers should stay the same, so that a number in the original string has the equivalent scaled number in the returned string in...
create a Java class ShiftCipher The program ShiftCipher should take two inputs from the terminal. The first should be a string of any length which contains any type of symbol (the plaintext). The second will be a shift value which should be between 0 and 25 inclusive (though you may design your program to be resilient to shifts beyond this value). The program should print the cipher text, in which each of the alphabetic characters in the string is shifted...