Why doesn't this program print numbers 1.0 and higher? Is there some rule about the scanner I'm overlooking?

Why doesn't this program print numbers 1.0 and higher? Is there some rule about the scanner I'm overlooking?

Attached: Alpha Helix.png (1366x768, 96K)

When a scanner isn't used, the program prints what it's supposed to.

Attached: Test.png (994x427, 34K)

I hope this is bait

Attached: 1549419180791.jpg (685x564, 52K)

Here's an image from which the residue sequence was obtained from. The 3D visualization software used is called Pymol.

Attached: 14 residues.png (647x383, 83K)

All of the numbers printed should be under 3. Nor should any of the numbers be less than 1.

Attached: core.png (191x415, 24K)

A number closer to one means those two residues are more likely to form hydrogen bonds.

Attached: hydropathy.png (160x538, 37K)

All I can think of that seems to be wrong is something related with the scanner.

Attached: Test1.png (948x573, 45K)

Attached: Test2.png (1002x395, 28K)

Attached: 11 residues.png (512x188, 30K)

>scientific programming
disgusting, go read clean code and then consider jumping off a bridge

The problem might be array capacity. It's hard to belive the array capacity shown here would only be five though. Seems like Oracle could have designed Java better. Also, I just used the same technique as some old code from a programming class for engineers I took. Why would the teacher use code that wouldn't be useful for most cases?

Attached: array capacity.png (473x518, 24K)

holy shit lad im gonna have to ask you to kill yourself please

I prefer condensed code. More can be seen at once that way.

That's a huge pain in the ass to read. Please format your code nicer.

Use braces.
Use parenthesis.
Have only one statement per line maximum (hint: only one semicolon except for the ones in a for loop condition).

>condensed code
Jesus Christ.

What you've shown here is a maintenance and readability nightmare. But more importantly, nobody is going to be able to tell what the fuck you are trying to do or even begin to look for a problem.

If you format it well, comment what you are trying to accomplish and Pastebin or git it or something, people would be more inclined to help.

I'm starting to think that this is an April Fool's joke, as it parodies the worst stereotypes about code written by scientists and electrical/mechanical engineers.

What the fuck is this garbage trying to do

You're dividing by zero or something similarly wrong. In the case of floats and doubles, you'll get +Infinity, -Infinity or NaN.

Remember that any of your array values will default to 0 until filled.

Scanner is likely doing nothing wrong.

It's hard to tell because this code is unreadable.

Other versions of the code show what it's supposed to print.

See:

>Why would the teacher use code that wouldn't be useful for most cases?

Because solving the problem more generally may be part of the assignment.

I don't know your teacher or course but if they will be judging not just the success of the code but the quality then you will really need to 'un-condense' this.

Predict hydrogen bonds in the alpha helix of proteins.

See:

That was the first thought that ocurred to me. I don't see how there would be a zero though.

Attached: maybe.png (1366x768, 193K)

this code is such shite, what are all the closing brackets closing if there is never an opening bracket???

idk, but either way you're a faggot op

go fix ur fucking Code before asking for help u ape

>Predict hydrogen bonds in the alpha helix of proteins
Maybe it would help if you explained the process in more general terms?

Instead you assume that there exists a person who a) actually does bioinformatics in java, b) knows the specifics of this particular problem, c) is able and willing to read your code and d) posts on Jow Forums.

You mean explain the code piece by piece or explain the purpose of the code?

Here's the sort of thing the code is supposed to predict
or at least the code is supposed to hint at it. The closer the number printed is to 1, the more likely the the alpha helix (see pictures above) forms. Note, the number should never be below 1.

I was a bit harsh earlier due your "condensed code" idea being off the wall.

Anyways, we don't know why the code is doing its various intrinsics.

For example:
Why is it looping for 13? We see that there's 13 characters in the input, but the input could be more or less than that in other cases, for all that we know.

(A better construct would be to do while(myScanner.next()) or something that waits for a newline along those lines, by the way.)

What is, say, 8.18? What is 9.04? These are called "magic numbers" and without bioinformatics knowledge, we can't tell what those are.
Usually this is solved by having named variables, or by having code comments. In this case, you can also just tell us here.

What is s[i][j+4]? Why 4?

Asking these questions is how people can help you. However, even knowing what questions to ask you requires hunting through the code, which is made more difficult by how you structured it - even though this condensed code is easy for you to read, it's not for us, because we're not you. This is all new code.

The PyMol images shown are from a protein called "3MOP." The protein sequence in the Java code is in the alpha helix shown in the three PyMol images. The protein 3MOP can be found on the protein data bank (pdb). Then the pdb file can be entered into PyMol, JMol, or an equivalent program.

In an ideal alpha helix, a hydrogen bond forms every 100 degrees and every four residues in the polypeptide chain. Note, the peptide chain is stronger than the hydrogen bond. The peptide bond (pdb sequence) is fixed.

The hydogen bonds however occur in greater numbers. A single arganine residue can form five hydrogen bonds, that's rare though. Typically, a secondary structure (alpha helix and beta sheet) has two hydrogen bonds per residue.

As the PyMol images indicate, the average hydrogen bond is ~2 angstroms. This Java program in this thread isn't concerened with these measurements though. In terms of hydropathy, like bonds with like. The Java program ignores the possibility of resonant bonds (which occur in the PyMol images posted ITT). For now, only the texbook alpha helix is considered.

Lastly, the protein "3MOP" is associated with the TLR, which is a sort of on/off switch in the immune system. If you type "TLR" on the pdb, you'll find 22 listings, 20 of which are proteins. 3MOP is particularly rich in alpha helix structures.

Attached: alpha helix.gif (450x600, 27K)

Yeah. Explain what you want to do. Do you assume that secondary structures of proteins and prediction of hydrogen bonds are general knowledge?

Starting to sound like a joke. Are you a tutor and someone actually handed this in?

I don't see where `j` is incremented or decremented, so you could probably just replace it with 0 and 4 respectively.

Also, using a byte as an array index is weird. It will work, because java treats it as an int (and it kinda is under the hood) but it is more idiomatic to use an int (the common index variable i is i both because of the word index and because it is commonly an "int").

Hmm. You've misinterpreted what we mean by "what you are trying to do".

We're asking what the code is trying to do with respect to itself and the input;
It gets a string of characters, so what is the code trying to do with those characters? It may be easier for you to treat our questions in a context where you ignore that this is a bioinformatics program altogether.

Please see

j isn't supposed to be incremented. It's set to 0.

See: The equation circled here is supposed to set the value for the double array when the second bracket is four.

The problem I'm seeing is that you are using indexOf() which returns the first instance of specified character, which means that you are dividing by zero whenever a characters appears more than once. Change p.indexOf('S') == i with p.charAt(i) == 'S' etc...

By the way if you want others to help you easier you should format your code better.

I don't think you understand or read what I said. You can remove `j` altogether because it is invariant.

>Why is it looping for 13? We see that there's 13 characters in the input, but the input could be more or less than that in other cases, for all that we know.
An earlier version of the code used p.length, but was replaced by 13 for testing purposes. I just wanted to see if something would print. Then p.length would be added again. The code used for string conversion was on the some old code from a programming class. Pic related,

I'll try myScanner.next()
>What is, say, 8.18? What is 9.04?
See: >What is s[i][j+4]? Why 4?
Ideally, a hydrogen bondn forms every four residues in an alpha helix.

Attached: String Array.png (723x334, 22K)

Alright, that makes sense.

I think in one of the versions of this code, j was removed. I don't remember if I saved that version or not. Earlier versions of this code had three while loops instead of two.

I ogriginally planned a more ambitious code, but decided to just stick to the ideal (1. two hydrogen bonds per residue 2. hydrogen bonds every four residues) alpha helix, to focus on getting a program that prints what it's supposed to first.

Thanks everyone!

Especially & Goodbye.

We're not gonna do your work pajeet, especially since the code you've written looks like shit and you're using a shit OS

Why did you initialize the scanner out of the main() function?

I wish this was a joke, but that's not the first time he posted his shit code here and people gave him the shit.

He's 100% dead serious.

learn how to use key-pair hashes you absolute buffoon

> using a separate IF for each single letter amino acid

HashMap is your friend, use him
use a code linter