Skip to content
This repository was archived by the owner on May 2, 2019. It is now read-only.

Parser file added.#7

Open
eksytnik wants to merge 2 commits intoAleksandrSl:developmentfrom
eksytnik:development
Open

Parser file added.#7
eksytnik wants to merge 2 commits intoAleksandrSl:developmentfrom
eksytnik:development

Conversation

@eksytnik
Copy link
Collaborator

No description provided.

@AleksandrSl
Copy link
Owner

travis_check

# Ignore annotation lines.
if any(i in line_elements for i in ("#", "browser", "track")):
continue
# Check if a non-annotation line if valid.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

continue
# Check if a non-annotation line if valid.
elif len(line_elements) < 3:
sys.exit("Program expects a valid BED file with at least 3 columns (chromosome, start and end).\n"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO sys.exit is not the best way. Some kind of error is more suitable.
Python has multiline strings, sot there's no need in \n

"Problem in line: %s" % line)
# End of check
else:
# Give "None" name if file is BED3 or doesn't contain name option for other BED types.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that following lines will have the same effect without else


def check_len(line):
try:
line[2]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why line, not smth like elements?) And why not if len(line) < 3:

parsed_data.append(tuple(line_elements[0:5]))
check_len(line_elements)
check_int(line_elements)
parsed_data.append(tuple(line_elements[0:5]))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the fourth element?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Realised we shoud either take 4 or 6 elements, not 5...
There can be score and strand information. Should we ignore it?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can ignore it for the moment

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants